public void StartNextLevel() { LevelNumber++; ChooseRandomSkybox(); XPCounter xpCounter = FindObjectOfType <XPCounter>(); if (xpCounter != null) { xpCounter.SetXPName(); } LevelCounter levelText = FindObjectOfType <LevelCounter>(); if (levelText != null) { levelText.SetLevelCounter(LevelNumber); } Pickup[] pickups = FindObjectsOfType <Pickup>(); foreach (Pickup pick in pickups) { Destroy(pick.gameObject); } mapGen.GenerateLevel(); FindObjectOfType <PlayerSpawn>().SpawnPlayer(); StartCoroutine(UpdateNavMesh()); }
public void SetStart(int abstractNumId, int ilvl, int start) { if (start < 0) { return; } if (abstractNums.ContainsKey(abstractNumId)) { LevelCounter lc = abstractNums[abstractNumId].FirstOrDefault(c => c.iLevel == ilvl); if (lc != null) { lc.Start = start; } else { abstractNums[abstractNumId].Add(new LevelCounter(ilvl, start)); } } else { abstractNums[abstractNumId] = new List <LevelCounter>(); abstractNums[abstractNumId].Add(new LevelCounter(ilvl, start)); } }
void RpcInitiateFight() { //Debug.Log("RpcInititating fight with: " + this.gameObject); gameManager.fightingMonsters.Add(this.gameObject); ClientSetActiveCardButtons(false); PlayerInGame.localPlayerInGame.progressButton.ActivateButton(); HelpButton.Activate(); LevelCounter.OnStartFight(); InfoPanel.Alert("Fight with " + cardValues.name + " starts!"); }
private void Awake() { if (Instance == null) { Instance = this; //DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } text = GetComponent <TextMeshProUGUI>(); }
// Use this for initialization void Start() { if (THIS == null) { THIS = this; } else { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
public void Awake() { if(SceneManager.GetActiveScene().name.Equals("Demo Start") && Timer.timer != null) { Destroy(Timer.timer.transform.parent.gameObject); Timer.timer = null; } //Make sure there is only 1 levelCounter object in any given scene if (levelCounter != null) { Destroy(this.gameObject); return; } else { levelCounter = this; DontDestroyOnLoad(this.gameObject); } }
/// <summary> /// Restart the numbering value of ilvl, and all the levels larger than ilvl will be restarted as well. /// </summary> /// <param name="abstractNumId"></param> /// <param name="ilvl"></param> public void Restart(int abstractNumId, int ilvl) { if (abstractNums.ContainsKey(abstractNumId)) { while (true) { LevelCounter lc = abstractNums[abstractNumId].FirstOrDefault(c => c.iLevel == ilvl); if (lc != null) { lc.Restart(); ilvl++; } else { break; } } } }
LevelCounter() { levelCounter = this; }