public void SendNumberToSpawn_C2S(int _roomId, int _spawnNumber, string _roomType) { NumberToSpawnMessage msg = new NumberToSpawnMessage(); msg.roomId = _roomId; msg.spawnNumber = _spawnNumber; msg.roomType = _roomType; Debug.Log("SendNumberToSpawnDoor_C2S"); myClient.Send(MyMsgType.NumberToSpawnMsgType_client, msg); }
public void SendNumberToSpawn_S2C(int _roomId, int _spawnNumber, string _roomType) { NumberToSpawnMessage msg = new NumberToSpawnMessage(); msg.roomId = _roomId; msg.spawnNumber = _spawnNumber; msg.roomType = _roomType; Debug.Log("SendNumberToSpawn_S2C"); if (NetworkServer.active) { NetworkServer.SendToAll(MyMsgType.NumberToSpawnMsgType_server, msg); } }
public void OnRecvNumberToSpawn_Client(NetworkMessage netMsg) { if (Global.Instance.player.GetComponent <NetworkIdentity>().isServer) { return; } NumberToSpawnMessage msg = netMsg.ReadMessage <NumberToSpawnMessage>(); Debug.Log("ClientRecv_NumberToSpawn : room_" + msg.roomId); if (msg.roomType == "enemyRoom") { Debug.Log("RoomId: " + msg.roomId + " totalWave: " + msg.spawnNumber); if (Global.Instance.roomGen.GetRoomList()[msg.roomId] == null) { Debug.Log("Room not started yet"); } Global.Instance.roomGen.GetRoomList()[msg.roomId]. GetComponent <EnemyRoomScript>().GetSpawner(). GetComponent <EnemySpawner>().SetTotalWave(msg.spawnNumber); //RoomGenerator.Instance.GetRoomList()[msg.roomId].GetComponent<EnemyRoomScript>().totalNumWave = msg.spawnNumber; } else if (msg.roomType == "speedRoom") { Global.Instance.roomGen. GetRoomList()[msg.roomId]. GetComponent <SpeedRoomScript>(). SetSpawnerScript(); Global.Instance.roomGen. GetRoomList()[msg.roomId]. GetComponent <SpeedRoomScript>(). GetSpawnerScript().maxSpawns = msg.spawnNumber; } }
//recv spawn num public void OnRecvNumberToSpawn_Server(NetworkMessage netMsg) { NumberToSpawnMessage msg = netMsg.ReadMessage <NumberToSpawnMessage>(); Debug.Log("Host/ServerRecv_NumberToSpawn : room_" + msg.roomId); }