public void GiveGameItemsToClient(List <GameItemDescriptor> gameItems) { if (_ownPlanet == null) { _ownPlanet = gameItems.Find(x => x.PlayerName == ClientName); //find base planet } else { _unit = gameItems.Find(x => x.PlayerName == ClientName && x.ItemType == "Ship"); //find our (only) unit } }
public void GiveGameItemsToClient(List <GameItemDescriptor> gameItems) { if (_ownPlanet == null) { _ownPlanet = gameItems.Find(x => x.PlayerName == ClientName); //find base planet } else { _scoutShip = gameItems.Find(x => x.PlayerName == ClientName && x.ItemType == "Ship"); //find our (only) unit } _ownPlanet = gameItems.First(x => x.PlayerName == ClientName); //find base planet _enemyPlanet = gameItems.FirstOrDefault(x => x.PlayerName != ClientName && x.ItemType == "Planet"); _scoutShip = gameItems.FirstOrDefault(x => x.PlayerName == ClientName && x.ItemType == "Ship" && x.NumberOfUnits == 1); //find our (only) unit _military = gameItems.FirstOrDefault(x => x.PlayerName == ClientName && x.ItemType == "Ship" && x.NumberOfUnits > 1); }
public Scout(GameItemDescriptor scout) { id = scout.ItemId; tX = scout.PosX; tY = scout.PosY; }