private void RemoveLocationFromMap(LBELocation location) { if (this.locationIdToGameObject.TryGetValue(location.LocationId, out GameObject locationGameObject)) { this.DestoryGameObject(locationGameObject); this.locationIdToGameObject.Remove(location.LocationId); this.locationIdToLBELocation.Remove(location.LocationId); } }
private void AddLocationToMap(LBELocation location) { if (this.locationIdToGameObject.ContainsKey(location.LocationId) == false) { var locationGameObject = this.CreateGameObject(location); if (locationGameObject != null) { this.locationIdToGameObject.Add(location.LocationId, locationGameObject); this.locationIdToLBELocation.Add(location.LocationId, location); } } }
private GameObject CreateGameObject(LBELocation location) { if (this.gameObjectTypes != null) { for (int i = 0; i < this.gameObjectTypes.Count; i++) { if (this.gameObjectTypes[i].GameObjectType == location.TypeId) { // TODO [bgish]: Get from a Pool instead of instantiating it (Unity now has a pooling API) var newGameObject = GameObject.Instantiate(this.gameObjectTypes[i].Prefab); newGameObject.transform.Reset(); newGameObject.transform.position = GoogleMapsManager.Instance.GetPosition(location.LatLong); return(newGameObject); } } } return(null); }
private bool IsLocationInLoadRange(LBELocation location, GPSLatLong currentLatLong) { return(GPSUtil.DistanceInMeters(location.LatLong, currentLatLong) < this.loadRadiusInMeters); }