Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Joystick/JoystickScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,37 @@ public class JoystickScript : MonoBehaviour, IDragHandler, IPointerUpHandler, IP
Image handleImage;
Color originalColor;

public enum JoystickModeEnum { Fixed, Dynamic, Following };
enum JoystickModeEnum { Fixed, Dynamic, Following };
[Tooltip("Fixed: It doesn't move. " +
"\nDynamic: Every time the joystick area is pressed, the joystick position is set on the touched position. " +
"\nFollowing: If the finger moves outside the joystick background, the joystick follows it.")]
public JoystickModeEnum joystickMode = JoystickModeEnum.Fixed;
JoystickModeEnum joystickMode = JoystickModeEnum.Fixed;

public enum VectorModeEnum { Real, Normal };
enum VectorModeEnum { Real, Normal };
[Tooltip("Real: the output is a vector with magnitude beetween 0 and 1." +
"\nNormal: the output is normalized.")]
public VectorModeEnum vectorMode = VectorModeEnum.Real;
[SerializeField] VectorModeEnum vectorMode = VectorModeEnum.Real;

[Tooltip("Color of the Handle when it's pressed.")]
public Color pressedColor = new Color(0.5f, 0.5f, 0.5f, 0.7f);
[SerializeField] Color pressedColor = new Color(0.5f, 0.5f, 0.5f, 0.7f);

[Tooltip("If the handle is inside this range, in proportion to the background size, the output is zero.")]
[Range(0f, 0.5f)]
public float deadZone = 0.2f;
[SerializeField] float deadZone = 0.2f;

[Tooltip("The max distance of the handle, in proportion to the background size.")]
[Range(0.5f, 2f)]
public float clampZone = 1f;
[SerializeField] float clampZone = 1f;

[Header("directional joystick")]

[Tooltip("Number of directions of the joystick. \nKeep at 0 for a free joystick.")]
[Range(0, 12)]
public int directions = 0;
[SerializeField] int directions = 0;

[Tooltip("Angle, in degrees, of the simmetry of the directions.")]
[Range(-180f, 180f)]
public float simmetryAngle = 90f;
[SerializeField] float simmetryAngle = 90f;

public bool IsWorking { get; private set; } = false;
public Vector2 Output { get; private set; } = Vector2.zero;
Expand Down