IWaypointEvent[] CollectWaypointEvents() { List <IWaypointEvent> resultList = new List <IWaypointEvent>(); List <IWaypointEventAdaptor> adaptors = new List <IWaypointEventAdaptor>(); Component[] components = this.transform.GetComponents(typeof(Component)); foreach (Component component in components) { if (component is IWaypointEventAdaptor) { adaptors.Add((IWaypointEventAdaptor)component); } } if (adaptors != null) { foreach (IWaypointEventAdaptor adaptor in adaptors) { resultList.Add(adaptor.GetWaypointEvent()); } IWaypointEventComparer comparer = new WaypointEventComparer(); resultList.Sort(comparer); } return(resultList.ToArray()); }
public override IWaypointEvent[] GetWaypointEvents() { IWaypointEvent[] sceneWaypointEvents = thisWaypointEvents; List <IWaypointEvent> allWaypointEvents = new List <IWaypointEvent>(); allWaypointEvents.AddRange(sceneWaypointEvents); allWaypointEvents.AddRange(thisSpawnEvents); WaypointEventComparer comparer = new WaypointEventComparer(); allWaypointEvents.Sort(comparer); return(allWaypointEvents.ToArray()); }