123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245 |
- using System;
- using System.Collections.Generic;
- using ExtensionMethods;
- public class GiantRobotAction : EnemyBaseAction
- {
- static Dictionary<string, int> _003C_003Ef__switch_0024map4;
- protected override void Start()
- {
- this.stateMachine.AddStates(typeof(GiantRobotAction.StateEnum));
- this.stateMachine.OnEnter += this.OnMyStateEnter;
- this.stateMachine.OnTransfer += this.OnStateTransfer;
- base.AnimChangeState(GiantRobotAction.StateEnum.IdleToReady, 1f);
- }
- private void OnMyStateEnter(object sender, StateMachine.StateEventArgs args)
- {
- string state = args.state;
- if (state != null)
- {
- if (GiantRobotAction._003C_003Ef__switch_0024map4 == null)
- {
- GiantRobotAction._003C_003Ef__switch_0024map4 = new Dictionary<string, int>(14)
- {
- {
- "Atk1",
- 0
- },
- {
- "Atk2",
- 0
- },
- {
- "Atk3",
- 0
- },
- {
- "Atk4",
- 0
- },
- {
- "Atk5",
- 0
- },
- {
- "IdleToReady",
- 0
- },
- {
- "LHandHit",
- 0
- },
- {
- "ReadyToWeakMod",
- 0
- },
- {
- "RHandHit",
- 0
- },
- {
- "WeakModToReady",
- 0
- },
- {
- "DieQTE",
- 0
- },
- {
- "WeakMod",
- 1
- },
- {
- "Idle",
- 1
- },
- {
- "Ready",
- 1
- }
- };
- }
- int num;
- if (GiantRobotAction._003C_003Ef__switch_0024map4.TryGetValue(state, out num))
- {
- if (num != 0)
- {
- if (num == 1)
- {
- this.spineAnim.Play(args.state, true, false, 1f);
- }
- }
- else
- {
- this.spineAnim.Play(args.state, false, true, 1f);
- }
- }
- }
- }
- private void OnStateTransfer(object sender, StateMachine.TransferEventArgs args)
- {
- if (args.nextState == "ReadyToWeakMod")
- {
- base.GetComponent<GiantRobotAnimEvent>().DisappearHalo();
- }
- }
- public override void Attack1(int dir)
- {
- if (this.eAttr.isDead)
- {
- return;
- }
- if (!this.IsInNormalState())
- {
- return;
- }
- base.AnimChangeState(GiantRobotAction.StateEnum.Atk1, 1f);
- }
- public override void Attack2(int dir)
- {
- if (this.eAttr.isDead)
- {
- return;
- }
- if (!this.IsInNormalState())
- {
- return;
- }
- base.AnimChangeState(GiantRobotAction.StateEnum.Atk2, 1f);
- }
- public override void Attack3(int dir)
- {
- if (this.eAttr.isDead)
- {
- return;
- }
- if (!this.IsInNormalState())
- {
- return;
- }
- base.AnimChangeState(GiantRobotAction.StateEnum.Atk3, 1f);
- }
- public override void Attack4(int dir)
- {
- if (this.eAttr.isDead)
- {
- return;
- }
- if (!this.IsInNormalState())
- {
- return;
- }
- base.AnimChangeState(GiantRobotAction.StateEnum.Atk4, 1f);
- }
- public override void Attack5(int dir)
- {
- if (this.eAttr.isDead)
- {
- return;
- }
- if (!this.IsInNormalState())
- {
- return;
- }
- base.AnimChangeState(GiantRobotAction.StateEnum.Atk5, 1f);
- }
- public override void AnimMove()
- {
- }
- public override void AnimReady()
- {
- base.AnimChangeState(GiantRobotAction.StateEnum.Ready, 1f);
- }
- public override bool IsInNormalState()
- {
- return this.stateMachine.currentState == "Ready" && base.IsInNormalState();
- }
- public override bool IsInAttackState()
- {
- return this.stateMachine.currentState.IsInArray(GiantRobotAction.AttackSta);
- }
- public override bool IsInDeadState(string state)
- {
- return state == "DieQTE";
- }
- public override bool IsInWeakSta()
- {
- return this.eAttr.inWeakState;
- }
- protected override bool EnterAtkSta(string lastState, string nextState)
- {
- return nextState.IsInArray(GiantRobotAction.AttackSta) && !lastState.IsInArray(GiantRobotAction.AttackSta);
- }
- protected override bool ExitAtkSta(string lastState, string nextState)
- {
- return !nextState.IsInArray(GiantRobotAction.AttackSta) && lastState.IsInArray(GiantRobotAction.AttackSta);
- }
- public override void AnimExecute()
- {
- base.ExitWeakState(true);
- base.AnimChangeState(GiantRobotAction.StateEnum.DieQTE, 1f);
- }
- private static readonly string[] AttackSta = new string[]
- {
- "Atk1",
- "Atk2",
- "Atk3",
- "Atk4",
- "Atk5"
- };
- public enum StateEnum
- {
- Idle,
- IdleToReady,
- Ready,
- Atk1,
- Atk2,
- Atk3,
- LHandHit,
- RHandHit,
- ReadyToWeakMod,
- WeakMod,
- WeakModToReady,
- Atk4,
- Atk5,
- DieQTE
- }
- }
|