Example #1
0
    public override void Move(CharacterController controller, Transform transform)
    {
        rotateDirection.Set(InputRotateX.SetFloat(), InputRotateY.SetFloat(), InputRotateZ.SetFloat());
        transform.Rotate(rotateDirection);

        moveDirection.Set(InputX.SetFloat(), InputY.SetFloat(), InputZ.SetFloat());         //changed y from InputY.SetFloat()
        if (!controller.isGrounded)
        {
            moveDirection.y -= gravity * Time.deltaTime;
//			Debug.Log("Gravity!" + moveDirection.y);
        }

        moveDirection = transform.TransformDirection(moveDirection);

        if (moveSpeedMultiplier != null)
        {
            moveDirection *= speed * moveSpeedMultiplier.FloatValue;
        }
        else
        {
            moveDirection *= speed;
        }

        if (JumpInput.SetFloat() != 0)
        {
            moveDirection.y = JumpInput.SetFloat();
        }

        //Debug.Log(moveDirection);
        controller.Move(moveDirection * Time.deltaTime);
    }
    public override void Move(CharacterController controller, Transform transform)
    {
        if (controller.isGrounded)
        {
            moveDirection.Set(InputX.SetFloat(), InputY.SetFloat(), InputZ.SetFloat());
            moveDirection = transform.TransformDirection(moveDirection);

            moveDirection *= speed;
            //moveDirection.y = JumpInput.SetFloat();
        }
        moveDirection.y -= gravity * Time.deltaTime;
        controller.Move(moveDirection * Time.deltaTime);
    }
    public void Move(CharacterController controller, Transform transform)
    {
        if (controller.isGrounded)
        {
            moveDirection.x = InputX.SetFloat();
            moveDirection.y = InputY.SetFloat();
            moveDirection.z = InputZ.SetFloat();

            moveDirection  = transform.TransformDirection(moveDirection);
            moveDirection *= speed;
            if (Input.GetButton("Jump"))
            {
                moveDirection.y = jumpSpeed;
            }
        }
        moveDirection.y -= gravity * Time.deltaTime;
        controller.Move(moveDirection * Time.deltaTime);
    }
    public override void Move(CharacterController controller, Transform transform)
    {
        if (!controller.isGrounded)
        {
            moveDirection.y -= gravity * Time.deltaTime;
        }

        rotateDirection.Set(InputRotateX.SetFloat(), InputRotateY.SetFloat(), InputRotateZ.SetFloat());
        transform.Rotate(rotateDirection);

        moveDirection.Set(InputX.SetFloat(), InputY.SetFloat(), InputZ.SetFloat());
        moveDirection = transform.TransformDirection(moveDirection);

        moveDirection *= speed;

        if (JumpInput.SetFloat() != 0)
        {
            moveDirection.y = JumpInput.SetFloat();
        }

        //Debug.Log(moveDirection);
        controller.Move(moveDirection * Time.deltaTime);
    }