private void InitializeMapLocations() { MapObjects = new List <GameObject>(); List <PointLocation> banks = CurrentGame.Instance.gameDetail.banks; List <ServerTradePost> tradeposts = CurrentGame.Instance.gameDetail.tradePosts; //todo load all into map GameObject mapobj = GameObject.Find("Map"); GameObject container = new GameObject("TESTEST"); //todo get rid of this //GameObject container = GameObject.Find("MapElements"); if (mapobj != null) { GOMap map = mapobj.GetComponent <GOMap>(); if (map != null) { GameObject serverBanks = new GameObject("Server Banks"); serverBanks.transform.parent = container.transform; foreach (PointLocation bank in banks) { GameObject temp = (GameObject)Instantiate(Resources.Load("Bank"), Vector3.zero, Quaternion.identity); temp.transform.parent = serverBanks.transform; Bank bankScript = temp.GetComponent <Bank>(); if (bankScript != null) { bankScript.BankId = bank.id; } Coordinates coordinates = new Coordinates(bank.point.latitude, bank.point.longitude, 0); GOObject obj = GOObject.AddComponentToObject(temp, map, coordinates); Vector3 pos = coordinates.convertCoordinateToVector(0); pos.z = -3; temp.transform.localPosition = pos; MapObjects.Add(temp); } GameObject serverTPs = new GameObject("Server Tradingposts"); serverTPs.transform.parent = container.transform; foreach (ServerTradePost tp in tradeposts) { GameObject temp = (GameObject)Instantiate(Resources.Load("Tradingpost"), Vector3.zero, Quaternion.identity); temp.transform.parent = serverTPs.transform; TradingPost tpScript = temp.GetComponent <TradingPost>(); if (tpScript != null) { tpScript.TPId = tp.id; //todo load flavorText? } GOObject obj = GOObject.AddComponentToObject(temp, map, new Coordinates(tp.point.latitude, tp.point.longitude, 1.0)); MapObjects.Add(temp); } GameObject playerHolder = new GameObject("Playerholder"); //todo is there a better way to do this? playerHolder.transform.parent = container.transform; List <ServerPlayer> players = CurrentGame.Instance.PlayerList(); foreach (ServerPlayer serverPlayer in players) { if (serverPlayer.ClientId.Equals(CurrentGame.Instance.LocalPlayer.ClientId)) { continue; } GameObject temp = (GameObject)Instantiate(Resources.Load("Player"), Vector3.zero, Quaternion.identity); temp.name = serverPlayer.name; temp.transform.parent = playerHolder.transform; Person person = temp.GetComponent <Person>(); person.Player = serverPlayer; GOObject obj = GOObject.AddComponentToObject(temp, map, new Coordinates(51.164510, 4.140199, 1.0)); CurrentGame.Instance.PlayerObjects.Add(serverPlayer.ClientId, temp); } } else { Debug.Log("ERROR: MAP NOT LOADED"); } } else { Debug.Log("ERROR: MAP NOT LOADED"); } }