예제 #1
0
    public override ControlDetail GetControl()
    {
        var axis    = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
        var control = new ControlDetail()
        {
            Direction = axis.x, Tick = GameSystem.Instance.Tick
        };

        if (JumpKeys.Any(key => Input.GetKey(key)))
        {
            control.Action = PlayerAction.Jump;
        }
        else if (Mathf.Approximately(axis.x, 0))
        {
            control.Action = PlayerAction.Idle;
        }
        else if (RunKey.Any(key => Input.GetKey(key)))
        {
            control.Action = PlayerAction.Run;
        }
        else
        {
            control.Action = PlayerAction.Move;
        }
        return(control);
    }
예제 #2
0
 public bool IsSame(ControlDetail control)
 {
     return(control.Action == Action && control.Direction == Direction);
 }