Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        //Grab platform--
        if (Input.GetButtonDown("Fire1"))
        {
            //print("Raycast Object: " + FP_Raycast.Update());



            // ----- Interact with MB Game -----
            if (m_MBPlatform == FP_Raycast.Update())
            {
                float dist = Vector3.Distance(m_MBPlatform.transform.position, m_Player.transform.position);
                if (dist < 2)
                {
                    print("Found Platform!");

                    freezePlayer     = true;
                    m_frozenLocation = m_Player.transform.position;

                    StartGame();
                }
                else
                {
                    print("User is not close enough to game");
                }
            }
        }



        if (freezePlayer)
        {
            m_Player.transform.position = m_frozenLocation;

            if (Input.GetKeyDown(KeyCode.E))
            {
                freezePlayer = false;
                StopGame();
            }

            //Z is leftRight    AD
            //X is forwardback    WS
            float horizontal = CrossPlatformInputManager.GetAxis("Horizontal");
            float vertical   = CrossPlatformInputManager.GetAxis("Vertical");

            float   Hor      = m_MBPlatform.transform.rotation.eulerAngles.z;          Hor += horizontal / 10;
            float   Vert     = m_MBPlatform.transform.rotation.eulerAngles.x;         Vert -= vertical / 10;
            float   defaultY = 0;
            Vector3 Rotation = new Vector3(Vert, defaultY, Hor);

            m_MBPlatform.transform.rotation = Quaternion.Euler(Rotation);
        }
    }
Exemple #2
0
    private void Update()
    {
        //when player hits Mouse1
        if (Input.GetMouseButtonDown(0))
        {
            GameObject g = FP_Raycast.Update();

            if (g == gameObject)
            {
                //send main game script the object that was hit
                m_GameCallback.DynamicInvoke(m_Index);
            }
        }
    }
Exemple #3
0
    private void ManageInput()
    {
        //select conduit
        if (Input.GetMouseButtonDown(0))
        {
            GameObject g = FP_Raycast.Update();

            if (g == gameObject)
            {
                m_IsSelected     = true;
                m_FrozenPosition = m_Player.position;
            }
        }

        //deselect conduit
        if (Input.GetKeyDown(KeyCode.E))
        {
            m_IsSelected = false;
        }
    }