Esempio n. 1
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Player")
        {
            if (wingDirectionUp == true)
            {
                wingmanTransform.Rotate(axisToRotate, 0, 0);
                windWarningImage.enabled = true;
            }
            else if (wingDirectionRight == true)
            {
                rbWingman.AddForce(Vector3.back * hoverForce, ForceMode.Acceleration);
                windWarningImage.enabled = true;
            }
            else if (wingDirectionOpenUp == true)
            {
                controller.transform.Translate(Vector3.up * 50.0f * Time.deltaTime);
                windWarningImage.enabled = true;
            }
            else if (changeRotation == true)
            {
                isTurning       = true;
                targetRotation *= Quaternion.AngleAxis(axisToRotate, Vector3.right);
            }
            if (changePose == true)
            {
                avGUI.changeStandardPose = true;
                posController.SetPose("Slow n hold", 1.0f);
            }

            //source.PlayOneShot (windSound);
        }
    }
    void VelocityControl()
    {
        if (Input.GetKey(KeyCode.E) && parachuteIsOpened == false)
        {
            posController.SetPose("RightDramatic", 1.0f);
            posController.UpdateSpeed = 2.0f;
        }
        else if (Input.GetKeyUp(KeyCode.E) && parachuteIsOpened == false)
        {
            posController.SetPose("Stop n drop", 1.0f);
            posController.UpdateSpeed = 2.0f;
        }

        if (Input.GetKey(KeyCode.Q) && parachuteIsOpened == false)
        {
            posController.SetPose("LeftDramatic", 1.0f);
            posController.UpdateSpeed = 2.0f;
        }
        else if (Input.GetKeyUp(KeyCode.Q) && parachuteIsOpened == false)
        {
            posController.SetPose("Stop n drop", 1.0f);
            posController.UpdateSpeed = 2.0f;
        }
        if (posController.NewPoseName == "Squeeze")
        {
            suitFrequency         = 220;
            suitMagnitude         = 100;
            motionBlur.blurAmount = 0.83f;
        }
        else
        {
            suitFrequency         = 50f;
            suitMagnitude         = 30f;
            motionBlur.blurAmount = 0.65f;
        }
        if (posController.NewPoseName == "Stop n drop")
        {
            rotationY = 0.0f;
            velocityY = -3.4f;
            velocityZ = 5.0f;
            TimerRecovery();
        }
        else if (posController.NewPoseName == "RightDramatic")
        {
            rotationY     = 16.0f;
            velocityY     = -4.4f;
            velocityZ     = 8.0f;
            suitFrequency = 150;
            TimerRecovery();
        }
        else if (posController.NewPoseName == "LeftDramatic")
        {
            rotationY     = -16.0f;
            velocityY     = -4.4f;
            velocityZ     = 8.0f;
            suitFrequency = 150;
            TimerRecovery();
        }
        else if (posController.NewPoseName == "Slow n hold")
        {
            rotationY = 0.0f;
            velocityY = -3.0f;
            velocityZ = 10.0f;
            TimerRecovery();
        }
        else if (posController.NewPoseName == "Energency stop")
        {
            rotationY = 0.0f;
            velocityY = -10.0f;
            velocityZ = 2.0f;
            TimerRecovery();
        }
        else if (posController.NewPoseName == "Open up")
        {
            rotationY      = 0.0f;
            velocityY      = -4.0f;
            velocityZ      = 9.0f;
            timerToOpenUp -= Time.deltaTime;
            while (true)
            {
                if (timerToOpenUp < 0)
                {
                    timerToOpenUp = 8;
                }
                if (timerToOpenUp < 7.9 && timerToOpenUp > 6.5)
                {
                    velocityY = 3f;
                }
                else
                {
                    velocityY = -3f;
                }

                break;
            }
            if (avGUI.changeStandardPose == true)
            {
                velocityZ = 11.0f;
            }
        }
        else if (posController.NewPoseName == "Down&right")
        {
            rotationY = 0.0f;
            velocityY = -8.0f;
            velocityZ = 10.0f;
            TimerRecovery();
            if (avGUI.changeStandardPose == false)
            {
                velocityZ = 4.0f;
            }
            transform.Translate(Vector3.right * 38.0f * Time.deltaTime);
        }
        else if (posController.NewPoseName == "Down&left")
        {
            rotationY = 0.0f;
            velocityY = -8.0f;
            velocityZ = 10.0f;
            TimerRecovery();
            if (avGUI.changeStandardPose == false)
            {
                velocityZ = 4.0f;
            }
            transform.Translate(Vector3.right * -38.0f * Time.deltaTime);
        }
        else if (posController.NewPoseName == "Up&right")
        {
            rotationY      = 0.0f /** posController.LerpTime*/;
            velocityY      = -2.4f;
            velocityZ      = 10.0f;
            timerToOpenUp -= Time.deltaTime;
            transform.Translate(Vector3.right * 38.0f * Time.deltaTime);
            while (true)
            {
                if (timerToOpenUp < 0)
                {
                    timerToOpenUp = 8;
                }
                if (timerToOpenUp < 7.9 && timerToOpenUp > 6.5)
                {
                    velocityY = 2.4f;
                }
                else
                {
                    velocityY = -3f;
                }

                break;
            }
            if (avGUI.changeStandardPose == false)
            {
                velocityZ = 4.0f;
            }
        }
        else if (posController.NewPoseName == "Up&left")
        {
            rotationY      = 0.0f /** posController.LerpTime*/;
            velocityY      = -2.4f;
            velocityZ      = 10.0f;
            timerToOpenUp -= Time.deltaTime;
            transform.Translate(Vector3.right * -38.0f * Time.deltaTime);

            while (true)
            {
                if (timerToOpenUp < 0)
                {
                    timerToOpenUp = 8;
                }
                if (timerToOpenUp < 7.9 && timerToOpenUp > 6.5)
                {
                    velocityY = 2.4f;
                }
                else
                {
                    velocityY = -3f;
                }

                break;
            }
            if (avGUI.changeStandardPose == false)
            {
                velocityZ = 4.0f;
            }
        }
        else if (posController.NewPoseName == "Squeeze")
        {
            rotationY = 0.0f;
            velocityY = -8.0f;
            velocityZ = 10.0f;
            TimerRecovery();
        }
        else if (posController.NewPoseName == "Proper kinesthetic")
        {
            rotationY = 0.0f;
            velocityY = -4.0f;
            velocityZ = 7.0f;
            TimerRecovery();
        }
        else if (posController.NewPoseName == "Backfly position 1")
        {
            rotationY = 0.0f;
            velocityY = -15.0f;
            velocityZ = 2.0f;
            TimerRecovery();
        }
        else if (posController.NewPoseName == "Backfly position 2")
        {
            rotationY = 0.0f;
            velocityY = -8.0f;
            velocityZ = 2.0f;
            TimerRecovery();
        }
        else if (posController.NewPoseName == "Backfly position 3")
        {
            rotationY = 0.0f;
            velocityY = -7.0f;
            velocityZ = 2.0f;
            TimerRecovery();
        }
        else if (posController.NewPoseName == "Right turn")
        {
            rotationY = 1.0f /** posController.LerpTime*/;
            velocityY = -2.4f;
            velocityZ = 10.0f;
            TimerRecovery();
            transform.Translate(Vector3.right * 45.0f * Time.deltaTime);
            if (avGUI.changeStandardPose == false)
            {
                velocityZ = 4.0f;
            }
        }
        else if (posController.NewPoseName == "Left turn")
        {
            rotationY = -1.0f /** posController.LerpTime*/;
            velocityY = -2.5f;
            velocityZ = 10.0f;
            TimerRecovery();
            transform.Translate(Vector3.right * -45.0f * Time.deltaTime);
            if (avGUI.changeStandardPose == false)
            {
                velocityZ = 4.0f;
            }
        }
        else if (posController.NewPoseName == "From Salto")
        {
            velocityY = -12.6f;
        }
        else if (posController.NewPoseName == "Salto")
        {
            rotationY = 0.0f;
            velocityY = -8.0f;
            velocityZ = 10.0f;
            TimerRecovery();
        }
        else if (posController.NewPoseName == "Rotate left")
        {
            rotationY = -1.5f;
            velocityY = -4.0f;
            velocityZ = 10.0f;
            transform.Translate(Vector3.right * -25.0f * Time.deltaTime);
            TimerRecovery();
        }
        else if (posController.NewPoseName == "Rotate right")
        {
            rotationY = 1.5f;
            velocityY = -4.0f;
            velocityZ = 10.0f;
            transform.Translate(Vector3.right * 25.0f * Time.deltaTime);
            TimerRecovery();
        }
        else if (posController.NewPoseName == "Parachute right")
        {
            transform.Translate(Vector3.right * 18.0f * Time.deltaTime);
        }
        else if (posController.NewPoseName == "Parachute left")
        {
            transform.Translate(Vector3.right * -18.0f * Time.deltaTime);
        }
        else if (posController.NewPoseName == "Open parachute" || (parachuteIsOpened && posController.NewPoseName == "ParachuteDown") || (parachuteIsOpened && posController.NewPoseName == "ParachuteUp") || (parachuteIsOpened && posController.NewPoseName == "Parachute right") || (parachuteIsOpened && posController.NewPoseName == "Parachute left"))
        {
            float horizontal = 0.0f;
            if (isMobilePlatform)
            {
                horizontal = Mathf.Clamp(3.0f * Input.gyro.gravity.x, -1.0f, 1.0f);

                if (Mathf.Abs(horizontal) < 0.3f)
                {
                    horizontal = 0.0f;
                }
            }
            else
            {
                horizontal = Input.GetAxis("Horizontal");
            }
            rotationY = 10.0f * horizontal;
            velocityY = -1.5f;
            velocityZ = 2.0f;
        }
        if (posController.NewPoseName == "ParachuteUp")           // rotacja spadochronu
        {
            angle += Input.GetAxis("Vertical") * 32 * Time.deltaTime;
            angle  = Mathf.Clamp(angle, 0f, 15f);
            parachute.transform.localRotation = Quaternion.AngleAxis(angle + Time.deltaTime, Vector3.right);
        }
        else if (posController.NewPoseName == "ParachuteDown" || posController.NewPoseName == "Open parachute")
        {
            angle -= 22 * Time.deltaTime;
            angle  = Mathf.Clamp(angle, 0f, 15f);
            parachute.transform.localRotation = Quaternion.AngleAxis(-angle + Time.deltaTime, Vector3.left);
        }
    }
Esempio n. 3
0
    void OnPoseChanged(int pose)
    {
        gyro.isActive = false;
        string poseName = posesName [pose];

        if (poseName == "Salto" || poseName == "Rotate left" || poseName == "Rotate right")
        {
            posControlle.UpdateSpeed = 1.5f;            //3.5
        }
        else
        {
            posControlle.UpdateSpeed = 3.0f;            //2.0
        }

        posControlle.SetPose(poseName, 2.0f);         //1.0
    }