コード例 #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
ファイル: ControlSequence.cs プロジェクト: SardineFish/LD43
 public bool IsSame(ControlDetail control)
 {
     return(control.Action == Action && control.Direction == Direction);
 }