public void AddResourceInfo(StarSystem system) { _mineral = system.Mineral; _organic = system.Organic; _energy = system.Energy; }
/// <summary> /// populate TokenList with all visible tokens drawn from /// GameData, compile these in order for re-paint and hit- /// testing purposes: system tokens, non-movable ships /// including players own ships, then moveable /// tokens, i.e. current players fleet /// </summary> public TokenList(PlayerList playerList, SystemList systemList, HexArray hexArray, int playerID) { // // Create token for Worm hole, assign it to its hex and // add it to the token list // Token wormholeToken = new Token("Wormhole.ico", hexArray.Wormhole); hexArray[hexArray.Wormhole.X, hexArray.Wormhole.Y].SystemToken = wormholeToken; _tokenArray.Add(wormholeToken); // Cycle through systemList, creating tokens for // each system, adding them to the list and // assigning them to their home hex. for (int i = 0; i < systemList.Count; i++) { StarSystem system = systemList[i]; Point location = system.MapLocation; //Hex index of system Token token = CreateSystemToken(system, location); _tokenArray.Add(token); hexArray[location.X, location.Y].SystemToken = token; } // // Cycle through playerlist, getting Fleets and creating // Tokens for fleets and adding them to the list // and assigning their to a home hex. Skip this player // and create moveable tokens assigning them. // int count = playerList.Count; for (int i = 0; i < count; i++) { Fleet fleet = playerList[i].Fleet; //skip this players icons for now if (i == playerID) { continue; } for (int j = 0; j < fleet.Count; j++) { Ship ship = fleet[j]; if (ship.Type == Ship.ShipType.Trader) { continue; } Token token = CreateShipToken(ship, i); _tokenArray.Add(token); hexArray[ship.HexLocation.X, ship.HexLocation.Y].TokenList.AddToken(token); } } //if this is the controller view, we're done if (playerID == -1) { return; } //otherwise //create this players fleet tokens //add them to the list and assign them to their hexes for (int i = 0; i < playerList[playerID].Fleet.Count; i++) { Ship ship = playerList[playerID].Fleet[i]; if (ship.Type == Ship.ShipType.Trader) { continue; } MoveableToken token = CreatePlayerShipToken(ship, playerID); _tokenArray.Add(token); hexArray[ship.HexLocation.X, ship.HexLocation.Y].TokenList.AddToken(token); } }