// Update is called once per frame
    void Update()
    {
        // Get the input info
        SeatedInfo    personInfo = this.inputContoller.playerInfo;
        GameInputInfo inputInfo  = this.inputContoller.InputInfo;

        if (inputInfo == null)
        {
            return;
        }

        // Set the player position and direction
        if (personInfo.Features == null)
        {
            return;
        }

        //Debug.Log (inputInfo.Features.Position);
        //this.transform.position = new Vector2(0, -(inputInfo.Features.Position.y)) * 5;
        //this.transform.forward = new Vector2(0, -(inputInfo.Features.Direction.y)) * 5;

        //this.transform.rotation = new Quaternion(0, 0, -1*(inputInfo.Features.Angle/(90)) * rotateSpeed * Time.deltaTime, 1);

        if (inputInfo.SoldierInfo.IsSkeletonAvailable)
        {
            if (personInfo.Features.Position.y < 0.95f)
            {
                transform.Translate(Vector3.up * (Player.speed + 1) * Time.deltaTime);
            }
            else if (personInfo.Features.Position.y > 1.1f)
            {
                transform.Translate(Vector3.down * (Player.speed + 4) * Time.deltaTime);
            }

            transform.Rotate(0, 0, -1 * (personInfo.Features.Angle / (30)) * Player.rotateSpeed * Time.deltaTime);

            //this.transform.up = new Vector2(personInfo.Features.Direction.x, personInfo.Features.Direction.y) * 50;

            print(personInfo.Features.Position.y);

            /*Debug.Log (personInfo.Features.Angle);
             *
             * transform.Rotate (0, 0, -1 * (personInfo.Features.Angle / (90)) * Player.rotateSpeed * Time.deltaTime);
             *
             * Player.speed += personInfo.Features.Position.y * Player.speed * Time.deltaTime;
             *
             * Player.speed = Mathf.Clamp (Player.speed, 1, 10);
             */

            if (inputInfo.SoldierInfo.IsSkeletonAvailable)
            {
                Debug.Log("Skeleton available.");
            }

            return;
        }
    }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(KeyCode.A))
        {
            currentFacing -= turnRate;
        }
        if (Input.GetKey(KeyCode.D))
        {
            currentFacing += turnRate;
        }

        if (ellekSystem.ChangeAngle((currentFacing * (Mathf.PI / 180))) == false)
        {
            Debug.Log("Turning did not register; player rotated too far.");
        }

        Speed2D    = ellekSystem.adjustedSpeed;
        Velocity2D = new Vector2(transform.forward.x, transform.forward.z) * Speed2D;

        // Get the input info
        SeatedInfo inputInfo = this.inputController.InputInfo;

        if (inputInfo == null)
        {
            return;
        }

        // Set the player position and direction
        if (inputInfo.Features == null)
        {
            return;
        }

        //Debug.Log (inputInfo.Features.Angle);
        KinectSlider.value = inputInfo.Features.Angle;

        //Debug.Log (inputInfo.Features.Position);
        if (ellekSystem.ChangeAngle(inputInfo.Features.Angle * Mathf.Deg2Rad))
        {
            Debug.Log("Turning did not register; player rotated too far.");
        }

        return;
    }
    // Update is called once per frame
    void Update()
    {
        if (controllerEnabled == true)
        {
            //if (Input.GetAxis("Joystick Triggers") > 0.05)
            //{
            //    this.transform.Rotate(Vector3.forward * (Input.GetAxis("Joystick Triggers") * 5));
            //}
            //else if (Input.GetAxis("Joystick Triggers") < -0.05)
            //{
            //    this.transform.Rotate(Vector3.forward * (Input.GetAxis("Joystick Triggers") * 5));
            //}
            ////Debug.Log(Input.GetAxis("Joystick Triggers"));
        }

        // Get the input info
        SeatedInfo inputInfo = this.inputController.InputInfo;

        if (inputInfo == null)
        {
            return;
        }

        // Set the player position and direction
        if (inputInfo.Features == null)
        {
            return;
        }

        //Debug.Log (inputInfo.Features.Position);
        //this.transform.position = new Vector3(inputInfo.Features.Position.x, 0, inputInfo.Features.Position.y) * 5;
        //this.transform.forward = new Vector3(inputInfo.Features.Direction.x, 0, inputInfo.Features.Direction.y) * 5;

        if (kinectEnabled == true && canMove)
        {
        }



        return;
    }
