public void ShowEndGamePanel(int lives, bool liveLost, int pointsForLevel) { pauseGameButton.gameObject.SetActive(false); if (endGamePanel != null) { Destroy(endGamePanel); } Transform parent = GameObject.FindObjectOfType <Canvas>().transform; endGamePanel = Instantiate(endGamePanelPrefab, parent); SceneSettingsScript sceneSettings = sceneMasterScript.GetSceneSettingsScript(); endGamePanel.GetComponent <EndGamePanelScript>().SetAll(sceneSettings.title, sceneSettings.content, this, sceneMasterScript.GetConditionsState(), lives, liveLost, pointsForLevel, playerPoints - pointsForLevel); }
public void LoadNextScene() { pauseGameButton.gameObject.SetActive(true); sceneMasterScript.LoadNextRandomScene(); SetTimeToEnd(sceneMasterScript.sceneTime); AddTimeBar(); SceneSettingsScript sceneSettings = sceneMasterScript.GetSceneSettingsScript(); AddLevelTip(sceneSettings.levelTip); if (endGamePanel != null) { Destroy(endGamePanel); } }
private int CalculateLevelPoints() { SceneSettingsScript sceeneSettings = sceneMasterScript.GetSceneSettingsScript(); int points = 0;; if (sceeneSettings.pointsCountingType.Equals(PointsCountingType.Time)) { float pointsForSecond = 50; points = (int)Mathf.Round(timeOnLevelEnd * pointsForSecond / 5.0f) * 5; } else if (sceeneSettings.pointsCountingType.Equals(PointsCountingType.Finish)) { points = sceeneSettings.pointsForLevel; } return(points); }
public void LoadScene(GameObject scenePrefab) { SetConditionsState(false); if (sceneLoaded != null) { UnloadScene(); } loadedScenePrefab = scenePrefab; sceneLoaded = Instantiate(scenePrefab); sceneSettingsLoaded = GameObject.FindObjectOfType <SceneSettingsScript>(); if (sceneSettingsLoaded) { isGameScene = sceneSettingsLoaded.isGameScene; sceneTime = sceneSettingsLoaded.sceneTime; } else { isGameScene = false; } }