示例#1
0
    void Update()
    {
        InputHandleUtilities.UpdateInput();
        float dt = Time.deltaTime;

        characterController.Update(dt);
    }
示例#2
0
    protected virtual Vector2 MoveInput()
    {
        KeyCode lastInput    = InputHandleUtilities.GetLastInput();
        Vector2 moveVelocity = Vector2.zero;

        switch (lastInput)
        {
        case KeyCode.UpArrow:
            controller.SetCurrentFacing(Facing.UP);
            moveVelocity.y = 1;
            break;

        case KeyCode.DownArrow:
            controller.SetCurrentFacing(Facing.DOWN);
            moveVelocity.y = -1;
            break;

        case KeyCode.RightArrow:
            controller.SetCurrentFacing(Facing.RIGHT);
            moveVelocity.x = 1;
            break;

        case KeyCode.LeftArrow:
            controller.SetCurrentFacing(Facing.LEFT);
            moveVelocity.x = -1;
            break;
        }
        return(moveVelocity);
    }