//Place totalNumber of elements in order of square public static void FillSquareUniform(float totalNumber, PlacePoint dlg) { int mainSize = (int)Mathf.Sqrt(totalNumber); int lbrd = -mainSize / 2; int rbrd = lbrd + mainSize; for (int x = lbrd; x < rbrd; ++x) { for (int y = lbrd; y < rbrd; ++y) { dlg(x, y); } } int restOfItems = (int)(totalNumber + 0.5f) - mainSize * mainSize; --lbrd; ++rbrd; for (int y = rbrd - 1; y > lbrd && restOfItems > 0; --y, --restOfItems) { dlg(rbrd - 1, y); } for (int x = lbrd + 1; restOfItems > 0; ++x, --restOfItems) { dlg(x, rbrd - 1); } }
private void Start() { if (point == null && GetComponent <PlacePoint>() != null) { point = GetComponent <PlacePoint>(); } point.OnPlaceEvent += OnGrab; point.OnRemoveEvent += OnRelease; point.OnHighlightEvent += OnHighlight; point.OnStopHighlightEvent += OnRelease; }
bool CheckForWorldDuplicate(WorldItem loadedItem) // Called at load to stop world items duplicating { PlacePoint point = GameObject.Find(loadedItem.myGameItem.placedPointName).GetComponent <PlacePoint>(); if (point.empty == false) { Destroy(loadedItem.gameObject); return(true); } else { return(false); } }
public static DirectionResults GetDepartureDirections(PlacePoint origin, PlacePoint destination, DateTime departureTime) { var bristolApi = new BristolApi(); var request = new GetDirectionsRequest { Origin = new PlacePointDto { Lat = origin.Lat, Lng = origin.Lng }, Destination = new PlacePointDto { Lat = destination.Lat, Lng = destination.Lng }, DepartureTime = departureTime }; var response = bristolApi.GetDirectionsAsync(request); return(new DirectionResults(response.Data)); }
private void SelectionFinished() { loading = false; loadingBaseImage.SetActive(false); if (selectedObject == null) { return; } if (selectedObject.tag == "Collectable") { if (collectedObject == null) { collectedObject = selectedObject.GetComponent <Collectable>(); collectedObject.transform.parent = collectedTransformParent; collectedObject.transform.localScale = Vector3.one; collectedObject.transform.localPosition = Vector3.zero; collectedObject.GetComponent <Collider>().isTrigger = true; } else if (collectedObject.type == selectedObject.GetComponent <Collectable>().type) { collectedObject.transform.parent = null; collectedObject.transform.localScale = Vector3.one; collectedObject.GetComponent <Collider>().isTrigger = false; collectedObject = null; } } else if (selectedObject.tag == "Interactable" && collectedObject == null) { selectedObject.GetComponent <Interactable>().Interact(); } else if (selectedObject.tag == "PlacePoint" && collectedObject != null) { PlacePoint __pp = selectedObject.GetComponent <PlacePoint>(); if (__pp.requiredCollectable == collectedObject.type) { __pp.PlaceObject(collectedObject); collectedObject = null; } } }
public ActionResult NextJourney() { using (var context = new DatabaseContext()) { var schedule = context.ScheduleItems.Include(x => x.Destination).Include(x => x.Origin).FirstOrDefault(); var origin = new PlacePoint { Lat = schedule.Origin.Latitude, Lng = schedule.Origin.Longitude }; var destination = new PlacePoint { Lat = schedule.Destination.Latitude, Lng = schedule.Destination.Longitude }; var resposne = Directions.GetDepartureDirections(origin, destination, DateTime.Now); } return(View()); }
//Place totalNumber of elements in order of square public static void FillSquareUniform( float totalNumber, PlacePoint dlg ) { int mainSize = (int)Mathf.Sqrt(totalNumber); int lbrd = -mainSize / 2; int rbrd = lbrd + mainSize; for( int x = lbrd; x < rbrd; ++x ) for( int y = lbrd; y < rbrd; ++y ) dlg( x, y ); int restOfItems = (int)(totalNumber + 0.5f) - mainSize * mainSize; --lbrd; ++rbrd; for( int y = rbrd -1; y > lbrd && restOfItems > 0; --y, --restOfItems ) dlg( rbrd - 1, y ); for( int x = lbrd + 1; restOfItems > 0; ++x, --restOfItems ) dlg( x, rbrd - 1 ); }
void OnRelease(PlacePoint hand, Grabbable grab) { changer.HideText(changeTime, fadeTime); }
void OnHighlight(PlacePoint hand, Grabbable grab) { changer.UpdateText(gameObject, highlightMessage, changeTime); }
void OnGrab(PlacePoint hand, Grabbable grab) { changer.UpdateText(gameObject, placeMessage, changeTime); }