// Update is called once per frame
    void Update()
    {
        //updates controller inputs
        ControllerPluginWrapper.UpdateControllers();

        //resets player movement when stick is not being used
        direction.Set(0, 0, 0);
        lookDirection.Set(0, 0, 0);

        //gets the x and y values from the controller analog sticks
        if (!ControllerPluginWrapper.LStick_InDeadZone(0))
        {
            direction.x = ControllerPluginWrapper.LeftStick_X(0);
            direction.z = ControllerPluginWrapper.LeftStick_Y(0);
        }

        if (!ControllerPluginWrapper.RStick_InDeadZone(0))
        {
            lookDirection.x = ControllerPluginWrapper.RightStick_X(0);
            lookDirection.z = ControllerPluginWrapper.RightStick_Y(0);
        }

        //equations for movement and rotation
        player.transform.Translate(direction * speed * Time.deltaTime);
        player.transform.Rotate(upVector * lookDirection.x * rotationSpeed);
        camera.transform.Rotate(rightVector * -lookDirection.z * rotationSpeed);

        //save controller states as previous actions for next frame
        ControllerPluginWrapper.RefreshStates();
    }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        ControllerPluginWrapper.UpdateControllers();

        if (!initiated)
        {
            initiate();
        }

        if ((previousHealth != info.getHealth()) && (info.getHealth() > 0))
        {