HammerHurt.cs 3.8 KB

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