Beispiel #1
0
    void DoSwingAction()
    {
        pendulum.balancing_character.velocity += pendulum.balancing_character.velocity.normalized * 2 * Input.GetAxis("RJoystickVertical");


        pendulum.balancing_character.velocity += cam.transform.right * Input.GetAxis("RJoystickHorizontal") * 1.2f;

        transform.localPosition = pendulum.MoveCharacter(transform.localPosition, previousPosition, Time.deltaTime);
        previousPosition        = transform.localPosition;
    }
Beispiel #2
0
    void DoSwingAction()
    {
        /* redo, all aplies very bad
         * if (Input.GetKey(KeyCode.W))
         * {
         *  pendulum.balancing_character.velocity += pendulum.balancing_character.velocity.normalized * 1.2f;
         * }
         * if (Input.GetKey(KeyCode.A))
         * {
         *  pendulum.balancing_character.velocity += -cam.transform.right * 1.2f;
         * }
         * if (Input.GetKey(KeyCode.D))
         * {
         *  pendulum.balancing_character.velocity += cam.transform.right * 1.2f;
         * }*/

        if (Input.GetKey(KeyCode.W))
        {
            pendulum.balancing_character.velocity += transform.forward.normalized * pendulum.balancing_character.impulse;
        }

        if (Input.GetKey(KeyCode.S))
        {
            pendulum.balancing_character.velocity += -transform.forward.normalized * pendulum.balancing_character.impulse;
        }

        if (Input.GetKey(KeyCode.A))
        {
            pendulum.balancing_character.velocity += -transform.right.normalized * pendulum.balancing_character.impulse;
        }
        if (Input.GetKey(KeyCode.D))
        {
            pendulum.balancing_character.velocity += transform.right.normalized * pendulum.balancing_character.impulse;
        }

        transform.localPosition = pendulum.MoveCharacter(transform.localPosition, previousPosition, Time.deltaTime);
        previousPosition        = transform.localPosition;
    }
Beispiel #3
0
 // Update is called once per frame
 void Update()
 {
     transform.localPosition = pendulum.MoveCharacter(transform.localPosition, Time.deltaTime);
 }