예제 #1
0
        void CheckSelections(MoverioTouchpadEventArgs mieArgs)
        {
            Collider[] targets = GetAffectedTargets();

            SelectionControllerEventArgs args = new SelectionControllerEventArgs(mieArgs);

            args.Device      = ControllerType.HandGesture;
            args.IsConflict  = targets.Length > 1;
            args.PointerPx   = RightCamera.WorldToScreenPoint(gameObject.transform.position);
            args.PointerPos  = gameObject.transform.position;
            args.PointerQuat = gameObject.transform.rotation;

            foreach (Collider target in targets)
            {
                target.SendMessage("Selected", args, SendMessageOptions.DontRequireReceiver);
            }

            if (targets.Length == 0 || args.IsConflict)
            {
                SelectionEventArgs seArgs = new SelectionEventArgs(args);
                seArgs.Type = SelectionEventArgs.SelectionEventType.Selected;

                MessageBroker.BroadcastAll("OnSelected", seArgs);
            }
        }
예제 #2
0
        void CheckHovers()
        {
            Collider target = GetFirstAffectedTarget();

            SelectionControllerEventArgs args = new SelectionControllerEventArgs(null);

            args.Device      = ControllerType.GyroMouse;
            args.IsConflict  = false;
            args.PointerPx   = GetScreenPoint();
            args.PointerPos  = EPSONcamera.transform.position;
            args.PointerQuat = EPSONcamera.transform.rotation;

            if (target != null)
            {
                if (hoveredTargets.ContainsKey(target.gameObject))
                {
                    hoveredTargets[target.gameObject] = true;
                }
                else
                {
                    hoveredTargets.Add(target.gameObject, true);
                }
                target.SendMessage("Hovered", args, SendMessageOptions.DontRequireReceiver);
            }

            List <GameObject> notHovered = new List <GameObject>();

            foreach (GameObject targetObj in hoveredTargets.Keys)
            {
                if (!hoveredTargets[targetObj])
                {
                    notHovered.Add(targetObj);
                }
            }

            foreach (GameObject targetObj in notHovered)
            {
                args             = new SelectionControllerEventArgs(null);
                args.Device      = ControllerType.GyroMouse;
                args.IsConflict  = false;
                args.PointerPx   = GetScreenPoint();
                args.PointerPos  = EPSONcamera.transform.position;
                args.PointerQuat = EPSONcamera.transform.rotation;

                targetObj.SendMessage("NotHovered", args, SendMessageOptions.DontRequireReceiver);
                hoveredTargets.Remove(targetObj);
            }

            List <GameObject> keys = new List <GameObject>(hoveredTargets.Keys);

            foreach (GameObject targetObj in keys)
            {
                hoveredTargets[targetObj] = false;
            }
        }
예제 #3
0
        void CheckHovers()
        {
            Collider[] targets = GetAffectedTargets();
            foreach (Collider target in targets)
            {
                SelectionControllerEventArgs args = new SelectionControllerEventArgs(null);
                args.Device      = ControllerType.HandGesture;
                args.IsConflict  = targets.Length > 1;
                args.PointerPx   = RightCamera.WorldToScreenPoint(gameObject.transform.position);
                args.PointerPos  = gameObject.transform.position;
                args.PointerQuat = gameObject.transform.rotation;

                if (hoveredTargets.ContainsKey(target.gameObject))
                {
                    hoveredTargets[target.gameObject] = true;
                }
                else
                {
                    hoveredTargets.Add(target.gameObject, true);
                }
                target.SendMessage("Hovered", args, SendMessageOptions.DontRequireReceiver);
            }

            List <GameObject> notHovered = new List <GameObject>();

            foreach (GameObject targetObj in hoveredTargets.Keys)
            {
                if (!hoveredTargets[targetObj])
                {
                    notHovered.Add(targetObj);
                }
            }

            foreach (GameObject targetObj in notHovered)
            {
                SelectionControllerEventArgs args = new SelectionControllerEventArgs(null);
                args.Device      = ControllerType.HandGesture;
                args.IsConflict  = false;
                args.PointerPx   = RightCamera.WorldToScreenPoint(gameObject.transform.position);
                args.PointerPos  = gameObject.transform.position;
                args.PointerQuat = gameObject.transform.rotation;

                targetObj.SendMessage("NotHovered", args, SendMessageOptions.DontRequireReceiver);
                hoveredTargets.Remove(targetObj);
            }

            List <GameObject> keys = new List <GameObject>(hoveredTargets.Keys);

            foreach (GameObject targetObj in keys)
            {
                hoveredTargets[targetObj] = false;
            }
        }
예제 #4
0
        void CheckSelections(MoverioTouchpadEventArgs mieArgs)
        {
            Collider target = GetFirstAffectedTarget();

            SelectionControllerEventArgs args = new SelectionControllerEventArgs(mieArgs);

            args.Device      = ControllerType.GyroMouse;
            args.IsConflict  = false;
            args.PointerPx   = GetScreenPoint();
            args.PointerPos  = EPSONcamera.transform.position;
            args.PointerQuat = EPSONcamera.transform.rotation;

            if (target != null)
            {
                target.SendMessage("Selected", args, SendMessageOptions.DontRequireReceiver);
            }
            else
            {
                SelectionEventArgs seArgs = new SelectionEventArgs(args);
                seArgs.Type = SelectionEventArgs.SelectionEventType.Selected;

                MessageBroker.BroadcastAll("OnSelected", seArgs);
            }
        }
예제 #5
0
 public SelectionEventArgs(SelectionControllerEventArgs cEvent)
 {
     Time            = System.DateTime.Now;
     ControllerEvent = cEvent;
 }