示例#1
0
文件: Lane.cs 项目: Dudecake/SoftDev
        protected virtual TrafficUpdateViewModel CreateTrafficUpdate(List <GameObject> triggerinGameObjects)
        {
            TrafficUpdateViewModel trafficUpdate = new TrafficUpdateViewModel
            {
                LightId = TrafficLight.Id,
                Count   = triggerinGameObjects.Count
            };

            return(trafficUpdate);
        }
示例#2
0
        protected override TrafficUpdateViewModel CreateTrafficUpdate(List <GameObject> triggerinGameObjects)
        {
            TrafficUpdateViewModel trafficUpdate = base.CreateTrafficUpdate(triggerinGameObjects);

            List <GameObject> orderedTriggeringGameObjects = triggerinGameObjects.OrderBy(s => Vector3.Distance(this.TrafficLight.transform.position, s.transform.position)).ToList();

            trafficUpdate.DirectionRequests = new int[orderedTriggeringGameObjects.Count];
            for (int i = 0; i < orderedTriggeringGameObjects.Count; i++)
            {
                TrafficObject bus = orderedTriggeringGameObjects[i].gameObject.GetComponent <Bus>();
                trafficUpdate.DirectionRequests[i] = this.Paths[bus.PathId].BusDirectionId;
            }

            return(trafficUpdate);
        }