コード例 #1
0
    void IncreaseStun()
    {
        if (BC.MonsterIsAnimating)
        {
            return;
        }

        //this will prevent speed increasing when pause menu is open, end of game, or user's turn
        if (BC.PauseGame || userController.IsUsersTurn || (BC.BattleState == BattleController.State.ENDCONDITION) || (BC.BattleState == BattleController.State.BEGIN))
        {
            return;
        }

        if (stunCounter >= BC.Threshold)
        {
            //remove stun component
            Stun stunComponent = GetComponent <Stun>();
            if (stunComponent != null)
            {
                stunComponent.Check();
                //reset speed and continue this process until the stun component changes this monsters status back to its originalState
                stunCounter = 0;
            }
            else
            {
                Debug.Log("IncreaseStun() was likely triggered but no stun component found for " + this.gameObject);
            }
        }
        else
        {
            stunCounter += baseSpeed * Time.deltaTime;
        }
    }