public void ResetCamera()
        {
            BackgroundCamera.transform.position = CameraStart;
            FadeOut.gameObject.SetActive(true);
            FadeIn.gameObject.SetActive(false);

            FadeOut.Play();
            FadeOut.AddOnFinished(() => CameraAnim.Play());
        }
        public void Pause()
        {
            if (IsPaused)
            {
                return;
            }

            IsPaused = true;
            DisableAllFlashes();
            PauseFlash.gameObject.SetActive(true);
            PauseFlash.Play();
            Time.timeScale = 0;
            ResetColors();
            PauseButton.color = PressedColor;
        }
        public void PlayFast()
        {
            if (!_canUnpause)
            {
                return;
            }
            if (_lastSpeed == Speed.Fast && !IsPaused)
            {
                return;
            }

            IsPaused = false;
            DisableAllFlashes();
            PlayFastFlash.gameObject.SetActive(true);
            PlayFastFlash.Play();
            _lastSpeed     = Speed.Fast;
            Time.timeScale = 2 * BaseTimeScale;
            ResetColors();
            PlayFastButton.color = PressedColor;
        }
 void OnEnable()
 {
     Tween.Play();
 }
Beispiel #5
0
    // Update is called once per frame
    protected void Update()
    {
        switch (plantState)
        {
        case 0:
            //Do grow sequence for growAnimationTime
            if (!growTween.isPlaying)
            {
                growTween.Play();
            }
            if (growAnimationTime > 0)
            {
                growAnimationTime -= Time.deltaTime;
            }
            else
            {
                EnableComponents();
                plantState = 1;
            }

            break;

        case 1:
            //After lifetime, destory plant
            handlePlantFunction();
            if (doesDecay)
            {
                lifetime -= Time.deltaTime;
            }

            bool isDestroyedByPlayer = isPlantedByPlayer && Input.GetKeyDown(KeyCode.R) && inventoryManager.getSelection() == index;


            if (lifetime < 0 || isDestroyedByPlayer)
            {
                plantState = 2;
                //DisableComponents();
            }

            break;

        case 2:
            //Do die sequence for dieAnimationTime
            if (!dieTween.isPlaying)
            {
                dieTween.Play();
                FindObjectOfType <AudioManager>().Play("LowPop");
            }

            if (dieAnimationTime > 0)
            {
                dieAnimationTime -= Time.deltaTime;
            }
            else
            {
                Destroy(gameObject);
            }

            break;
        }
    }
Beispiel #6
0
 public void DoSuccessShake()
 {
     _successTween.Play();
 }
Beispiel #7
0
 public void DoErrorShake()
 {
     _errorTween.Play();
 }
 public void PlayCredits()
 {
     _creditsPlaying = true;
     Credits.transform.parent.gameObject.SetActive(true);
     Credits.Play();
 }
 private void StartLogoAnim()
 {
     LogoAnim.Play();
     _logoAnimPlayed = true;
     AnyKeyTextObject.SetActive(false);
 }