Beispiel #4
0
    // Update is called once per frame
    void Update()
    {
        // Get the input info
        SeatedInfo inputInfo = this.inputController.InputInfo;

        if (inputInfo == null)
        {
            return;
        }

        // Set the player position and direction
        if (inputInfo.Features == null)
        {
            return;
        }

        //Debug.Log (inputInfo.Features.Position);
        this.transform.position = new Vector3(inputInfo.Features.Position.x, 0, inputInfo.Features.Position.y) * 5;
        this.transform.forward  = new Vector3(inputInfo.Features.Direction.x, 0, inputInfo.Features.Direction.y) * 5;

        return;
    }
Beispiel #5
0
    // Update is called once per frame
    void Update()
    {
        #region Keyboard Input
        if (Time.time > timeToTrigger)
        {
            if (Input.GetKey(KeyCode.A))
            {
                if (selectedButton != -2)
                {
                    selectedButton -= 1;
                }
                timeToTrigger = Time.time + scrollDelay;

                if (selectedButton < 0)
                {
                    selectedButton = finalButton;
                }
            }

            if (Input.GetKey(KeyCode.D))
            {
                if (selectedButton != -2)
                {
                    selectedButton += 1;
                }
                timeToTrigger = Time.time + scrollDelay;

                if (selectedButton > finalButton)
                {
                    selectedButton = 0;
                }
            }

            if (Input.GetKey(KeyCode.Space))
            {
                timeToTrigger = Time.time + scrollDelay;
                switch (selectedButton)
                {
                case 0: startGameButton.onClick.Invoke();
                    break;

                case 1: upgradeStoreButton.onClick.Invoke();
                    break;

                case 2: informationScreenButton.onClick.Invoke();
                    selectedButton = -2;
                    break;

                case -2: informationReturnButton.onClick.Invoke();
                    break;
                }
            }
        }

        inputDelay = Time.time;

        // Get the input info
        SeatedInfo inputInfo = this.inputController.InputInfo;

        #endregion

        #region Kinect Input
        if (inputInfo != null)
        {
            /*If player is turned far enough in one direction AND enough time has passed
             * since the last time a menu option scrolled...*/
            if (inputInfo.Features.Angle > 45 && Time.time > timeToTrigger)
            {
                /*so long as we're not in the Information Screen, change the selected
                 * t120 Seconds
                 * \button and increment the delay appropriately.*/
                if (selectedButton != -2)
                {
                    selectedButton += 1;
                }
                timeToTrigger = Time.time + scrollDelay;

                if (selectedButton > finalButton)
                {
                    selectedButton = 0;
                }
            }
            else if (inputInfo.Features.Angle > 45 && Time.time > timeToTrigger)
            {
                if (selectedButton != -2)
                {
                    selectedButton -= 1;
                }
                timeToTrigger = Time.time + scrollDelay;

                if (selectedButton < 0)
                {
                    selectedButton = finalButton;
                }
            }

            //this will need adjusting to be appropriately scaled when we have a kinect to test with
            if (inputInfo.Features.Position.y > 4)
            {
                switch (selectedButton)
                {
                case 0: startGameButton.onClick.Invoke();
                    break;

                case 1: upgradeStoreButton.onClick.Invoke();
                    break;

                case 2: informationScreenButton.onClick.Invoke();
                    selectedButton = -2;
                    break;

                case -2: informationReturnButton.onClick.Invoke();
                    break;
                }
            }
        }
        #endregion

        switch (selectedButton)
        {
        case 0:
            startGameButton.animator.Play("Highlighted");
            upgradeStoreButton.animator.Play("Disabled");
            informationScreenButton.animator.Play("Normal");
            break;

        case 1:
            startGameButton.animator.Play("Normal");
            upgradeStoreButton.animator.Play("Disabled");
            informationScreenButton.animator.Play("Normal");
            break;

        case 2:
            startGameButton.animator.Play("Normal");
            upgradeStoreButton.animator.Play("Disabled");
            informationScreenButton.animator.Play("Highlighted");

            break;

        case -2:
            informationReturnButton.animator.Play("Highlighted");
            break;
        }
    }
