private void handleWaveEnd() { if (this.currentWave + 1 <= this.maximumWave) { this.currentWave++; if (this.customWaves.ContainsKey(this.currentWave)) { this.spawnCustomWaveTitans(); } else { int titanAmount = 0; this.mathParser.LocalVariables["Wave"] = this.currentWave; this.mathParser.LocalVariables["PlayerCount"] = PhotonNetwork.playerList.Length; try { titanAmount = (int)this.mathParser.Parse(this.titanAmountFunction); } catch (System.Exception e) { ModMain.instance.log(e); this.mode = SpawnControllerMode.FIXED_SPAWN; ModMain.instance.sendToPlayer("Your function for the amount of titans to spawn had an error."); ModMain.instance.sendToPlayer("Please make sure it is correct. Meanwhile, the mode has been set to FixedSpawns"); this.handleFixedSpawnEnd(); } if (titanAmount > this.maxAllowedTitans) { this.titansToSpawn = titanAmount - this.maxAllowedTitans; } this.spawnTitans(Mathf.Min(this.maxAllowedTitans, titanAmount)); } //Send the message this.sendNewWaveMessage(); //Respawn everybody except the PTs foreach (PhotonPlayer player in PhotonNetwork.playerList) { if (RCextensions.returnIntFromObject(player.customProperties[PhotonPlayerProperty.isTitan]) != 2) { ModMain.instance.getGameManager().photonView.RPC("respawnHeroInNewRound", player, null); } } } else //We won { ModMain.instance.getGameManager().photonView.RPC("Chat", PhotonTargets.All, new object[] { "<color=#FFFF00><b>All waves completed!</b></color>", string.Empty }); ModMain.instance.getGameManager().gameWin2(); } }
public void setMode(SpawnControllerMode mode) { this.mode = mode; this.reset(); foreach (TITAN titan in GameObject.FindObjectsOfType <TITAN>()) { if (titan.photonView.isMine) { titan.photonView.RPC("netDie", PhotonTargets.AllBuffered, null); } } this.doInitialSpawns(); }
private void doInitialSpawns() { if (this.mode == SpawnControllerMode.WAVES) { if (this.customWaves.ContainsKey(this.currentWave)) { this.spawnCustomWaveTitans(); } else { try { int titanCount = 0; this.mathParser.LocalVariables["Wave"] = this.currentWave; this.mathParser.LocalVariables["PlayerCount"] = PhotonNetwork.playerList.Length; titanCount = (int)this.mathParser.Parse(this.titanAmountFunction); this.spawnTitans(Mathf.Min(this.maxAllowedTitans, titanCount)); if (titanCount > this.maxAllowedTitans) { this.titansToSpawn = titanCount - this.maxAllowedTitans; } }catch (System.Exception e) { ModMain.instance.log(e); this.mode = SpawnControllerMode.FIXED_SPAWN; ModMain.instance.sendToPlayer("Your function for the amount of titans to spawn had an error."); ModMain.instance.sendToPlayer("Please make sure it is correct. Meanwhile, the mode has been set to FixedSpawns"); this.doInitialSpawns(); } } this.sendNewWaveMessage(); } else { if (this.fixedTitanCount > this.maxAllowedTitans) { this.titansToSpawn = this.fixedTitanCount - this.maxAllowedTitans; } this.spawnFixedTitans(Mathf.Min(this.maxAllowedTitans, this.fixedTitanCount)); } }