コード例 #1
0
    /// <summary>
    /// Manages speed bars
    /// </summary>
    public virtual void UpdateTime()
    {
        pc.ResetPosition();

        if (status == STATUS.DEAD)
        {
            ResetTimer();
            return; //Do nothing if dead
        }

        CheckLevel();
        CheckLowHealth();

        if (moveTimer < 100)
        {
            float addTime = Time.deltaTime + (Spd / (25f) * BattleManager.gameSpeed); //Calculate speed gague incremental increase

            //Tile Effect
            if (pc.GetTileEffect1() == Tile.EFFECT.STUCK)
            {
                addTime /= 2;                                           //Slow if standing on an impeding tile
            }
            if (pc.GetTileEffect2() == Tile.EFFECT.STUCK)
            {
                addTime /= 2;
            }

            //Status Effect
            if (ec != null)
            {
                if (ec.CheckEffect("SWIFT"))
                {
                    addTime *= 1.7f;                          //Increase by 70%
                }
                else if (ec.CheckEffect("SLOW"))
                {
                    addTime *= 0.5f;                              //Decrease by half
                }
            }

            moveTimer += addTime;

            if (moveTimer > 100)
            {
                moveTimer = 100;
            }
        }
        else if (moveTimer == 100)
        {
            Ready = true;

            //Roll status effects
            ec.StatusEffectsTurn();
            ec.TileEffectsTurn(pc.tile.effect1);
            ec.TileEffectsTurn(pc.tile.effect2);

            moveTimer = 100.1f; //Prevent this block from being executed again before turn is used
        }
    }