Exemplo n.º 1
0
    void Update()
    {
        //=================No Player Movement==============
        float xMov = Input.GetAxisRaw("Horizontal");
        //float zMov = Input.GetAxisRaw("Vertical");
        Vector3 movHorizontal = transform.right * xMov;
        Vector3 m_velocity    = movHorizontal.normalized * speed;

        engine.Move(m_velocity);
        //=================No Player Movement==============

        //Calculate Horizontal Rotation
        //float xRotation = Input.GetAxisRaw("Mouse X");

        //Vector3 m_rotation = new Vector3(0f, xRotation, 0f) * lookSensitivity;
        //Call rotate
        //engine.Rotate(m_rotation);


        //Calculate Vertical Rotation
        //float yRotation = Input.GetAxisRaw("Mouse Y");

        //Vector3 cameraRotation = new Vector3(yRotation, 0f, 0f) * lookSensitivity;

        //Call rotate
        //engine.RotateCamera(cameraRotation);
    }
Exemplo n.º 2
0
    void Update()
    {
        gameObject.GetComponent <Rigidbody>().angularVelocity = new Vector3(0, 0, 0);
        Vector3 movHorizontal = this.transform.right * input.xMov();
        Vector3 movVertical   = this.transform.forward * input.zMov();
        Vector3 _velocity     = (movHorizontal + movVertical).normalized * speed;

        float   _cameraRotationX = input.xRot() * sensitivity;
        Vector3 _rotation        = new Vector3(0f, input.yRot(), 0f) * sensitivity;
        Vector3 _jumpUp          = ((this.transform.up) * input.jump()) * jumpForce;

        _shooting = input.shoot() != 0;
        moving    = input.zMov() != 0 || input.xMov() != 0;
        if (moving)
        {
            speed += 0.5f;
        }
        else if (!moving)
        {
            speed = engine.Approach(speed, 0f, 20 * Time.deltaTime);
        }
        speed = Mathf.Clamp(speed, -5, 5);

        engine.Shoot(_shooting);
        engine.Move(_velocity);
        engine.Jump(_jumpUp);
        engine.Rotate(_rotation);
        engine.RotateCamera(_cameraRotationX);
        //print(_shooting);
    }
Exemplo n.º 3
0
    void Update()
    {
        //=================No Player Movement==============
        float xMov = Input.GetAxisRaw("Horizontal");

        if (xMov == 0)
        {
            GameObject.Find("GameEngine").GetComponent <gameEngine>().startStress = false;
        }
        else
        {
            GameObject.Find("GameEngine").GetComponent <gameEngine>().startStress = true;
        }
        //float zMov = Input.GetAxisRaw("Vertical");
        Vector3 movHorizontal = transform.right * xMov;
        Vector3 m_velocity    = movHorizontal.normalized * speed;

        engine.Move(m_velocity);
        //=================No Player Movement==============

        //Calculate Horizontal Rotation
        //float xRotation = Input.GetAxisRaw("Mouse X");

        //Vector3 m_rotation = new Vector3(0f, xRotation, 0f) * lookSensitivity;
        //Call rotate
        //engine.Rotate(m_rotation);


        //Calculate Vertical Rotation
        //float yRotation = Input.GetAxisRaw("Mouse Y");

        //Vector3 cameraRotation = new Vector3(yRotation, 0f, 0f) * lookSensitivity;

        //Call rotate
        //engine.RotateCamera(cameraRotation);
    }