AirRobotHurt.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using System;
  2. using System.Collections;
  3. using UnityEngine;
  4. public class AirRobotHurt : 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 PlayHurtAudio()
  13. {
  14. base.PlayHurtAudio();
  15. if (base.PlaySpHurtAudio())
  16. {
  17. R.Audio.PlayEffect(UnityEngine.Random.Range(90, 92), new Vector3?(base.transform.position));
  18. }
  19. }
  20. protected override void HitIntoWeakState(Vector2 speed, Vector2 airSpeed, string normalAtkType, string airAtkType)
  21. {
  22. Vector2 vector = new Vector2((float)(-3 * this.eAttr.faceDir), 0f);
  23. base.HitIntoWeakState(vector, vector, "NoStiff", "NoStiff");
  24. }
  25. protected override void ExecuteFollow()
  26. {
  27. }
  28. protected override void ExecuteDie()
  29. {
  30. }
  31. public override void EnemyDie()
  32. {
  33. if (this.deadFlag)
  34. {
  35. return;
  36. }
  37. base.EnemyDie();
  38. this.action.AnimChangeState(AirRobotAction.StateEnum.HitFall, 1f);
  39. base.Invoke("DieFall", 0.36f);
  40. base.StartCoroutine(this.DeathIEnumerator());
  41. base.DieTimeControl();
  42. base.NormalKill();
  43. }
  44. protected override IEnumerator DeathIEnumerator()
  45. {
  46. bool deadFall = true;
  47. while (this.eAttr.isDead)
  48. {
  49. if (deadFall && this.action.stateMachine.currentState == "Fall" && this.eAttr.isOnGround)
  50. {
  51. deadFall = false;
  52. this.action.AnimChangeState(AirRobotAction.StateEnum.HitGround, 1f);
  53. base.Invoke("RealDie", 0.5f);
  54. }
  55. yield return null;
  56. }
  57. yield break;
  58. }
  59. private void DieFall()
  60. {
  61. this.action.AnimChangeState(AirRobotAction.StateEnum.Hit2, 1f);
  62. }
  63. private void RealDie()
  64. {
  65. base.GetComponent<AirRobotAnimListener>().GetUp();
  66. }
  67. }