コード例 #1
0
    /// <summary>
    /// Changes the player's attack state to target input player attack state type. IMPORTANT: Also calls the previous state's ExitState before switching.
    /// </summary>
    /// <typeparam name="TargetStateType">The intended attack state.</typeparam>
    public virtual void ChangeAttackState <TargetStateType>() where TargetStateType : PlayerAState
    {
        if (CurrentAttackState)
        {
            CurrentAttackState.ExitState();
            Destroy(CurrentAttackState);
        }

        _currentAttackState = gameObject.AddComponent <TargetStateType>();
    }
コード例 #2
0
    protected void Update()
    {
        CurrentMoveState.PerformState();
        CurrentMoveState.TransitionState();

        CurrentAttackState.PerformState();
        CurrentAttackState.TransitionState();

        CurrentConditionState.PerformState();
        CurrentConditionState.TransitionState();
    }
コード例 #3
0
 public void Update()
 {
     UpdatePosition();
     CurrentAttackState.Update(this);
 }