Beispiel #6
0
    // Update is called once per frame
    void Update()
    {
        this.transform.Translate(Vector3.up * speed);

        if (playerNo == 1)
        {
            if (debugControls)
            {
                if (Input.GetKey(KeyCode.A))
                {
                    this.transform.eulerAngles = new Vector3(0, 0, this.transform.eulerAngles.z - 5);
                }
                else if (Input.GetKey(KeyCode.D))
                {
                    this.transform.eulerAngles = new Vector3(0, 0, this.transform.eulerAngles.z + 5);
                }
            }

            // Get the input info
            SeatedInfo inputInfo = this.inputController.InputInfo;
            if (inputInfo != null)
            {
                // Set the player position and direction
                if (inputInfo.Features != null)
                {
                    if (inputInfo.Features.Angle > 5)
                    {
                        //this.transform.rotation = new Quaternion(0, 0, this.transform.rotation.z + inputInfo.Features.Angle, 0.1f);
                        this.transform.Rotate(Vector3.back * (inputInfo.Features.Angle / 20));
                    }
                    else if (inputInfo.Features.Angle < -5)
                    {
                        //this.transform.rotation = Quaternion(0, 0, this.transform.rotation.z + inputInfo.Features.Angle, 0.1f);
                        this.transform.Rotate(Vector3.back * (inputInfo.Features.Angle / 20));
                    }
                    //this.transform.rotation = new Quaternion(0, 0, inputInfo.Features.Angle,0);
                    Debug.Log(inputInfo.Features.Angle);
                }
            }
        }

        if (playerNo == 2)
        {
            if (debugControls)
            {
                if (Input.GetKey(KeyCode.J))
                {
                    this.transform.eulerAngles = new Vector3(0, 0, this.transform.eulerAngles.z - 5);
                }
                else if (Input.GetKey(KeyCode.L))
                {
                    this.transform.eulerAngles = new Vector3(0, 0, this.transform.eulerAngles.z + 5);
                }
            }


            if (Input.GetAxis("Joystick Triggers") > 0.05)
            {
                this.transform.Rotate(Vector3.forward * (Input.GetAxis("Joystick Triggers") * 5));
            }
            else if (Input.GetAxis("Joystick Triggers") < -0.05)
            {
                this.transform.Rotate(Vector3.forward * (Input.GetAxis("Joystick Triggers") * 5));
            }
            //Debug.Log(Input.GetAxis("Joystick Triggers"));
        }
    }
Beispiel #7
0
    // Update is called once per frame
    void Update()
    {
        if (canMove == true)
        {
            //this.transform.Translate(Vector3.up * 0.01f);

            if (controllerEnabled == true)
            {
                if (Input.GetAxis("Joystick Triggers") > 0.05)
                {
                    this.transform.Rotate(Vector3.forward * (Input.GetAxis("Joystick Triggers") * 5));
                }
                else if (Input.GetAxis("Joystick Triggers") < -0.05)
                {
                    this.transform.Rotate(Vector3.forward * (Input.GetAxis("Joystick Triggers") * 5));
                }
                //Debug.Log(Input.GetAxis("Joystick Triggers"));
            }

            // Get the input info
            SeatedInfo inputInfo = this.inputController.InputInfo;
            if (inputInfo == null)
            {
                return;
            }

            // Set the player position and direction
            if (inputInfo.Features == null)
            {
                return;
            }

            //Debug.Log (inputInfo.Features.Position);
            //this.transform.position = new Vector3(inputInfo.Features.Position.x, 0, inputInfo.Features.Position.y) * 5;
            //this.transform.forward = new Vector3(inputInfo.Features.Direction.x, 0, inputInfo.Features.Direction.y) * 5;

            if (kinectEnabled == true)
            {
                playerPos = inputInfo.Features.Position;

                if (inputInfo.Features.Angle > 5)
                {
                    //this.transform.rotation = new Quaternion(0, 0, this.transform.rotation.z + inputInfo.Features.Angle, 0.1f);
                    this.transform.Rotate(Vector3.right * (inputInfo.Features.Angle / 20));
                }
                else if (inputInfo.Features.Angle < -5)
                {
                    //this.transform.rotation = Quaternion(0, 0, this.transform.rotation.z + inputInfo.Features.Angle, 0.1f);
                    this.transform.Rotate(Vector3.left * (inputInfo.Features.Angle / 20));
                }

                if (inputInfo.Features.Position.y > playerPos.y + 0.2)
                {
                    //this.transform
                }
                //this.transform.rotation = new Quaternion(0, 0, inputInfo.Features.Angle,0);
                Debug.Log(inputInfo.Features.Angle);
            }



            return;
        }
        else
        {
            this.transform.Translate(0, 0, 0);
        }
    }
