void Start() { S = this; _currentLevelNum = 0; state = eGameManagerState.postLevel; LevelAdvancePanel.FadeInToEndLevel(LoadLevel); }
// Use this for initialization void Awake() { S = this; imgBG = GetComponent <Image>(); // Find the LevelText child Transform levelT = transform.Find("LevelText"); if (levelT == null) { Debug.LogWarning("LevelAdvancePanel:Start() - LevelAdvancePanel lacks a child named LevelText."); return; } levelRT = levelT.GetComponent <RectTransform>(); levelText = levelT.GetComponent <Text>(); if (levelText == null) { Debug.LogWarning("LevelAdvancePanel:Start() - LevelAdvancePanel child LevelText needs a Text component."); return; } // Find the InfoText child Transform infoT = transform.Find("InfoText"); if (infoT == null) { Debug.LogWarning("LevelAdvancePanel:Start() - LevelAdvancePanel lacks a child named InfoText."); return; } //infoRT = infoT.GetComponent<RectTransform>();; // infoRT was unused, so I've commented it out. – JGB infoText = infoT.GetComponent <Text>(); if (infoText == null) { Debug.LogWarning("LevelAdvancePanel:Start() - LevelAdvancePanel child InfoText needs a Text component."); return; } // Find the InfoTextFrame Transform infoFrame = transform.Find("InfoTextFrame"); if (infoFrame == null) { Debug.LogWarning("LevelAdvancePanel:Start() - LevelAdvancePanel lacks a child named InfoTextFrame."); return; } imgFrame = infoFrame.GetComponent <Image>(); if (imgFrame == null) { Debug.LogWarning("LevelAdvancePanel:Start() - LevelAdvancePanel child InfoTextFrame needs an Image component."); return; } SetState(eLevelAdvanceState.idle); }
void EndLevel() { state = eGameManagerState.postLevel; _currentLevelNum++; if (LEVEL_END_EVENT != null) { LEVEL_END_EVENT(); } LevelAdvancePanel.FadeInToEndLevel(LoadLevel); }
private void Awake() { S = this; imgBG = GetComponent <Image>(); // Find the levelText child. Transform levelT = transform.Find("LevelText"); if (levelT == null) { Debug.LogWarning("LevelAdvancePanel:Awake() - LevelAdvancePanel lacks a child named LevelText."); return; } levelRT = levelT.GetComponent <RectTransform>(); levelText = levelT.GetComponent <Text>(); if (levelText == null) { Debug.LogWarning("LevelAdvancePanel:Awake() - LevelAdvancePanel child LevelText lacks a text component."); return; } // Find the infoText child. Transform infoT = transform.Find("InfoText"); if (infoT == null) { Debug.LogWarning("LevelAdvancePanel:Awake() - LevelAdvancePanel lack a child named InfoText."); return; } infoText = infoT.GetComponent <Text>(); if (infoText == null) { Debug.LogWarning("LevelAdvancePanel:Awake() - LevelAdvancePanel child InfoText lacks a Text component."); return; } // Find the InfoTextFrame child. Transform infoFrame = transform.Find("InfoTextFrame"); if (infoFrame == null) { Debug.LogWarning("LevelAdvancePanel:Awake() - LevelAdvancePanel lacks a child named InfoTextFrame."); return; } imgFrame = infoFrame.GetComponent <Image>(); if (imgFrame == null) { Debug.LogWarning("LevelAdvancePanel:Awake() - LevelAdvancePanel child InfoTextFrame lacks an Image component."); return; } SetState(eLevelAdvanceState.idle); }
void EndLevel() { #if DEBUG_AsteraX_LogMethods Debug.Log("AsteraX:EndLevel()"); #endif if (GAME_STATE != eGameState.none) { PauseGame(true); GAME_LEVEL++; GAME_STATE = eGameState.postLevel; LevelAdvancePanel.AdvanceLevel(LevelAdvanceDisplayCallback, LevelAdvanceIdleCallback); } }
private IEnumerator LoadSceneAndSetActive(string sceneName) { if (SceneManager.sceneCount > 1) { yield return(SceneManager.UnloadSceneAsync(SceneManager.GetActiveScene().buildIndex)); } InteractingPlayer.SetPosition(new Vector3(10000, 10000, 10000), Quaternion.identity); yield return(SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive)); Scene newlyLoadedScene = SceneManager.GetSceneAt(SceneManager.sceneCount - 1); SceneManager.SetActiveScene(newlyLoadedScene); state = eGameManagerState.preLevel; LevelAdvancePanel.FadeOutToBeginLevel(StartLevel); }
// Use this for initialization void Awake() { S = this; img = GetComponent <Image>(); // Find the LevelText child Transform levelT = transform.Find("LevelText"); if (levelT == null) { Debug.LogWarning("LevelAdvancePanel:Start() - LevelAdvancePanel lacks a child named LevelText."); return; } levelRT = levelT.GetComponent <RectTransform>(); levelText = levelT.GetComponent <Text>(); if (levelText == null) { Debug.LogWarning("LevelAdvancePanel:Start() - LevelAdvancePanel child LevelText needs a Text component."); return; } // Find the InfoText child Transform infoT = transform.Find("InfoText"); if (infoT == null) { Debug.LogWarning("LevelAdvancePanel:Start() - LevelAdvancePanel lacks a child named InfoText."); return; } infoRT = infoT.GetComponent <RectTransform>(); infoText = infoT.GetComponent <Text>(); if (infoText == null) { Debug.LogWarning("LevelAdvancePanel:Start() - LevelAdvancePanel child InfoText needs a Text component."); return; } SetState(eLevelAdvanceState.idle); }