private void activateChoicePackage(WheelSegmentTracker pWheelSegmentTracker, Transform pSaveBuildingBlockPackage, Transform pDeleteBuildingBlockPackage, Transform pCreateLevelPackage, Text pWarningText, Image pBlackScreen, bool pIsActivating) { switch (pWheelSegmentTracker.currentWheelSegment) { case 0: pSaveBuildingBlockPackage.gameObject.SetActive(pIsActivating); if (!pIsActivating) { pWarningText.color = new Color(pWarningText.color.r, pWarningText.color.g, pWarningText.color.b, 0); } break; case 1: pDeleteBuildingBlockPackage.gameObject.SetActive(pIsActivating); break; case 2: pCreateLevelPackage.gameObject.SetActive(pIsActivating); break; case 3: if (pIsActivating) { mWheel.parent.gameObject.SetActive(true); IEnumerator fade = fadeToMainMenu(pBlackScreen); StartCoroutine(fade); } break; } }
// Start the fade-to-black animation, and then change to a new scene based on the current wheel segment. IEnumerator fadeToNewScene(Image pBlackScreen, string[] pSceneNames, WheelSegmentTracker pWheelSegmentTracker) { const string ANIMATION_NAME = "Fade"; const bool IS_ANIMATION_TRIGGERED = true; const float MAX_ALPHA = 1; Animator lFadeToBlackAnimator = pBlackScreen.GetComponent <Animator>(); lFadeToBlackAnimator.SetBool(ANIMATION_NAME, IS_ANIMATION_TRIGGERED); // Wait until the alpha on the black screen is 1, then change scene. yield return(new WaitUntil(() => pBlackScreen.color.a == MAX_ALPHA)); loadNewScene(pSceneNames, pWheelSegmentTracker); }
// Use this for initialization void Start() { mWheelSegmentTracker = mWheel.GetComponent <WheelSegmentTracker>(); mCameraMover = Camera.main.GetComponent <MoveCamera>(); mTemplate = GameObject.Find("Template").transform; }
// Load a new scene based on the current wheel segment. private void loadNewScene(string[] pSceneNames, WheelSegmentTracker pWheelSegmentTracker) { string lSceneName = pSceneNames [pWheelSegmentTracker.currentWheelSegment]; SceneManager.LoadScene(lSceneName); }
// Use this for initialization void Start() { mWheelSegmentTracker = mWheel.GetComponent <WheelSegmentTracker>(); Time.timeScale = 0; }