Esempio n. 1
0
 private void StartChargeShot()
 {
     shotChargeIndicator.Show();
     chargeShotCoroutine = StartCoroutine(TransitionUtility.LerpFloat((value) =>
     {
         this.shotSpeed = value;
         shotChargeIndicator.FillAmount = value;
     },
                                                                      startValue: baseShotSpeed, endValue: maxShotSpeed,
                                                                      duration: maxChargeShotTime,
                                                                      useGameTime: true, animationCurve: chargeShotCurve)
                                          );
 }
Esempio n. 2
0
    public void GameOverFunction()
    {
        endText.color = GameManager.instance.winner.teamColor.color;
        endText.text  = endTextContent;

        // Start "Game!" text lerp
        StartCoroutine(
            TransitionUtility.LerpFloat(
                (float value) =>
        {
            float scaledProgress = textSize.Evaluate(value);
            endText.fontSize     = (int)Mathf.Lerp(
                minTextSize, maxTextSize, scaledProgress);
        },
                0.0f, 1.0f,
                textLerpDuration));
    }
    // Warning: this function may be called any time the player presses the A
    // button (or whatever xbox controller button is bound to shoot). This
    // includes dash
    private void OnShootPressed()
    {
        bool shootTimerRunning   = shootTimer != null;
        bool alreadyChargingShot = chargeShot != null;

        if (stateManager.IsInState(State.Posession) &&
            shootTimerRunning && !alreadyChargingShot)
        {
            shotChargeIndicator.Show();
            chargeShot = StartCoroutine(TransitionUtility.LerpFloat((value) =>
            {
                this.shotSpeed = value;
                shotChargeIndicator.FillAmount = value;
            },
                                                                    startValue: baseShotSpeed, endValue: maxShotSpeed,
                                                                    duration: maxChargeShotTime,
                                                                    useGameTime: true, animationCurve: chargeShotCurve));
        }
    }
Esempio n. 4
0
 private IEnumerator ResetCountdown()
 {
     restartText.text = "Resetting in: ";
     for (int i = SecondsBeforeReset; i > 0; --i)
     {
         restartCount.text = i.ToString();
         StartCoroutine(
             TransitionUtility.LerpFloat(
                 (float value) =>
         {
             float scaledProgress  = restartCountSize.Evaluate(value);
             restartCount.fontSize = (int)Mathf.Lerp(
                 minRestartCountSize, maxRestartCountSize, scaledProgress);
         },
                 0.0f, 1.0f,
                 restartCountDuration));
         yield return(new WaitForSecondsRealtime(restartCountDuration + epsilon));
     }
     SceneStateManager.instance.Load(Scene.Court);
 }