private void Awake() { if (_instance != null && _instance != this) { Destroy(this.gameObject); Debug.Log(TAG + "It is destroyed"); return; } _instance = this; starIsAlive = false; LevelShots = new int[10]; bestLevelShots = new int[10]; totalLevels = 9; blockedByUI = false; muted = false; for (int i = 0; i < 10; i++) { bestLevelShots[i] = 1000; } levelStarCnt = new int[10]; maxUnlockedIdx = 1; Debug.Log(TAG + "This is initialized"); // Keep the singleton DontDestroyOnLoad(this.gameObject); }
private void Start() { score_manager = GameObject.Find("PersistentScoreManager").GetComponent <PersistentManagerScript>(); // score_manager.score = 0; // score_manager.remaining_time = 15*10; ui_no_time_crystal_bonus = 0; ui_points_no_hit_bonus = 0; can_continue = false; continue_button.SetActive(false); //no_time_crystal_used_bonus.gameObject.SetActive(false); //no_hit_bonus.gameObject.SetActive(false); //mega_bonus.gameObject.SetActive(false); if (score_manager.no_used_life_bonus && score_manager.no_hit_bonus) { ui_mega_bonus = points_mega_bonus; mega_bonus.gameObject.SetActive(true); } if (score_manager.no_used_life_bonus) { ui_no_time_crystal_bonus = points_no_time_crystal_used_bonus; } if (score_manager.no_hit_bonus) { ui_points_no_hit_bonus = points_no_hit_bonus; } UpdateDisplay(); StartCoroutine(InitalPause()); }
private void CreatePersistentSingleton() { if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
private void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
// Use this for initialization void Awake() { if (Instance == null) { Instance = this; //Debug.Log("*** PM Created **** "+Time.realtimeSinceStartup); DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
// Start is called before the first frame update void Start() { score = GameObject.Find("PersistentScoreManager").GetComponent <PersistentManagerScript>(); Text txt = GetComponent <Text>(); if (score != null && txt != null) { txt.text = score.score.ToString(); } }
public void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); InitGame(); } else { Destroy(gameObject); } }
private void Awake() { if (isPersistant) { if (Globals == null) { Globals = this; } else { Destroy(gameObject); } } }
private void Start() { GameObject go = GameObject.Find("PersistentScoreManager"); score_manager = go.GetComponent <PersistentManagerScript>(); current_level = score_manager.current_level; if (no_in_transition == true) { animation.SetTrigger("Hide"); } else { animation.SetTrigger("FadeOut"); } }
//This runs when the presistentManagerScript is first run, before "Start()" of all items, so that it will be non-nul //if called early in a scene private void Awake() { //If there isn't an instance yet, create one if (Instance == null) { Instance = this; //and ensure it won't destroy when you load another scene DontDestroyOnLoad(gameObject); } else { //otherwise, destroy the gameObject trying to create another persistent manager instance (one exists) Destroy(gameObject); } }
private void Awake() { if (Instance == null) { PlayerPrefs.SetInt("NoAds", 1); Instance = this; DontDestroyOnLoad(gameObject); if (PlayerPrefs.GetInt("FinishedLevel") != 0) { FinishedLevel = PlayerPrefs.GetInt("FinishedLevel"); } CurrentSceneNumber = FinishedLevel + 1; } else { Destroy(gameObject); } }
//This runs when the presistentManagerScript is first run, before "Start()" of all items, so that it will be non-nul //if called early in a scene private void Awake() { //dampen sound globally AudioListener.volume = 0.2f; //If there isn't an instance yet, create one if (Instance == null) { Instance = this; //and ensure it won't destroy when you load another scene DontDestroyOnLoad(gameObject); } else { //otherwise, destroy the gameObject trying to create another persistent manager instance (one exists) Destroy(gameObject); } citysounds.Play(); }
private void Start() { CleanUp(); day_night_flag = false; score = GameObject.Find("PersistentScoreManager").GetComponent <PersistentManagerScript>(); score.current_level = current_level_no; transition.BeginingFadein(); // SetWhiteToTransparent(); spawn_points = GetComponent <SpawnPointList>(); current_level = 0; StartCoroutine(Wait_And_Spawn_New_Player(0)); //Spawn_New_Player(0); IncPickupScore(0); Spawn_Spawn_Pickup_Item(0); SetupIncursionMetere(); ResetItemCollected(); UI_DrawLives(); incursion_fix = false; time_frozen = false; audioSource = GetComponent <AudioSource>(); }
private void Awake() { if (Instance == null) //if instance contains no data (when game starts) -> dont destroy { Instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); //if instance already contains data -> destroy duplicant (dont create again) } if (Instance != null && GameReset == true) { Destroy(gameObject); GameReset = false; } else { GameReset = false; } }
private void Awake() { musicsource = gameObject.GetComponent <AudioSource>(); if (Instance == null) { if (PlayerPrefs.GetInt("Mute") == 1) { musicsource.mute = true; } Instance = this; DontDestroyOnLoad(gameObject); if (PlayerPrefs.GetInt("FinishedLevel") != 0) { FinishedLevel = PlayerPrefs.GetInt("FinishedLevel"); } CurrentSceneNumber = FinishedLevel + 1; } else { Destroy(gameObject); } }
private void Awake() { win = false; if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } //assign random murderer number valueMurderer = Random.Range(1, 5); switch (valueMurderer) { case 1: murdererName = "Cindy"; hairColorMurderer = "brown"; hairColorDeception = "blonde"; break; case 2: murdererName = "Olivia"; hairColorMurderer = "blonde"; hairColorDeception = "brown"; break; case 3: murdererName = "Veronica"; hairColorMurderer = "black"; hairColorDeception = "blonde"; break; case 4: murdererName = "Navya"; hairColorMurderer = "blonde"; hairColorDeception = "black"; break; case 5: murdererName = "Oumsri"; hairColorMurderer = "black"; hairColorDeception = "brown"; break; } //assign random number that is not murderer valueDeception = Random.Range(1, 5); while (valueDeception == valueMurderer) { valueDeception = Random.Range(1, 5); } switch (valueDeception) { case 1: deceptionName = "Cindy"; break; case 2: deceptionName = "Olivia"; break; case 3: deceptionName = "Veronica"; break; case 4: deceptionName = "Navya"; break; case 5: deceptionName = "Oumsri"; break; } // question 2 valuePartner = Random.Range(1, 5); while (valuePartner == valueMurderer || valuePartner == valueSuspect) { valuePartner = Random.Range(1, 5); } switch (valuePartner) { case 1: callMyself(); partnerName = "Cindy"; break; case 2: callMyself(); partnerName = "Olivia"; break; case 3: callMyself(); partnerName = "Veronica"; break; case 4: callMyself(); partnerName = "Navya"; break; case 5: callMyself(); partnerName = "Oumsri"; break; } void callMyself() { // if (valuePartner == valueSuspect) // { // valuePartner = valueSuspect; // } } // deception question 2 valuePartnerDeception = Random.Range(1, 5); while (valuePartnerDeception == valueSuspect) { valuePartnerDeception = Random.Range(1, 5); } switch (valuePartnerDeception) { case 1: partnerNameDeception = "Cindy"; break; case 2: partnerNameDeception = "Olivia"; break; case 3: partnerNameDeception = "Veronica"; break; case 4: partnerNameDeception = "Navya"; break; case 5: partnerNameDeception = "Oumsri"; break; } }
public void ResetScore() { PersistentManagerScript score = GameObject.Find("PersistentScoreManager").GetComponent <PersistentManagerScript>(); score.ResetAll(); }