123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- using System;
- public class PlayerAbilities : BaseBehaviour
- {
- private void Awake()
- {
- this.stateMachine = R.Player.StateMachine;
- this.stateMachine.OnEnter += this.OnStateMachineStateEnter;
- this.stateMachine.OnExit += this.OnStateMachineStateExit;
- this.stateMachine.OnTransfer += this.OnStateMachineStateTransfer;
- this.states = new CharacterState[13];
- this.states[0] = this.move;
- this.states[1] = this.attack;
- this.states[2] = this.jump;
- this.states[3] = this.charge;
- this.states[4] = this.execute;
- this.states[5] = this.hitGround;
- this.states[6] = this.upRising;
- this.states[7] = this.jumpDown;
- this.states[8] = this.flash;
- this.states[9] = this.skill;
- this.states[10] = this.flashAttack;
- this.states[11] = this.hurt;
- this.states[12] = this.chase;
- for (int i = 0; i < this.states.Length; i++)
- {
- this.states[i].Init();
- }
- }
- private void Start()
- {
- for (int i = 0; i < this.states.Length; i++)
- {
- this.states[i].Start();
- }
- }
- private void Update()
- {
- for (int i = 0; i < this.states.Length; i++)
- {
- this.states[i].Update();
- }
- }
- private void OnEnable()
- {
- for (int i = 0; i < this.states.Length; i++)
- {
- this.states[i].OnEnable();
- }
- }
- private void OnDisable()
- {
- for (int i = 0; i < this.states.Length; i++)
- {
- this.states[i].OnDisable();
- }
- }
- private void OnDestroy()
- {
- for (int i = 0; i < this.states.Length; i++)
- {
- this.states[i].OnDestroy();
- }
- }
- private void FixedUpdate()
- {
- for (int i = 0; i < this.states.Length; i++)
- {
- this.states[i].FixedUpdate();
- }
- }
- public virtual void OnStateMachineStateTransfer(object sender, StateMachine.TransferEventArgs args)
- {
- for (int i = 0; i < this.states.Length; i++)
- {
- this.states[i].OnStateMachineStateTransfer(sender, args);
- }
- }
- public virtual void OnStateMachineStateEnter(object sender, StateMachine.StateEventArgs args)
- {
- for (int i = 0; i < this.states.Length; i++)
- {
- this.states[i].OnStateMachineStateEnter(sender, args);
- }
- }
- public virtual void OnStateMachineStateExit(object sender, StateMachine.StateEventArgs args)
- {
- for (int i = 0; i < this.states.Length; i++)
- {
- this.states[i].OnStateMachineStateExit(sender, args);
- }
- }
- public PlayerMoveAbility move = new PlayerMoveAbility();
- public PlayerAttackAbility attack = new PlayerAttackAbility();
- public PlayerJumpAbility jump = new PlayerJumpAbility();
- public PlayerChargingAbility charge = new PlayerChargingAbility();
- public PlayerExecuteAbility execute = new PlayerExecuteAbility();
- public PlayerHitGroundAbility hitGround = new PlayerHitGroundAbility();
- public PlayerUpRisingAbility upRising = new PlayerUpRisingAbility();
- public PlayerJumpDownAbility jumpDown = new PlayerJumpDownAbility();
- public PlayerFlashAbility flash = new PlayerFlashAbility();
- public PlayerSkillAbility skill = new PlayerSkillAbility();
- public PlayerFlashAttackAbility flashAttack = new PlayerFlashAttackAbility();
- public PlayerHurtAbility hurt = new PlayerHurtAbility();
- public PlayerChaseAbility chase = new PlayerChaseAbility();
- protected StateMachine stateMachine;
- private CharacterState[] states;
- }
|