public void HandleData() { var characterExemplarId = _unprocessedReceivedPacket.Pull <int>(); var weaponExemplarId = _unprocessedReceivedPacket.Pull <int>(); if (_modelManagerServer.ModelManager.WeaponsModel.ExemplarModelDic.ContainsKey(weaponExemplarId)) { _modelManagerServer.ModelManager.CharactersModel.ExemplarModelDic[characterExemplarId].ChangeHoldWeapon(weaponExemplarId); } }
public void HandleData() { var characterExemplarId = _unprocessedReceivedPacket.Pull <int>(); var enemyExemplarId = _unprocessedReceivedPacket.Pull <int>(); var isCharactersExist = _modelManagerServer.ModelManager.CharactersModel.ExemplarModelDic.ContainsKey(characterExemplarId) && _modelManagerServer.ModelManager.CharactersModel.ExemplarModelDic.ContainsKey(enemyExemplarId); var isCharacterHoldWeapon = _modelManagerServer.ModelManager.CharactersModel.ExemplarModelDic[characterExemplarId].HealthPoint != null; if (isCharactersExist && isCharacterHoldWeapon) { _modelManagerServer.ModelManager.CharactersModel.ExemplarModelDic[characterExemplarId].Attack(_modelManagerServer.ModelManager.CharactersModel.ExemplarModelDic[enemyExemplarId]); } }
public void HandlePacket() { while (_packet.Data.Length > 0) { var stateData = _packet.Pull <object>(); _worldDataReplication.Read(stateData); } }
public void HandlePacket() { while (_packet.Data.Length > 0) { GameCommandType gameCommandType = _packet.Pull <GameCommandType>(); ICommandHandler commandHandler; switch (gameCommandType) { case GameCommandType.SetControllablePlayer: commandHandler = new SetControllablePlayerCommandHandler(_packet, _modelManagerClient); break; default: throw new ArgumentOutOfRangeException(); } commandHandler.HandleCommand(); } }
public void HandleData() { while (_unprocessedReceivedPacket.Data.Length > 0) { IDataHandler dataHandler; GameCommandType commandType = _unprocessedReceivedPacket.Pull <GameCommandType>(); switch (commandType) { case GameCommandType.CharacterAttackEnemy: dataHandler = new CharacterAttackEnemyDataHandler(_unprocessedReceivedPacket, _modelManagerServer); break; case GameCommandType.HoldWeaponChanged: dataHandler = new HoldWeaponChangedDataHandler(_unprocessedReceivedPacket, _modelManagerServer); break; default: throw new ArgumentOutOfRangeException(); } dataHandler.HandleData(); } }
public void HandleCommand() { var controllablePlayerId = _packet.Pull <int>(); _modelManagerClient.SetControllablePlayer(controllablePlayerId); }