GiantRobotHurt.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using System;
  2. using GameWorld;
  3. using UnityEngine;
  4. public class GiantRobotHurt : EnemyBaseHurt
  5. {
  6. protected override void Init()
  7. {
  8. this.defaultAnimName = "NoStiff";
  9. this.defaultAirAnimName = "NoStiff";
  10. this.hurtData = SingletonMono<EnemyDataPreload>.Instance.hurt[EnemyType.巨型机器人];
  11. }
  12. protected override void PhysicAndEffect(Vector2 speed, Vector2 airSpeed, string normalAtkType, string airAtkType)
  13. {
  14. if (this.action.IsInWeakSta())
  15. {
  16. return;
  17. }
  18. base.PhysicAndEffect(speed, airSpeed, normalAtkType, airAtkType);
  19. }
  20. protected override void HitIntoWeakState(Vector2 speed, Vector2 airSpeed, string normalAtkType, string airAtkType)
  21. {
  22. normalAtkType = "ReadyToWeakMod";
  23. airAtkType = "ReadyToWeakMod";
  24. base.ChaseEnd();
  25. this.action.EnterWeakState();
  26. this.eAttr.stiffTime = 1f;
  27. base.PlayHurtAnim(normalAtkType, airAtkType, speed, airSpeed);
  28. if (!base.IsInvoking("ExitWeak"))
  29. {
  30. base.Invoke("ExitWeak", 5f);
  31. }
  32. }
  33. protected override void FlashAttackHurt()
  34. {
  35. this.ExecuteDieEffect();
  36. R.Effect.Generate(214, null, default(Vector3), default(Vector3), default(Vector3), true);
  37. SingletonMono<WorldTime>.Instance.TimeSlowByFrameOn60Fps(30, 0.5f);
  38. R.Camera.Controller.CameraShake(0.5f, 0.2f, CameraController.ShakeTypeEnum.Rect, false);
  39. R.Camera.Controller.OpenMotionBlur(0.0833333358f, 1f, base.transform.position);
  40. this.SetHitSpeed(Vector2.zero);
  41. base.GenerateCritHurtNum(base.flashAttackDamage);
  42. base.FlashAttackHurt();
  43. }
  44. protected override void PlayHurtAudio()
  45. {
  46. base.PlayHurtAudio();
  47. if (base.PlaySpHurtAudio())
  48. {
  49. R.Audio.PlayEffect(401, new Vector3?(base.transform.position));
  50. }
  51. }
  52. public override void QTEHurt()
  53. {
  54. base.QTEHurt();
  55. R.Player.Action.QTEHPRecover(false);
  56. base.QTEZPositionRecover();
  57. base.QTEHpMinus();
  58. }
  59. public override void EnemyDie()
  60. {
  61. }
  62. protected override void ExecuteDie()
  63. {
  64. if (this.deadFlag)
  65. {
  66. return;
  67. }
  68. R.Trophy.AwardTrophy(30);
  69. R.Audio.PlayEffect(412, new Vector3?(base.transform.position));
  70. R.Player.Action.QTEHPRecover(this.eAttr.rankType == EnemyAttribute.RankType.BOSS);
  71. R.Audio.PlayEffect(UnityEngine.Random.Range(105, 108), new Vector3?(base.transform.position));
  72. this.deadFlag = true;
  73. this.eAttr.currentHp = 0;
  74. this.eAttr.inWeakState = false;
  75. this.eAttr.isFlyingUp = false;
  76. this.eAttr.checkHitGround = false;
  77. this.eAttr.stiffTime = 0f;
  78. this.eAttr.timeController.SetGravity(1f);
  79. EventManager.PostEvent<EnemyAttribute>("EnemyKilled", this.eAttr);
  80. this.action.WeakEffectDisappear("Null");
  81. R.Effect.Generate(91, null, base.transform.position + new Vector3(-1f, 5.2f, LayerManager.ZNum.Fx), Vector3.zero, default(Vector3), true);
  82. R.Effect.Generate(49, base.transform, default(Vector3), default(Vector3), default(Vector3), true);
  83. R.Effect.Generate(14, null, base.transform.position + new Vector3(-1f, 5.2f, LayerManager.ZNum.Fx), default(Vector3), default(Vector3), true);
  84. base.AddCoinAndExp();
  85. R.Effect.Generate(213, null, default(Vector3), default(Vector3), default(Vector3), true);
  86. R.Effect.Generate(214, null, default(Vector3), default(Vector3), default(Vector3), true);
  87. SingletonMono<WorldTime>.Instance.TimeSlowByFrameOn60Fps(45, 0.2f);
  88. R.Camera.Controller.CameraShake(0.9166667f, 0.3f, CameraController.ShakeTypeEnum.Rect, false);
  89. this.action.hurtBox.gameObject.SetActive(false);
  90. this.eAttr.inWeakState = false;
  91. }
  92. }