void HandleMouseButton(int buttonIndex, PointerControl buttonEnumValue)
 {
     if (Input.GetMouseButtonDown(buttonIndex))
     {
         if (UnityEngine.EventSystems.EventSystem.current != null &&
             UnityEngine.Cursor.lockState != CursorLockMode.Locked &&
             UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject())
         {
             m_Ignore = true;
         }
         else
         {
             SendClickEvent(buttonEnumValue, true);
         }
     }
     if (Input.GetMouseButtonUp(buttonIndex))
     {
         if (m_Ignore)
         {
             m_Ignore = false;
         }
         else
         {
             SendClickEvent(buttonEnumValue, false);
         }
     }
 }
예제 #2
0
 // Use this for initialization
 void Start()
 {
     OSCHandler.Instance.Init(); //init OSC
     projectionRoot = GameObject.Find("ProjectionRoot").GetComponent<ViewUpdate>();
     pointerRoot = GameObject.Find("PointerRoot").GetComponent<PointerControl>();
     DontDestroyOnLoad(gameObject);
 }
예제 #3
0
 // Use this for initialization
 void Start()
 {
     OSCHandler.Instance.Init();         //init OSC
     projectionRoot = GameObject.Find("ProjectionRoot").GetComponent <ViewUpdate>();
     pointerRoot    = GameObject.Find("PointerRoot").GetComponent <PointerControl>();
     DontDestroyOnLoad(gameObject);
 }
예제 #4
0
 // Use this for initialization
 void Awake()
 {
     OSCHandler.Instance.Init(); //init OSC
     projectionRoot = GameObject.Find("MainPlayer").transform.Find("ProjectionRoot").GetComponent<ProjectionRoot>();
     //pr2 = GameObject.Find("ERL Controller 2").transform.Find("ProjectionRoot").GetComponent<ProjectionRoot>();
     pointerRoot = GameObject.Find("PointerRoot").GetComponent<PointerControl>();
     DontDestroyOnLoad(gameObject);
 }
예제 #5
0
 // Use this for initialization
 void Awake()
 {
     OSCHandler.Instance.Init();         //init OSC
     projectionRoot = GameObject.Find("MainPlayer").transform.Find("ProjectionRoot").GetComponent <ProjectionRoot>();
     //pr2 = GameObject.Find("ERL Controller 2").transform.Find("ProjectionRoot").GetComponent<ProjectionRoot>();
     pointerRoot = GameObject.Find("PointerRoot").GetComponent <PointerControl>();
     DontDestroyOnLoad(gameObject);
 }
예제 #6
0
 // Use this for initialization
 private void Start()
 {
     lockedIn = false;
     anim = GetComponent<Animator>();
     pointerControl = GameObject.Find("PointerRoot").GetComponent<PointerControl>();
     pickupObject = GameObject.Find("MainPlayer").GetComponent<PickupObject>();
     initialPosition = transform.position;
     initialRotation = transform.rotation;
 }
예제 #7
0
 // Use this for initialization
 private void Start()
 {
     lockedIn        = false;
     anim            = GetComponent <Animator>();
     pointerControl  = GameObject.Find("PointerRoot").GetComponent <PointerControl>();
     pickupObject    = GameObject.Find("MainPlayer").GetComponent <PickupObject>();
     initialPosition = transform.position;
     initialRotation = transform.rotation;
 }
    void SendClickEvent(PointerControl controlIndex, bool clicked)
    {
        ////REVIEW: should this be a pointer-specific event type?
        var inputEvent = InputSystem.CreateEvent <GenericControlEvent>();

        inputEvent.deviceType   = typeof(Mouse);
        inputEvent.deviceIndex  = 0;
        inputEvent.controlIndex = (int)controlIndex;
        inputEvent.value        = clicked ? 1.0f : 0.0f;
        InputSystem.QueueEvent(inputEvent);
    }
예제 #9
0
        private void SendPointerClickEvent(PointerControl controlIndex, bool clicked, float time)
        {
            var inputEvent = InputSystem.CreateEvent <GenericControlEvent>();

            inputEvent.time         = time;
            inputEvent.deviceType   = typeof(Touchscreen);
            inputEvent.deviceIndex  = 0;            ////FIXME: must be right index for us
            inputEvent.controlIndex = (int)controlIndex;
            inputEvent.value        = clicked ? 1.0f : 0.0f;
            InputSystem.QueueEvent(inputEvent);
        }
