示例#1
0
        /// <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);
        }
示例#2
0
 /// <summary> 開放 </summary>
 private void OnDestroy()
 {
     TestMoveState.ReleaseInstance();
     TestAttackState.ReleaseInstance();
 }