コード例 #1
0
ファイル: Player.cs プロジェクト: alex-games/games2015
 /*
  * Handles stopping the boost functionality when the time is expired.
  */
 void CheckBoostingFinish()
 {
     if (isBoosting)
     {
         if (boostTimer.IsTimeUp() && !isBoostBraking)
         {
             StartBoostBraking();
         }
         else if (boostTimer.IsTimeUp() && boostBrakeTimer.IsTimeUp())
         {
             StopBoosting();
         }
     }
 }
コード例 #2
0
ファイル: Player.cs プロジェクト: alex-games/games2015
    void Update()
    {
        // Waiting to be told by GameManager to start running
        if (isWaitingToStart)
        {
            return;
        }

        // Reduce invulnerability frames until none remain.
        invulnerabilityTime = (int)Mathf.Max(invulnerabilityTime - Time.deltaTime, 0.0f);

        bool isAlive = !IsDead;

        if (isAlive)
        {
            CheckBoostingFinish();

            // Update boosting speed
            if (isBoosting)
            {
                SetRunspeed(15.0f, treadmill.scrollspeed);
            }
            else
            {
                // When not boosting, match with treadmill.
                if (isUsingSlowdown)
                {
                    SetRunspeed(slowDownMovespeed, treadmill.scrollspeed);
                }
                else
                {
                    MatchSpeedToTreadmill();
                }
            }

            TryMove();
            TryActivateAbilities();

            CheckShieldTimeout();
            CheckSlowDownTimeout();

            UpdateYZPosition();

            // If no colors are active, go neutral
            if (!bluePower.IsPowerActive() && !redPower.IsPowerActive() && !greenPower.IsPowerActive())
            {
                ChangeColors(ColorWheel.neutral);
            }
            RenderCurrentColor();
            PullNearbyPickups();
        }
        else if (isReviving)
        {
            // Check if we need to force restore from ragdoll due to timeout
            if (reviveTimeout.IsTimeUp())
            {
                OnBodyRevived();
            }
        }
    }
コード例 #3
0
 void Update()
 {
     // Stop our timers when power and abilities are done being used
     if (IsPowerActive())
     {
         curValue = Mathf.Max(curValue - ((maxValue / powerDuration) * Time.deltaTime), 0);
         if (abilityCooldownTimer.IsTimeUp())
         {
             abilityCooldownTimer.StopTimer();
         }
         if (curValue <= 0)
         {
             isPowerActive = false;
             abilityCooldownTimer.StopTimer();
         }
     }
 }