DahalFHurt.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. using System;
  2. using GameWorld;
  3. using UnityEngine;
  4. public class DahalFHurt : EnemyBaseHurt
  5. {
  6. protected override void Init()
  7. {
  8. this._dahal = base.GetComponent<DahalFAnim>();
  9. this.defaultAnimName = "Hit1";
  10. this.defaultAirAnimName = "Hit1";
  11. this.hurtData = SingletonMono<EnemyDataPreload>.Instance.hurt[EnemyType.达哈尔终极版];
  12. }
  13. protected override void Update()
  14. {
  15. base.Update();
  16. Vector2? rollAtkFollowPos = this._rollAtkFollowPos;
  17. if (rollAtkFollowPos != null)
  18. {
  19. Vector3 position = base.player.transform.position;
  20. Vector2? rollAtkFollowPos2 = this._rollAtkFollowPos;
  21. Vector3 position2 = position - ((rollAtkFollowPos2 == null) ? default(Vector3) : (Vector3)rollAtkFollowPos2.GetValueOrDefault());
  22. position2.y = Mathf.Clamp(position2.y, LayerManager.YNum.GetGroundHeight(base.gameObject) + 1f, float.PositiveInfinity);
  23. position2.z = LayerManager.ZNum.MMiddleE(this.eAttr.rankType);
  24. base.transform.position = position2;
  25. this._rollFollowTime += Time.unscaledDeltaTime;
  26. if (this._rollFollowTime >= 0.2f)
  27. {
  28. this._rollAtkFollowPos = null;
  29. }
  30. }
  31. }
  32. protected override void PhysicAndEffect(Vector2 speed, Vector2 airSpeed, string normalAtkType, string airAtkType)
  33. {
  34. if (this.action.stateMachine.currentState == "QTEHit")
  35. {
  36. return;
  37. }
  38. base.PhysicAndEffect(speed, airSpeed, normalAtkType, airAtkType);
  39. }
  40. protected override bool Counterattack(int damage, bool groundOnly)
  41. {
  42. return this.currentPhase != 0 && base.Counterattack(damage, true);
  43. }
  44. public override void SetHitSpeed(Vector2 speed)
  45. {
  46. this.eAttr.timeController.SetGravity(1f);
  47. if (this.playerAtkName == "UpRising" || this.playerAtkName == "AtkUpRising" || this.playerAtkName == "AtkRollEnd")
  48. {
  49. this._dahal.MaxFlyHeight = 4f;
  50. }
  51. else
  52. {
  53. this._dahal.MaxFlyHeight = -1f;
  54. }
  55. base.SetHitSpeed(speed);
  56. }
  57. protected override void PlayHurtAudio()
  58. {
  59. base.PlayHurtAudio();
  60. if (base.PlaySpHurtAudio())
  61. {
  62. R.Audio.PlayEffect(401, new Vector3?(base.transform.position));
  63. }
  64. }
  65. public void HitIntoSecondLevel()
  66. {
  67. base.QTEZPositionRecover();
  68. }
  69. protected override void SpAttack()
  70. {
  71. if (this.eAttr.currentActionInterruptPoint < this.eAttr.actionInterruptPoint)
  72. {
  73. return;
  74. }
  75. if (this.playerAtkName == "RollReady" && !this.eAttr.isOnGround)
  76. {
  77. Vector2? rollAtkFollowPos = this._rollAtkFollowPos;
  78. if (rollAtkFollowPos == null)
  79. {
  80. this._rollAtkFollowPos = new Vector2?((base.player.transform.position - base.transform.position) * 0.7f);
  81. }
  82. this._rollFollowTime = 0f;
  83. }
  84. }
  85. protected override void FlashAttackHurt()
  86. {
  87. this.ExecuteDieEffect();
  88. R.Effect.Generate(214, null, default(Vector3), default(Vector3), default(Vector3), true);
  89. SingletonMono<WorldTime>.Instance.TimeSlowByFrameOn60Fps(30, 0.5f);
  90. R.Camera.Controller.CameraShake(0.5f, 0.2f, CameraController.ShakeTypeEnum.Rect, false);
  91. R.Camera.Controller.OpenMotionBlur(0.0833333358f, 1f, base.transform.position);
  92. this.SetHitSpeed(Vector2.zero);
  93. base.GenerateCritHurtNum(base.flashAttackDamage);
  94. DahalAction.StateEnum stateEnum = (!this.eAttr.isOnGround) ? DahalAction.StateEnum.HitToFly3 : DahalAction.StateEnum.Hit1;
  95. this.action.AnimChangeState(stateEnum, 0.5f);
  96. base.FlashAttackHurt();
  97. }
  98. public override void QTEHurt()
  99. {
  100. base.QTEHurt();
  101. R.Player.Action.QTEHPRecover(false);
  102. base.QTEHpMinus();
  103. }
  104. public override void EnemyDie()
  105. {
  106. }
  107. protected override void ExecuteDie()
  108. {
  109. if (this.deadFlag)
  110. {
  111. return;
  112. }
  113. if (this.eAttr.rankType == EnemyAttribute.RankType.BOSS)
  114. {
  115. R.Trophy.AwardTrophy(32);
  116. }
  117. R.Audio.PlayEffect(412, new Vector3?(base.transform.position));
  118. R.Player.Action.QTEHPRecover(this.eAttr.rankType == EnemyAttribute.RankType.BOSS);
  119. R.Audio.PlayEffect(UnityEngine.Random.Range(105, 108), new Vector3?(base.transform.position));
  120. this.deadFlag = true;
  121. this.eAttr.currentHp = 0;
  122. this.eAttr.inWeakState = false;
  123. this.eAttr.isFlyingUp = false;
  124. this.eAttr.checkHitGround = false;
  125. this.eAttr.stiffTime = 0f;
  126. this.eAttr.timeController.SetGravity(1f);
  127. EventManager.PostEvent<EnemyAttribute>("EnemyKilled", this.eAttr);
  128. this.action.WeakEffectDisappear("Null");
  129. R.Effect.Generate(91, null, base.transform.position + new Vector3(0f, 1.2f, LayerManager.ZNum.Fx), Vector3.zero, default(Vector3), true);
  130. R.Effect.Generate(49, base.transform, default(Vector3), default(Vector3), default(Vector3), true);
  131. R.Effect.Generate(14, null, base.transform.position + new Vector3(0f, 1.2f, LayerManager.ZNum.Fx), default(Vector3), default(Vector3), true);
  132. R.Effect.Generate(156, base.transform, this.center.localPosition, default(Vector3), default(Vector3), true);
  133. base.AddCoinAndExp();
  134. R.Effect.Generate(213, null, default(Vector3), default(Vector3), default(Vector3), true);
  135. R.Effect.Generate(214, null, default(Vector3), default(Vector3), default(Vector3), true);
  136. SingletonMono<WorldTime>.Instance.TimeSlowByFrameOn60Fps(45, 0.2f);
  137. R.Camera.Controller.CameraShake(0.9166667f, 0.3f, CameraController.ShakeTypeEnum.Rect, false);
  138. this.action.hurtBox.gameObject.SetActive(false);
  139. this.eAttr.inWeakState = false;
  140. }
  141. private DahalFAnim _dahal;
  142. private Vector2? _rollAtkFollowPos;
  143. private float _rollFollowTime;
  144. }