/// <summary> 初期化 </summary> private void Awake() { // 状態初期化 var moveState = TestMoveState.CreateInstance(); var attackState = TestAttackState.CreateInstance(); // 遷移設定 var transToAttack = new TestTransitionToAttack(this, attackState); moveState.AddTransition(transToAttack); var transToMove = new TestTransitionToMove(this, moveState); attackState.AddTransition(transToMove); // 状態マシン初期化 _stateMachine = new StateMachine <TestFsm, IState <TestFsm> >(this, moveState); _stateMachine.ChangeState(moveState); }
/// <summary> 開放 </summary> private void OnDestroy() { TestMoveState.ReleaseInstance(); TestAttackState.ReleaseInstance(); }