//Called when the server is started public override void OnStartServer() { if (isServer) { if (!WinBarSingleton.peekInstance()) { this.CmdSpawnWinBar(); } NetworkServer.RegisterHandler(7999, OnReceiveEndGameMessage); NetworkServer.RegisterHandler(7998, OnReceiveSlowMessage); } }
public void CmdReceiveEndGameMessage(bool endCond) { if (!this.EndFlag) { WinBarSingleton.resetInstance(); if (endCond) { Instantiate(this.gameWinUI); } else { Instantiate(this.gameOverUI); } this.EndFlag = true; } }
public void CmdSpawnWinBar() { this.localWinBar = Instantiate(WinBarSingleton.getInstance(winBar)); this.localWinBar.transform.position = new Vector3(0, 9, 0); NetworkServer.Spawn(this.localWinBar); }