GiantRobotAction.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. using System;
  2. using System.Collections.Generic;
  3. using ExtensionMethods;
  4. public class GiantRobotAction : EnemyBaseAction
  5. {
  6. static Dictionary<string, int> _003C_003Ef__switch_0024map4;
  7. protected override void Start()
  8. {
  9. this.stateMachine.AddStates(typeof(GiantRobotAction.StateEnum));
  10. this.stateMachine.OnEnter += this.OnMyStateEnter;
  11. this.stateMachine.OnTransfer += this.OnStateTransfer;
  12. base.AnimChangeState(GiantRobotAction.StateEnum.IdleToReady, 1f);
  13. }
  14. private void OnMyStateEnter(object sender, StateMachine.StateEventArgs args)
  15. {
  16. string state = args.state;
  17. if (state != null)
  18. {
  19. if (GiantRobotAction._003C_003Ef__switch_0024map4 == null)
  20. {
  21. GiantRobotAction._003C_003Ef__switch_0024map4 = new Dictionary<string, int>(14)
  22. {
  23. {
  24. "Atk1",
  25. 0
  26. },
  27. {
  28. "Atk2",
  29. 0
  30. },
  31. {
  32. "Atk3",
  33. 0
  34. },
  35. {
  36. "Atk4",
  37. 0
  38. },
  39. {
  40. "Atk5",
  41. 0
  42. },
  43. {
  44. "IdleToReady",
  45. 0
  46. },
  47. {
  48. "LHandHit",
  49. 0
  50. },
  51. {
  52. "ReadyToWeakMod",
  53. 0
  54. },
  55. {
  56. "RHandHit",
  57. 0
  58. },
  59. {
  60. "WeakModToReady",
  61. 0
  62. },
  63. {
  64. "DieQTE",
  65. 0
  66. },
  67. {
  68. "WeakMod",
  69. 1
  70. },
  71. {
  72. "Idle",
  73. 1
  74. },
  75. {
  76. "Ready",
  77. 1
  78. }
  79. };
  80. }
  81. int num;
  82. if (GiantRobotAction._003C_003Ef__switch_0024map4.TryGetValue(state, out num))
  83. {
  84. if (num != 0)
  85. {
  86. if (num == 1)
  87. {
  88. this.spineAnim.Play(args.state, true, false, 1f);
  89. }
  90. }
  91. else
  92. {
  93. this.spineAnim.Play(args.state, false, true, 1f);
  94. }
  95. }
  96. }
  97. }
  98. private void OnStateTransfer(object sender, StateMachine.TransferEventArgs args)
  99. {
  100. if (args.nextState == "ReadyToWeakMod")
  101. {
  102. base.GetComponent<GiantRobotAnimEvent>().DisappearHalo();
  103. }
  104. }
  105. public override void Attack1(int dir)
  106. {
  107. if (this.eAttr.isDead)
  108. {
  109. return;
  110. }
  111. if (!this.IsInNormalState())
  112. {
  113. return;
  114. }
  115. base.AnimChangeState(GiantRobotAction.StateEnum.Atk1, 1f);
  116. }
  117. public override void Attack2(int dir)
  118. {
  119. if (this.eAttr.isDead)
  120. {
  121. return;
  122. }
  123. if (!this.IsInNormalState())
  124. {
  125. return;
  126. }
  127. base.AnimChangeState(GiantRobotAction.StateEnum.Atk2, 1f);
  128. }
  129. public override void Attack3(int dir)
  130. {
  131. if (this.eAttr.isDead)
  132. {
  133. return;
  134. }
  135. if (!this.IsInNormalState())
  136. {
  137. return;
  138. }
  139. base.AnimChangeState(GiantRobotAction.StateEnum.Atk3, 1f);
  140. }
  141. public override void Attack4(int dir)
  142. {
  143. if (this.eAttr.isDead)
  144. {
  145. return;
  146. }
  147. if (!this.IsInNormalState())
  148. {
  149. return;
  150. }
  151. base.AnimChangeState(GiantRobotAction.StateEnum.Atk4, 1f);
  152. }
  153. public override void Attack5(int dir)
  154. {
  155. if (this.eAttr.isDead)
  156. {
  157. return;
  158. }
  159. if (!this.IsInNormalState())
  160. {
  161. return;
  162. }
  163. base.AnimChangeState(GiantRobotAction.StateEnum.Atk5, 1f);
  164. }
  165. public override void AnimMove()
  166. {
  167. }
  168. public override void AnimReady()
  169. {
  170. base.AnimChangeState(GiantRobotAction.StateEnum.Ready, 1f);
  171. }
  172. public override bool IsInNormalState()
  173. {
  174. return this.stateMachine.currentState == "Ready" && base.IsInNormalState();
  175. }
  176. public override bool IsInAttackState()
  177. {
  178. return this.stateMachine.currentState.IsInArray(GiantRobotAction.AttackSta);
  179. }
  180. public override bool IsInDeadState(string state)
  181. {
  182. return state == "DieQTE";
  183. }
  184. public override bool IsInWeakSta()
  185. {
  186. return this.eAttr.inWeakState;
  187. }
  188. protected override bool EnterAtkSta(string lastState, string nextState)
  189. {
  190. return nextState.IsInArray(GiantRobotAction.AttackSta) && !lastState.IsInArray(GiantRobotAction.AttackSta);
  191. }
  192. protected override bool ExitAtkSta(string lastState, string nextState)
  193. {
  194. return !nextState.IsInArray(GiantRobotAction.AttackSta) && lastState.IsInArray(GiantRobotAction.AttackSta);
  195. }
  196. public override void AnimExecute()
  197. {
  198. base.ExitWeakState(true);
  199. base.AnimChangeState(GiantRobotAction.StateEnum.DieQTE, 1f);
  200. }
  201. private static readonly string[] AttackSta = new string[]
  202. {
  203. "Atk1",
  204. "Atk2",
  205. "Atk3",
  206. "Atk4",
  207. "Atk5"
  208. };
  209. public enum StateEnum
  210. {
  211. Idle,
  212. IdleToReady,
  213. Ready,
  214. Atk1,
  215. Atk2,
  216. Atk3,
  217. LHandHit,
  218. RHandHit,
  219. ReadyToWeakMod,
  220. WeakMod,
  221. WeakModToReady,
  222. Atk4,
  223. Atk5,
  224. DieQTE
  225. }
  226. }