void ResetVariables() // Every time we come back to this screen we reset the necessary variables { gameTime = 0; //Reset the gametime (Used by treasure to easy reset) gameStartTimer = 5; // Countdown to let the game start noSurvivorsTimer = noSurvivorsTimerMax; gameStartGO.GetComponent <Text>().text = Mathf.CeilToInt(gameStartTimer).ToString(); // Set the game timer immediately upon loading in gameStartGO.SetActive(true); circleBehindTimer.SetActive(true); // Turn on the circle behind the timer preGameText.SetActive(true); // Resets the state of the room roomState = 1; roomBG.GetComponent <Image>().sprite = originalRoomSprite; // Particle Reset Variables originalParticleColor = touchMarkerObjects[0].GetComponentInChildren <ParticleSystem>().startColor; originalParticleSize = touchMarkerObjects[0].GetComponentInChildren <ParticleSystem>().startSize; helperCounterTriggerValue = Random.Range(2, 4); // Reset the random value so we don't know which rounds he'll come out on helperCounter = helperCounterTriggerValue; // Reset how many times we've called the helper noSurvivors.SetActive(false); // Make sure the no survivors warning is off // Setting the survivor timer sTimerMinutes = survivorTimerMax; sTimerSeconds = 0f; survivorTimer.GetComponent <Text>().text = Mathf.FloorToInt(sTimerMinutes).ToString("00") + ":" + Mathf.FloorToInt(sTimerSeconds % 60).ToString("00"); survivorTimer.GetComponent <Text>().CrossFadeAlpha(0, 0f, false); survivorTimerBG.CrossFadeAlpha(0, 0f, false); survivorTimerTitle.CrossFadeAlpha(0, 0f, false); originalBGMusic = AudioManager.Instance.bgMusic.clip; AudioManager.Instance.bgMusic.Stop(); AudioManager.Instance.bgMusic.clip = gameMusic; AudioManager.Instance.bgMusic.Play(); win = false; defaultZ = touchMarkerObjects[0].transform.position.z; // Sets up the default Z position for the touch marker objects foreach (GameObject g in touchMarkerObjects) { g.SetActive(false); } textGroup.FadeAlphaTo(1f, 0.25f); bibaRootAnimator = GameObject.Find("MenuStateMachine").GetComponent <Animator>(); if (bibaRootAnimator.GetBool("ShowTagScan") == true) // If they've selected yes go to the AR moments { mainGameAnimator.SetBool("BibaPlayground", true); } if (bibaRootAnimator.GetBool("CustomPrizes") == true) { mainGameAnimator.SetBool("CustomPrizes", true); } }
public virtual void AnimateEntry() { gameObject.SetActive(true); if (Animator != null && Animator.runtimeAnimatorController != null) { StartCoroutine(PlayAnimation(BibaMenuConstants.BIBA_MENU_ENTRY_ANIMATION_TRIGGER, BibaMenuConstants.BIBA_MENU_ENTRY_ANIMATION_STATE)); } else if (CanvasGroup != null) { CanvasGroup.alpha = 0; CanvasGroup.FadeAlphaTo(1, .5f); } }
public virtual void AnimateExit() { if (Animator != null && Animator.runtimeAnimatorController != null) { StartCoroutine(PlayAnimation(BibaMenuConstants.BIBA_MENU_EXIT_ANIMATION_TRIGGER, BibaMenuConstants.BIBA_MENU_EXIT_ANIMATION_STATE, () => gameObject.SetActive(false))); } else if (CanvasGroup != null) { CanvasGroup.FadeAlphaTo(0, .5f, 0, () => gameObject.SetActive(false)); } else { gameObject.SetActive(false); } }
public void FadeTo(float target) { canvasGroup.FadeAlphaTo(target, 0.5f, 0f); }