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); }
public bool IsSame(ControlDetail control) { return(control.Action == Action && control.Direction == Direction); }