예제 #10
0
 // Use this for initialization
 void Start()
 {
     if (Settings.debug)
     {
         gameObject.SetActive(false);
         return;
     }
     OSCHandler.Instance.Init();         //init OSC
     projectionRoot = GameObject.Find("ProjectionRoot").GetComponent <ViewUpdate>();
     pointerRoot    = GameObject.Find("PointerRoot").GetComponent <PointerControl>();
     DontDestroyOnLoad(gameObject);
 }
 // Use this for initialization
 void Start()
 {
     if(Settings.debug)
     {
         gameObject.SetActive(false);
         return;
     }
     OSCHandler.Instance.Init(); //init OSC
     projectionRoot = GameObject.Find("ProjectionRoot").GetComponent<ViewUpdate>();
     pointerRoot = GameObject.Find("PointerRoot").GetComponent<PointerControl>();
     DontDestroyOnLoad(gameObject);
 }
예제 #12
0
    // Use this for initialization
    private void Start()
    {
        holding           = false;
        totalRotationZ    = 0.0f;
        pointerControl    = GameObject.Find("PointerRoot").GetComponent <PointerControl>();
        playerTeaCeremony = GameObject.Find("MainPlayer").GetComponent <PlayerTeaCeremony>();

        if (!Settings.start_allow_actions)
        {
            this.enabled = false;
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (projectionRoot == null)
        {
            if (GameObject.Find("ProjectionRoot"))
            {
                projectionRoot = GameObject.Find("ProjectionRoot").GetComponent<ViewUpdate>();
            }
        }
        if (pointerRoot == null)
        {
            if(GameObject.Find("PointerRoot"))
                pointerRoot = GameObject.Find("PointerRoot").GetComponent<PointerControl>();
        }
        if (projectionRoot.whichCameraToViewFrom == ViewUpdate.viewType.center){
            /*
            OSCHandler.Instance.UpdateLogs();

            List<UnityOSC.OSCPacket> packets=OSCHandler.Instance.Servers["HeadTracker"].packets;

            if (packets.Count>0)
            Debug.Log (packets[0].Address);

            */
            OSCHandler.Instance.UpdateLogs();
            List<string> server_messages = OSCHandler.Instance.Servers["HeadTracker"].log;
            foreach (string msg in server_messages){
                //Debug.Log (msg);
                //parse message and update tracker position
                string[] words = msg.Split(' ');

                //convert Vicon coordinates to Unity coordinates
                projectionRoot.UpdateTrackerPosition(float.Parse(words[5]),float.Parse(words[7]), float.Parse(words[6]));

                //14, 15, 16 = H, P, R
                // rotate X = pitch
                // rotate Y = heading
                // rotate Z = roll
                if (pointerRoot)
                    pointerRoot.UpdatePointer (float.Parse(words[11]), float.Parse(words[13]), float.Parse(words[12]), float.Parse(words[15]), float.Parse(words[14]), float.Parse(words[16]));
            }
        }
    }
예제 #14
0
 public void ResetReferences()
 {
     projectionRoot = GameObject.Find("ProjectionRoot").GetComponent<ViewUpdate>();
     pointerRoot = GameObject.Find("PointerRoot").GetComponent<PointerControl>();
 }
예제 #15
0
 public void ResetReferences()
 {
     projectionRoot = GameObject.Find("ProjectionRoot").GetComponent <ViewUpdate>();
     pointerRoot    = GameObject.Find("PointerRoot").GetComponent <PointerControl>();
 }
    // Use this for initialization
    private void Start()
    {
        holding = false;
        totalRotationZ = 0.0f;
        pointerControl = GameObject.Find("PointerRoot").GetComponent<PointerControl>();
        playerTeaCeremony = GameObject.Find("MainPlayer").GetComponent<PlayerTeaCeremony>();

        if(!Settings.start_allow_actions)
        {
            this.enabled = false;
        }
    }
예제 #17
0
 void Awake()
 {
     s_ins = this;
 }