Beispiel #8
0
    // Update is called once per frame
    void Update()
    {
        this.GetComponentInChildren <scrPlaceCursor>().SetHands(Input.GetKey(KeyCode.W));
        //if (controllerEnabled == true)
        //{
        //    if (Input.GetAxis("Joystick Triggers") > 0.05)
        //    {
        //        this.transform.Rotate(Vector3.down * (Input.GetAxis("Joystick Triggers") * 5));
        //    }
        //    else if (Input.GetAxis("Joystick Triggers") < -0.05)
        //    {
        //        this.transform.Rotate(Vector3.down * (Input.GetAxis("Joystick Triggers") * 5));
        //    }

        //    if (Input.GetAxis("Joystick Right") > 0.09)
        //    {
        //        this.transform.Translate(0, 0, -0.01f);
        //    }
        //    else if (Input.GetAxis("Joystick Right") < -0.09)
        //    {
        //        this.transform.Translate(0, 0, 0.01f);
        //    }
        //    //Debug.Log(Input.GetAxis("Joystick Triggers"));
        //}



        // Get the input info
        SeatedInfo inputInfo = this.inputController.InputInfo;

        if (inputInfo == null)
        {
            return;
        }

        // Set the player position and direction
        if (inputInfo.Features == null)
        {
            return;
        }

        if (runOnce == true)
        {
            playerPos = inputInfo.Features.Position.y;

            runOnce = false;
        }

        //Debug.Log (inputInfo.Features.Position);
        //this.transform.position = new Vector3(inputInfo.Features.Position.x, 0, inputInfo.Features.Position.y) * 5;
        //this.transform.forward = new Vector3(inputInfo.Features.Direction.x, 0, inputInfo.Features.Direction.y) * 5;

        if (kinectEnabled == true && canMove == true)
        {
            if (inputInfo.Features.Angle > 5)
            {
                //this.transform.rotation = new Quaternion(0, 0, this.transform.rotation.z + inputInfo.Features.Angle, 0.1f);
                //this.transform.Rotate(Vector3.back * (inputInfo.Features.Angle / 20));
                this.transform.Rotate(Vector3.up * Time.deltaTime * 8);
            }
            else if (inputInfo.Features.Angle < -5)
            {
                //this.transform.rotation = Quaternion(0, 0, this.transform.rotation.z + inputInfo.Features.Angle, 0.1f);
                //this.transform.Rotate(Vector3.back * (inputInfo.Features.Angle / 20));
                this.transform.Rotate(Vector3.down * Time.deltaTime * 8);
            }

            //Debug.Log(inputInfo.Features.Position.y);

            if (inputInfo.Features.Position.y > playerPos + 0.09)
            {
                this.transform.Translate(0, 0, -0.01f);
            }
            else if (inputInfo.Features.Position.y < playerPos - 0.09)
            {
                this.transform.Translate(0, 0, 0.01f);
            }

            this.GetComponentInChildren <scrPlaceCursor>().SetHands(inputInfo.Features.DistanceBetweenHands > 0.7);
            //this.transform.rotation = new Quaternion(0, 0, inputInfo.Features.Angle,0);
            //Debug.Log(inputInfo.Features.Angle);

            //this.transform.forward = new Vector3(0, 0, inputInfo.Features.Direction.y) * 5;

            //if (Input.GetAxis("Joystick Right") > 0.05)
            //this.transform.forward = new Vector3(0, 0, inputInfo.Features.Direction.y) * 5;
        }

        if (kinectEnabled == true && canLock == true)
        {
            if (inputInfo.Features.Angle > 5)
            {
                //this.transform.rotation = new Quaternion(0, 0, this.transform.rotation.z + inputInfo.Features.Angle, 0.1f);
                //this.transform.Rotate(Vector3.back * (inputInfo.Features.Angle / 20));
                //if (canRotate)
                //{
                rl.RotateLeft();
                //Debug.Log("Rotating right");
                canRotate = false;
                // }
            }
            else if (inputInfo.Features.Angle < -5)
            {
                //this.transform.rotation = Quaternion(0, 0, this.transform.rotation.z + inputInfo.Features.Angle, 0.1f);
                //this.transform.Rotate(Vector3.back * (inputInfo.Features.Angle / 20));

                //if (canRotate)
                //{
                rl.RotateRight();
                canRotate = false;
                //}
            }
            else if (inputInfo.Features.Angle > -5 && inputInfo.Features.Angle < 5)
            {
                if (!canRotate)
                {
                    canRotate = true;
                }
            }

            if (inputInfo.Features.DistanceBetweenHands > 0.7)
            {
                rl.dialUnlock();
            }
            //this.transform.rotation = new Quaternion(0, 0, inputInfo.Features.Angle,0);
            Debug.Log(inputInfo.Features.Angle);
        }



        return;
    }