public static PlayerActionEvents Map(this PlayerActionEvents toItems, ActionRequests fromItems, Actions actions) { toItems.Clear(); foreach (var fromItem in fromItems) { toItems.Add(new PlayerActionEvent().Map(fromItem, actions)); } return(toItems); }
public static PlayerActionEvents ValidateStep( this TriggerStep triggerStep, PlayerActionEvents currentPlayerActions, PlayerActionEvents participatingPlayerActions ) { var stepPlayerActions = new PlayerActionEvents(); #pragma warning disable CS0219 // Variable is assigned but its value is never used bool contains; #pragma warning restore CS0219 // Variable is assigned but its value is never used foreach (var action in currentPlayerActions) { foreach (var rule in triggerStep.ActionOccurrenceRules) { if ( action.OccurredAt != null && rule.InsideOf.Contains(new Point( new Coordinate( action.OccurredAt.Coordinate.CoordinateValue.X, action.OccurredAt.Coordinate.CoordinateValue.Y ) ))) { contains = true; if (!stepPlayerActions.Exists(e => e.ActionRefId.Equals(action.ActionRefId))) { stepPlayerActions.Add(action); } } } } // logic to validate other than geofence // add stepPlayerActions to participatingPlayerActions foreach (var action in stepPlayerActions) { action.TriggerStepRefId = triggerStep.TriggerStepRefId; if (!participatingPlayerActions.Exists(e => e.ActionRefId.Equals(action.ActionRefId))) { participatingPlayerActions.Add(action); } } return(participatingPlayerActions); }