public static void PlayerPetrificationCommandReceived(int fromClient, Packet packet) { int playerIdPetrified = packet.ReadInt(); int sequenceNumber = packet.ReadInt(); PetrificationCommand petrificationCommand = new PetrificationCommand(sequenceNumber, playerIdPetrified); Server.clients[fromClient].serverMasterController.AccumulatePetrificationRequestFromServer(petrificationCommand); }
public static void PetrifyPlayer(PetrificationCommand petrificationCommand) { using (Packet packet = new Packet((int)ClientPackets.playerPetrifyCommand)) { packet.Write(petrificationCommand.playerIdPetrified); packet.Write(petrificationCommand.sequenceNoForPetrificationCommand); SendTCPData(packet); } }
//Is called from client public void PetrificationCommandRegister(int petrifiedByActorId) { //if (IsInSpawnJarTerritory) //{ // health = maxHealth; // return; //} if (!isPushed) { PetrificationCommand petrificationCommand = new PetrificationCommand(ClientSideGameManager.players[petrifiedByActorId].masterController.localPlayer.GetLocalSequenceNo(), ownerId); ClientSend.PetrifyPlayer(petrificationCommand); } }
public void AccumulatePetrificationRequestFromServer(PetrificationCommand petrificationCommand) { if (petrificationCommand.sequenceNoForPetrificationCommand > playerSequenceNumberProcessed) { PetrificationCommand dataPackage; if (petrificationRequestReceivedFromServerDic.TryGetValue(petrificationCommand.sequenceNoForPetrificationCommand, out dataPackage)) { Debug.Log("<color=orange>AccumulatePetrificationRequestFromServer dataPackage already exists for sequence no. </color>" + dataPackage.sequenceNoForPetrificationCommand); } else { Debug.Log("<color=green>AccumulatePetrificationRequestFromServer Added successfully to processing buffer dic </color>" + playerSequenceNumberProcessed); petrificationRequestReceivedFromServerDic.Add(petrificationCommand.sequenceNoForPetrificationCommand, petrificationCommand); } } else { Debug.Log("<color=red>AccumulatePetrificationRequestFromServer Already processed this sequence no </color>" + playerSequenceNumberProcessed + " got the sequence for : " + petrificationCommand.sequenceNoForPetrificationCommand); } }