StickerHurt.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. using System;
  2. using ExtensionMethods;
  3. using GameWorld;
  4. using UnityEngine;
  5. public class StickerHurt : 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. base.HitIntoWeakState(speed, airSpeed, normalAtkType, airAtkType);
  37. }
  38. protected override void FlashAttackHurt()
  39. {
  40. this.ExecuteDieEffect();
  41. SingletonMono<WorldTime>.Instance.TimeSlowByFrameOn60Fps(30, 0.5f);
  42. R.Camera.Controller.CameraShake(0.5f, 0.2f, CameraController.ShakeTypeEnum.Rect, false);
  43. R.Camera.Controller.OpenMotionBlur(0.0833333358f, 1f, base.transform.position);
  44. R.Audio.PlayEffect(258, new Vector3?(base.transform.position));
  45. this.SetHitSpeed(Vector2.zero);
  46. base.GenerateCritHurtNum(base.flashAttackDamage);
  47. this.action.AnimChangeState(StickerAction.StateEnum.Hit1, 0.5f);
  48. base.FlashAttackHurt();
  49. }
  50. public override void QTEHurt()
  51. {
  52. base.QTEHurt();
  53. R.Audio.PlayEffect(258, new Vector3?(base.transform.position));
  54. R.Player.Action.QTEHPRecover(false);
  55. base.QTEZPositionRecover();
  56. base.QTEHpMinus();
  57. }
  58. public override void EnemyDie()
  59. {
  60. }
  61. protected override void ExecuteDie()
  62. {
  63. if (this.deadFlag)
  64. {
  65. return;
  66. }
  67. if (this.eAttr.rankType == EnemyAttribute.RankType.BOSS)
  68. {
  69. R.Audio.PlayEffect(412, new Vector3?(base.transform.position));
  70. }
  71. R.Player.Action.QTEHPRecover(this.eAttr.rankType == EnemyAttribute.RankType.BOSS);
  72. R.Audio.PlayEffect(UnityEngine.Random.Range(105, 108), new Vector3?(base.transform.position));
  73. this.deadFlag = true;
  74. this.eAttr.currentHp = 0;
  75. this.eAttr.inWeakState = false;
  76. this.eAttr.isFlyingUp = false;
  77. this.eAttr.checkHitGround = false;
  78. this.eAttr.stiffTime = 0f;
  79. this.eAttr.timeController.SetGravity(1f);
  80. EventManager.PostEvent<EnemyAttribute>("EnemyKilled", this.eAttr);
  81. this.action.WeakEffectDisappear("Null");
  82. R.Effect.Generate(91, null, base.transform.position + new Vector3(0f, 1.2f, LayerManager.ZNum.Fx), Vector3.zero, default(Vector3), true);
  83. R.Effect.Generate(49, base.transform, default(Vector3), default(Vector3), default(Vector3), true);
  84. R.Effect.Generate(14, null, base.transform.position + new Vector3(0f, 1.2f, LayerManager.ZNum.Fx), default(Vector3), default(Vector3), true);
  85. base.AddCoinAndExp();
  86. R.Effect.Generate(213, null, default(Vector3), default(Vector3), default(Vector3), true);
  87. R.Effect.Generate(214, null, default(Vector3), default(Vector3), default(Vector3), true);
  88. SingletonMono<WorldTime>.Instance.TimeSlowByFrameOn60Fps(45, 0.2f);
  89. R.Camera.Controller.CameraShake(0.9166667f, 0.3f, CameraController.ShakeTypeEnum.Rect, false);
  90. this.action.hurtBox.gameObject.SetActive(false);
  91. this.eAttr.inWeakState = false;
  92. base.transform.position = base.transform.position.SetZ(LayerManager.ZNum.MMiddleE(this.eAttr.rankType));
  93. }
  94. }