private void Awake() { if (Instance == null) { Instance = this; } else { Debug.Log("There's too many Drag Movement Instances!"); Destroy(this); } }
public void Init() { if (PlayerPrefs.HasKey("ControlType")) { _moveInputType = (InputType)System.Enum.Parse(typeof(InputType), PlayerPrefs.GetString("ControlType")); } if (PlayerPrefs.HasKey("Sensitivity")) { _sensivity = PlayerPrefs.GetFloat("Sensitivity"); } switch (_moveInputType) { case InputType.Keyboard: _moveInput = new KeyboradMoveInput(); break; case InputType.Mouse: _moveInput = new MouseMoveInput(_transform); break; case InputType.DragMovement: DragMovement.Activate(); _moveInput = (IMoveInput)DragMovement.Instance; break; case InputType.FloatingJoystick: FloatingJoystick.Activate(); _moveInput = (IMoveInput)FloatingJoystick.Instance; break; case InputType.FixedJoystick: FixedJoystick.Activate(); _moveInput = (IMoveInput)FixedJoystick.Instance; break; } PlayerPrefs.SetString("InputType", _moveInputType.ToString()); }