private void vehicleHover(UIComponent component, UIMouseEventParameter eventParam)
        {
            bool oldVal = component.GetComponentInChildren <DraggableVehicleInfo>().isDragging;
            bool newVal = (eventParam.buttons & UIMouseButton.Left) != UIMouseButton.None;

            component.GetComponentInChildren <DraggableVehicleInfo>().isDragging = newVal;
            if (oldVal != newVal && newVal == false)
            {
                TLMUtils.doLog("onVehicleDrop! {0}", component.name);
                DraggableVehicleInfo dvi  = eventParam.source.parent.GetComponentInChildren <DraggableVehicleInfo>();
                UIView               view = GameObject.FindObjectOfType <UIView>();
                UIHitInfo[]          hits = view.RaycastAll(eventParam.ray);
                DroppableStationInfo dsi  = null;
                UIComponent          res  = null;
                int idxRes = -1;
                for (int i = hits.Length - 1; i >= 0; i--)
                {
                    UIHitInfo hit = hits[i];
                    DroppableStationInfo[] dsiList = hit.component.GetComponentsInChildren <DroppableStationInfo>();
                    if (dsiList.Length == 0)
                    {
                        dsiList = hit.component.parent.GetComponentsInChildren <DroppableStationInfo>();
                    }

                    if (dsiList.Length == 1)
                    {
                        dsi    = dsiList[0];
                        res    = hit.component;
                        idxRes = i;
                        break;
                    }
                }
                if (dvi == null || dsi == null)
                {
                    TLMUtils.doLog("Drag Drop falhou! {0}", eventParam.source.name);
                    return;
                }
                else
                {
                    TLMUtils.doLog("Drag Funcionou! {0}/{1} ({2}-{3})", eventParam.source.name, dsi.gameObject.name, res.gameObject.name, idxRes);
                    VehicleAI ai = (VehicleAI)Singleton <VehicleManager> .instance.m_vehicles.m_buffer[dvi.vehicleId].Info.GetAI();
                    ai.SetTarget(dvi.vehicleId, ref Singleton <VehicleManager> .instance.m_vehicles.m_buffer[dvi.vehicleId], dsi.nodeId);
                }
            }
        }
示例#2
0
 public HitPointInfo(UIHitInfo info)
 {
     this.Component = info.component;
     this.HitPoint  = info.point;
     this.Distance  = info.distance;
 }