public void MoveEnemiesToSpawnPoints() { MoveToSpawnPoints( Entities.AliveInTeam(2), GetRandomSpawnPoints( Entities.AliveInTeam(1) .Select(entity => entity.transform.position) .Concat(new[] { EnterLocation.With(z: 0), ExitLocation.With(z: 0) }) .ToList() ) ); }
public void MoveAlliesToExit() { MoveToSpawnPoints( Entities.AliveInTeam(1), GetSpawnPointsNearby( ExitLocation, Entities.AliveInTeam(2) .Select(entity => entity.transform.position) .Concat(new[] { EnterLocation.With(z: 0), ExitLocation.With(z: 0) }) .ToList() ) ); }
private async void OnInteraction() { var playerPed = Cache.PlayerPed; var closeToEnter = EnterLocation.DistanceToSquared(playerPed.Position) < 3.0f; if (closeToEnter) { await playerPed.TeleportToLocation(ExitLocation, true); } else { if (ExitLocation.DistanceToSquared(playerPed.Position) < 3.0f) { await playerPed.TeleportToLocation(EnterLocation, true); } } }
private static List <Event> retrieveGeoFenceEventList(GTSLocationMessage locationMessage, GTSLocationMessage prevMessage) { List <Event> geoFenceEvents = new List <Event>(); // Get User Logged in // For now we'll just get all associated with user // TODO - Need to update this to pull form User/Account and tracker level later on // TODO - implemented using the "Created User" on the table, should be done with a proper mapping table if (locationMessage.TrackerID != null) { //get list of GeoFences for tracker List <GTSDataStorage.GeoFence> geoFencesFromDatabase = GTSDataStorage.Manager.FencesManager.GetFencesByTrackerId(locationMessage.TrackerID); List <GTSBizObjects.GeoFence> geoFences = new List <GeoFence>(); // Why are these two for loops separate? TODO foreach (GTSDataStorage.GeoFence item in geoFencesFromDatabase) { GTSBizObjects.GeoFence geoFence = new GeoFence(item.FencesId, item.FencesName, item.FencesCoordinate, item.IsPublic, item.Details, item.Status, item.Zoom, item.CreatedBy, item.CreatedDate, item.UpdatedBy, item.UpdatedDate); geoFences.Add(geoFence); } foreach (GTSBizObjects.GeoFence item in geoFences) { // Check if prev message and current message are in the geofence // TODO: Using the model of speed event we can track how long a vehicle spent in a geo fence and what they did there // If prev message and message are in the geo fence we simply update the last geo fence event tied with location message and time // Stored in extended properties for the event. try { List <Location> locations = Events.Hepler.GeoFenceLocations(item.Coordinates); bool prevLocationInFence = Events.Hepler.IsPointInPolygon(locations, new Location { Lt = (double)prevMessage.LatitudeDecimal, Lg = (double)prevMessage.LongitudeDecimal }); bool currentLocationInFence = Events.Hepler.IsPointInPolygon(locations, new Location { Lt = (double)locationMessage.LatitudeDecimal, Lg = (double)locationMessage.LongitudeDecimal }); //if tracker entered a Geo Fence add to list of events if (!prevLocationInFence && currentLocationInFence) { Events.TrackerEvents.EnterLocation enterLocationEvent = new EnterLocation(); enterLocationEvent.AddLocationMessage(locationMessage, item); geoFenceEvents.Add(enterLocationEvent); } //if tracker exited a Geo Fence add to list of events if (prevLocationInFence && !currentLocationInFence) { Events.TrackerEvents.ExitLocation exitLocationEvent = new ExitLocation(); exitLocationEvent.AddLocationMessage(locationMessage, item); geoFenceEvents.Add(exitLocationEvent); } }catch (System.Exception e) { Utilities.writeLine("Debug !: A GeoFence may be corrupted!!! " + e.Message); } } } return(geoFenceEvents); }