Example #1
0
        public static AxisConfiguration CreateMouseAxis(string configuration, string name, int axis, float sensitivity)
        {
            InputConfiguration inputConfig = GetConfiguration(configuration);

            if (inputConfig == null)
            {
                throw new ArgumentException("Unable to find any input configuration named " + configuration);
            }
            if (_instance._axesTable[configuration].ContainsKey(name))
            {
                string error = string.Format("The input configuration named {0} already contains an axis configuration named {1}", configuration, name);
                throw new ArgumentException(error);
            }
            if (axis < 0 || axis > 2)
            {
                throw new ArgumentOutOfRangeException("axis");
            }

            AxisConfiguration axisConfig = new AxisConfiguration(name);

            axisConfig.type        = InputType.MouseAxis;
            axisConfig.axis        = axis;
            axisConfig.sensitivity = sensitivity;
            axisConfig.Initialize();
            inputConfig.axes.Add(axisConfig);

            var table = _instance._axesTable[configuration];

            table.Add(name, axisConfig);

            return(axisConfig);
        }
Example #2
0
        public static AxisConfiguration CreateRemoteAxis(string inputConfigName, string axisName)
        {
            InputConfiguration inputConfig = GetInputConfiguration(inputConfigName);

            if (inputConfig == null)
            {
                Debug.LogError(string.Format("An input configuration named \'{0}\' does not exist", inputConfigName));
                return(null);
            }
            if (_instance._axesTable[inputConfigName].ContainsKey(axisName))
            {
                Debug.LogError(string.Format("The input configuration named {0} already contains an axis configuration named {1}", inputConfigName, axisName));
                return(null);
            }

            AxisConfiguration axisConfig = new AxisConfiguration(axisName);

            axisConfig.type        = InputType.RemoteAxis;
            axisConfig.positive    = KeyCode.None;
            axisConfig.negative    = KeyCode.None;
            axisConfig.altPositive = KeyCode.None;
            axisConfig.altNegative = KeyCode.None;
            axisConfig.Initialize();
            inputConfig.axes.Add(axisConfig);

            var table = _instance._axesTable[inputConfigName];

            table.Add(axisName, axisConfig);

            return(axisConfig);
        }
Example #3
0
        public static AxisConfiguration CreateEmptyAxis(string configuration, string name)
        {
            InputConfiguration inputConfig = GetConfiguration(configuration);

            if (inputConfig == null)
            {
                throw new ArgumentException("Unable to find any input configuration named " + configuration);
            }
            if (_instance._axesTable[configuration].ContainsKey(name))
            {
                string error = string.Format("The input configuration named {0} already contains an axis configuration named {1}", configuration, name);
                throw new ArgumentException(error);
            }

            AxisConfiguration axisConfig = new AxisConfiguration(name);

            axisConfig.Initialize();
            inputConfig.axes.Add(axisConfig);

            var table = _instance._axesTable[configuration];

            table.Add(name, axisConfig);

            return(axisConfig);
        }
Example #4
0
        public static AxisConfiguration CreateEmptyAxis(string inputConfigName, string axisName)
        {
            InputConfiguration inputConfig = GetInputConfiguration(inputConfigName);

            if (inputConfig == null)
            {
                throw new ArgumentException(string.Format("An input configuration named \'{0}\' does not exist", inputConfigName));
            }
            if (_instance._axesTable[inputConfigName].ContainsKey(axisName))
            {
                string error = string.Format("The input configuration named {0} already contains an axis configuration named {1}", inputConfigName, axisName);
                throw new ArgumentException(error);
            }

            AxisConfiguration axisConfig = new AxisConfiguration(axisName);

            axisConfig.Initialize();
            inputConfig.axes.Add(axisConfig);

            var table = _instance._axesTable[inputConfigName];

            table.Add(axisName, axisConfig);

            return(axisConfig);
        }
Example #5
0
        public static AxisConfiguration CreateMouseAxis(string inputConfigName, string axisName, int axis, float sensitivity)
        {
            InputConfiguration inputConfig = GetInputConfiguration(inputConfigName);

            if (inputConfig == null)
            {
                Debug.LogError(string.Format("An input configuration named \'{0}\' does not exist", inputConfigName));
                return(null);
            }
            if (_instance._axesTable[inputConfigName].ContainsKey(axisName))
            {
                Debug.LogError(string.Format("The input configuration named {0} already contains an axis configuration named {1}", inputConfigName, axisName));
                return(null);
            }
            if (axis < 0 || axis > 2)
            {
                Debug.LogError("Mouse axis is out of range. Cannot create new mouse axis.");
                return(null);
            }

            AxisConfiguration axisConfig = new AxisConfiguration(axisName);

            axisConfig.type        = InputType.MouseAxis;
            axisConfig.axis        = axis;
            axisConfig.sensitivity = sensitivity;
            axisConfig.Initialize();
            inputConfig.axes.Add(axisConfig);

            var table = _instance._axesTable[inputConfigName];

            table.Add(axisName, axisConfig);

            return(axisConfig);
        }
Example #6
0
        public static AxisConfiguration CreateRemoteButton(string inputConfigName, string buttonName)
        {
            InputConfiguration inputConfig = GetInputConfiguration(inputConfigName);

            if (inputConfig == null)
            {
                throw new ArgumentException(string.Format("An input configuration named \'{0}\' does not exist", inputConfigName));
            }
            if (_instance._axesTable[inputConfigName].ContainsKey(buttonName))
            {
                string error = string.Format("The input configuration named {0} already contains an axis configuration named {1}", inputConfigName, buttonName);
                throw new ArgumentException(error);
            }

            AxisConfiguration axisConfig = new AxisConfiguration(buttonName);

            axisConfig.type        = InputType.RemoteButton;
            axisConfig.positive    = KeyCode.None;
            axisConfig.negative    = KeyCode.None;
            axisConfig.altPositive = KeyCode.None;
            axisConfig.altNegative = KeyCode.None;
            axisConfig.Initialize();
            inputConfig.axes.Add(axisConfig);

            var table = _instance._axesTable[inputConfigName];

            table.Add(buttonName, axisConfig);

            return(axisConfig);
        }
Example #7
0
        public static AxisConfiguration CreateButton(string inputConfigName, string buttonName, KeyCode primaryKey, KeyCode secondaryKey)
        {
            InputConfiguration inputConfig = GetInputConfiguration(inputConfigName);

            if (inputConfig == null)
            {
                Debug.LogError(string.Format("An input configuration named \'{0}\' does not exist", inputConfigName));
                return(null);
            }
            if (_instance._axesTable[inputConfigName].ContainsKey(buttonName))
            {
                Debug.LogError(string.Format("The input configuration named {0} already contains an axis configuration named {1}", inputConfigName, buttonName));
                return(null);
            }

            AxisConfiguration axisConfig = new AxisConfiguration(buttonName);

            axisConfig.type        = InputType.Button;
            axisConfig.positive    = primaryKey;
            axisConfig.altPositive = secondaryKey;
            axisConfig.Initialize();
            inputConfig.axes.Add(axisConfig);

            var table = _instance._axesTable[inputConfigName];

            table.Add(buttonName, axisConfig);

            return(axisConfig);
        }
Example #8
0
        public static AxisConfiguration CreateMouseAxis(string inputConfigName, string axisName, int axis, float sensitivity)
        {
            InputConfiguration inputConfig = GetInputConfiguration(inputConfigName);

            if (inputConfig == null)
            {
                throw new ArgumentException(string.Format("An input configuration named \'{0}\' does not exist", inputConfigName));
            }
            if (_instance._axesTable[inputConfigName].ContainsKey(axisName))
            {
                string error = string.Format("The input configuration named {0} already contains an axis configuration named {1}", inputConfigName, axisName);
                throw new ArgumentException(error);
            }
            if (axis < 0 || axis > 2)
            {
                throw new ArgumentOutOfRangeException("axis");
            }

            AxisConfiguration axisConfig = new AxisConfiguration(axisName);

            axisConfig.type        = InputType.MouseAxis;
            axisConfig.axis        = axis;
            axisConfig.sensitivity = sensitivity;
            axisConfig.Initialize();
            inputConfig.axes.Add(axisConfig);

            var table = _instance._axesTable[inputConfigName];

            table.Add(axisName, axisConfig);

            return(axisConfig);
        }
Example #9
0
        public static AxisConfiguration CreateDigitalAxis(string inputConfigName, string axisName, KeyCode positive, KeyCode negative,
                                                          KeyCode altPositive, KeyCode altNegative, float gravity, float sensitivity)
        {
            InputConfiguration inputConfig = GetInputConfiguration(inputConfigName);

            if (inputConfig == null)
            {
                throw new ArgumentException(string.Format("An input configuration named \'{0}\' does not exist", inputConfigName));
            }
            if (_instance._axesTable[inputConfigName].ContainsKey(axisName))
            {
                string error = string.Format("The input configuration named {0} already contains an axis configuration named {1}", inputConfigName, axisName);
                throw new ArgumentException(error);
            }

            AxisConfiguration axisConfig = new AxisConfiguration(axisName);

            axisConfig.type        = InputType.DigitalAxis;
            axisConfig.positive    = positive;
            axisConfig.negative    = negative;
            axisConfig.altPositive = altPositive;
            axisConfig.altNegative = altNegative;
            axisConfig.gravity     = gravity;
            axisConfig.sensitivity = sensitivity;
            axisConfig.Initialize();
            inputConfig.axes.Add(axisConfig);

            var table = _instance._axesTable[inputConfigName];

            table.Add(axisName, axisConfig);

            return(axisConfig);
        }
Example #10
0
        public static AxisConfiguration CreateButton(string configuration, string name, KeyCode primaryKey, KeyCode secondaryKey)
        {
            InputConfiguration inputConfig = GetConfiguration(configuration);

            if (inputConfig == null)
            {
                throw new ArgumentException("Unable to find any input configuration named " + configuration);
            }
            if (_instance._axesTable[configuration].ContainsKey(name))
            {
                string error = string.Format("The input configuration named {0} already contains an axis configuration named {1}", configuration, name);
                throw new ArgumentException(error);
            }

            AxisConfiguration axisConfig = new AxisConfiguration(name);

            axisConfig.type        = InputType.Button;
            axisConfig.positive    = primaryKey;
            axisConfig.altPositive = secondaryKey;
            axisConfig.Initialize();
            inputConfig.axes.Add(axisConfig);

            var table = _instance._axesTable[configuration];

            table.Add(name, axisConfig);

            return(axisConfig);
        }
Example #11
0
        public static AxisConfiguration CreateDigitalAxis(string configuration, string name, KeyCode positive, KeyCode negative,
                                                          KeyCode altPositive, KeyCode altNegative, float gravity, float sensitivity)
        {
            InputConfiguration inputConfig = GetConfiguration(configuration);

            if (inputConfig == null)
            {
                throw new ArgumentException("Unable to find any input configuration named " + configuration);
            }
            if (_instance._axesTable[configuration].ContainsKey(name))
            {
                string error = string.Format("The input configuration named {0} already contains an axis configuration named {1}", configuration, name);
                throw new ArgumentException(error);
            }

            AxisConfiguration axisConfig = new AxisConfiguration(name);

            axisConfig.type        = InputType.DigitalAxis;
            axisConfig.positive    = positive;
            axisConfig.negative    = negative;
            axisConfig.altPositive = altPositive;
            axisConfig.altNegative = altNegative;
            axisConfig.gravity     = gravity;
            axisConfig.sensitivity = sensitivity;
            axisConfig.Initialize();
            inputConfig.axes.Add(axisConfig);

            var table = _instance._axesTable[configuration];

            table.Add(name, axisConfig);

            return(axisConfig);
        }
Example #12
0
        /// <summary>
        /// If an button with the requested name exists, and it is of type 'RemoteButton', the button's state will be changed.
        /// </summary>
        public static void SetRemoteButtonValue(string inputConfigName, string buttonName, bool down, bool justChanged)
        {
            AxisConfiguration axisConfig = GetAxisConfiguration(inputConfigName, buttonName);

            if (axisConfig == null)
            {
                throw new ArgumentException(string.Format("A remote button named \'{0}\' does not exist in the input configuration named \'{1}\'", buttonName, inputConfigName));
            }

            axisConfig.SetRemoteButtonValue(down, justChanged);
        }
Example #13
0
        public static bool GetButtonUp(string name)
        {
            AxisConfiguration axisConfig = GetAxisConfiguration(_instance._currentConfiguration.name, name);

            if (axisConfig == null)
            {
                throw new ArgumentException(string.Format("An button named \'{0}\' does not exist in the active input configuration", name));
            }

            return(axisConfig.GetButtonUp());
        }
Example #14
0
        /// <summary>
        /// If an axis with the requested name exists, and it is of type 'RemoteAxis', the axis' value will be changed.
        /// </summary>
        public static void SetRemoteAxisValue(string inputConfigName, string axisName, float value)
        {
            AxisConfiguration axisConfig = GetAxisConfiguration(inputConfigName, axisName);

            if (axisConfig == null)
            {
                throw new ArgumentException(string.Format("An axis named \'{0}\' does not exist in the input configuration named \'{1}\'", axisName, inputConfigName));
            }

            axisConfig.SetRemoteAxisValue(value);
        }
Example #15
0
        private bool AllowMoveEventProcessing(float time)
        {
            string            inputConfigName = InputManager.CurrentConfiguration.name;
            AxisConfiguration hAxisConfig     = InputManager.GetAxisConfiguration(inputConfigName, m_HorizontalAxis);
            AxisConfiguration vAxisConfig     = InputManager.GetAxisConfiguration(inputConfigName, m_VerticalAxis);

            bool allow = hAxisConfig.AnyKeyDown;

            allow |= vAxisConfig.AnyKeyDown;
            allow |= (time > m_NextAction);
            return(allow);
        }
Example #16
0
        public static float GetAxisRaw(string name)
        {
            AxisConfiguration axisConfig = GetAxisConfiguration(name);

            if (axisConfig == null)
            {
                string error = "The active input configuration doesn't contain an axis named " + name;
                throw new ArgumentException(error);
            }

            return(axisConfig.GetAxisRaw());
        }
Example #17
0
        public static bool GetButtonUp(string name)
        {
            AxisConfiguration axisConfig = GetAxisConfiguration(name);

            if (axisConfig == null)
            {
                string error = "The active input configuration doesn't contain a button named " + name;
                throw new ArgumentException(error);
            }

            return(axisConfig.GetButtonUp());
        }
Example #18
0
        /// <summary>
        /// If an axis with the requested name exists, and it is of type 'RemoteAxis', the axis' value will be changed.
        /// </summary>
        public static void SetRemoteAxisValue(string inputConfigName, string axisName, float value)
        {
            AxisConfiguration axisConfig = GetAxisConfiguration(inputConfigName, axisName);

            if (axisConfig != null)
            {
                axisConfig.SetRemoteAxisValue(value);
            }
            else
            {
                Debug.LogError(string.Format("An axis named \'{0}\' does not exist in the input configuration named \'{1}\'", axisName, inputConfigName));
            }
        }
Example #19
0
        /// <summary>
        /// If an button with the requested name exists, and it is of type 'RemoteButton', the button's state will be changed.
        /// </summary>
        public static void SetRemoteButtonValue(string inputConfigName, string buttonName, bool down, bool justChanged)
        {
            AxisConfiguration axisConfig = GetAxisConfiguration(inputConfigName, buttonName);

            if (axisConfig != null)
            {
                axisConfig.SetRemoteButtonValue(down, justChanged);
            }
            else
            {
                Debug.LogError(string.Format("A remote button named \'{0}\' does not exist in the input configuration named \'{1}\'", buttonName, inputConfigName));
            }
        }
Example #20
0
        public static bool DeleteAxisConfiguration(string inputConfigName, string axisName)
        {
            InputConfiguration inputConfig = GetInputConfiguration(inputConfigName);
            AxisConfiguration  axisConfig  = GetAxisConfiguration(inputConfigName, axisName);

            if (inputConfig != null && axisConfig != null)
            {
                _instance._axesTable[inputConfig.name].Remove(axisConfig.name);
                inputConfig.axes.Remove(axisConfig);
                return(true);
            }

            return(false);
        }
        public static bool GetButtonUp(string name, PlayerID playerID = PlayerID.One)
        {
            AxisConfiguration axisConfig = GetAxisConfiguration(playerID, name);

            if (axisConfig != null)
            {
                return(axisConfig.GetButtonUp());
            }
            else
            {
                Debug.LogError(string.Format("An button named \'{0}\' does not exist in the active input configuration for player {1}", name, playerID));
                return(false);
            }
        }
Example #22
0
        public static InputConfiguration Duplicate(InputConfiguration source)
        {
            InputConfiguration inputConfig = new InputConfiguration();

            inputConfig.name = source.name;

            inputConfig.axes = new List <AxisConfiguration>(source.axes.Count);
            for (int i = 0; i < source.axes.Count; i++)
            {
                inputConfig.axes.Add(AxisConfiguration.Duplicate(source.axes[i]));
            }

            return(inputConfig);
        }
        public static float GetAxisRaw(string name, PlayerID playerID = PlayerID.One)
        {
            AxisConfiguration axisConfig = GetAxisConfiguration(playerID, name);

            if (axisConfig != null)
            {
                return(axisConfig.GetAxisRaw());
            }
            else
            {
                Debug.LogError(string.Format("An axis named \'{0}\' does not exist in the active input configuration for player {1}", name, playerID));
                return(0.0f);
            }
        }
Example #24
0
 public void Copy(AxisConfiguration source)
 {
     name        = source.name;
     description = source.description;
     positive    = source.positive;
     altPositive = source.altPositive;
     negative    = source.negative;
     altNegative = source.altNegative;
     deadZone    = source.deadZone;
     gravity     = source.gravity;
     sensitivity = source.sensitivity;
     snap        = source.snap;
     invert      = source.invert;
     type        = source.type;
     axis        = source.axis;
     joystick    = source.joystick;
 }
Example #25
0
        public static AxisConfiguration CreateAnalogButton(string inputConfigName, string buttonName, int joystick, int axis)
        {
            InputConfiguration inputConfig = GetInputConfiguration(inputConfigName);

            if (inputConfig == null)
            {
                Debug.LogError(string.Format("An input configuration named \'{0}\' does not exist", inputConfigName));
                return(null);
            }
            if (_instance._axesTable[inputConfigName].ContainsKey(buttonName))
            {
                Debug.LogError(string.Format("The input configuration named {0} already contains an axis configuration named {1}", inputConfigName, buttonName));
                return(null);
            }
            if (axis < 0 || axis >= AxisConfiguration.MaxJoystickAxes)
            {
                Debug.LogError("Joystick axis is out of range. Cannot create new analog button.");
                return(null);
            }
            if (joystick < 0 || joystick >= AxisConfiguration.MaxJoysticks)
            {
                Debug.LogError("Joystick is out of range. Cannot create new analog button.");
                return(null);
            }

            AxisConfiguration axisConfig = new AxisConfiguration(buttonName);

            axisConfig.type        = InputType.AnalogButton;
            axisConfig.joystick    = joystick;
            axisConfig.axis        = axis;
            axisConfig.positive    = KeyCode.None;
            axisConfig.negative    = KeyCode.None;
            axisConfig.altPositive = KeyCode.None;
            axisConfig.altNegative = KeyCode.None;
            axisConfig.Initialize();
            inputConfig.axes.Add(axisConfig);

            var table = _instance._axesTable[inputConfigName];

            table.Add(buttonName, axisConfig);

            return(axisConfig);
        }
Example #26
0
        private void WriteAxisConfiguration(AxisConfiguration axisConfig, XmlWriter writer)
        {
            writer.WriteStartElement("AxisConfiguration");
            writer.WriteAttributeString("name", axisConfig.name);
            writer.WriteElementString("description", axisConfig.description);
            writer.WriteElementString("positive", axisConfig.positive.ToString());
            writer.WriteElementString("altPositive", axisConfig.altPositive.ToString());
            writer.WriteElementString("negative", axisConfig.negative.ToString());
            writer.WriteElementString("altNegative", axisConfig.altNegative.ToString());
            writer.WriteElementString("deadZone", axisConfig.deadZone.ToString());
            writer.WriteElementString("gravity", axisConfig.gravity.ToString());
            writer.WriteElementString("sensitivity", axisConfig.sensitivity.ToString());
            writer.WriteElementString("snap", axisConfig.snap.ToString().ToLower());
            writer.WriteElementString("invert", axisConfig.invert.ToString().ToLower());
            writer.WriteElementString("type", axisConfig.type.ToString());
            writer.WriteElementString("axis", axisConfig.axis.ToString());
            writer.WriteElementString("joystick", axisConfig.joystick.ToString());

            writer.WriteEndElement();
        }
Example #27
0
        public static AxisConfiguration CreateAnalogAxis(string inputConfigName, string axisName, int joystick, int axis, float sensitivity, float deadZone)
        {
            InputConfiguration inputConfig = GetInputConfiguration(inputConfigName);

            if (inputConfig == null)
            {
                Debug.LogError(string.Format("An input configuration named \'{0}\' does not exist", inputConfigName));
                return(null);
            }
            if (_instance._axesTable[inputConfigName].ContainsKey(axisName))
            {
                Debug.LogError(string.Format("The input configuration named {0} already contains an axis configuration named {1}", inputConfigName, axisName));
                return(null);
            }
            if (axis < 0 || axis >= AxisConfiguration.MaxJoystickAxes)
            {
                Debug.LogError("Joystick axis is out of range. Cannot create new analog axis.");
                return(null);
            }
            if (joystick < 0 || joystick >= AxisConfiguration.MaxJoysticks)
            {
                Debug.LogError("Joystick is out of range. Cannot create new analog axis.");
                return(null);
            }

            AxisConfiguration axisConfig = new AxisConfiguration(axisName);

            axisConfig.type        = InputType.AnalogAxis;
            axisConfig.axis        = axis;
            axisConfig.joystick    = joystick;
            axisConfig.deadZone    = deadZone;
            axisConfig.sensitivity = sensitivity;
            axisConfig.Initialize();
            inputConfig.axes.Add(axisConfig);

            var table = _instance._axesTable[inputConfigName];

            table.Add(axisName, axisConfig);

            return(axisConfig);
        }
Example #28
0
        public static AxisConfiguration Duplicate(AxisConfiguration source)
        {
            AxisConfiguration axisConfig = new AxisConfiguration();

            axisConfig.name        = source.name;
            axisConfig.description = source.description;
            axisConfig.positive    = source.positive;
            axisConfig.altPositive = source.altPositive;
            axisConfig.negative    = source.negative;
            axisConfig.altNegative = source.altNegative;
            axisConfig.deadZone    = source.deadZone;
            axisConfig.gravity     = source.gravity;
            axisConfig.sensitivity = source.sensitivity;
            axisConfig.snap        = source.snap;
            axisConfig.invert      = source.invert;
            axisConfig.type        = source.type;
            axisConfig.axis        = source.axis;
            axisConfig.joystick    = source.joystick;

            return(axisConfig);
        }
Example #29
0
        public static AxisConfiguration CreateAnalogButton(string inputConfigName, string buttonName, int joystick, int axis)
        {
            InputConfiguration inputConfig = GetInputConfiguration(inputConfigName);

            if (inputConfig == null)
            {
                throw new ArgumentException(string.Format("An input configuration named \'{0}\' does not exist", inputConfigName));
            }
            if (_instance._axesTable[inputConfigName].ContainsKey(buttonName))
            {
                string error = string.Format("The input configuration named {0} already contains an axis configuration named {1}", inputConfigName, buttonName);
                throw new ArgumentException(error);
            }
            if (axis < 0 || axis >= AxisConfiguration.MaxJoystickAxes)
            {
                throw new ArgumentOutOfRangeException("axis");
            }
            if (joystick < 0 || joystick >= AxisConfiguration.MaxJoysticks)
            {
                throw new ArgumentOutOfRangeException("joystick");
            }

            AxisConfiguration axisConfig = new AxisConfiguration(buttonName);

            axisConfig.type        = InputType.AnalogButton;
            axisConfig.joystick    = joystick;
            axisConfig.axis        = axis;
            axisConfig.positive    = KeyCode.None;
            axisConfig.negative    = KeyCode.None;
            axisConfig.altPositive = KeyCode.None;
            axisConfig.altNegative = KeyCode.None;
            axisConfig.Initialize();
            inputConfig.axes.Add(axisConfig);

            var table = _instance._axesTable[inputConfigName];

            table.Add(buttonName, axisConfig);

            return(axisConfig);
        }
        public static AxisConfiguration CreateAnalogButton(string inputConfigName, string buttonName, int joystick, int axis)
        {
            InputConfiguration inputConfig = GetInputConfiguration (inputConfigName);
            if (inputConfig == null) {
                throw new ArgumentException (string.Format ("An input configuration named \'{0}\' does not exist", inputConfigName));
            }
            if (_instance._axesTable [inputConfigName].ContainsKey (buttonName)) {
                string error = string.Format ("The input configuration named {0} already contains an axis configuration named {1}", inputConfigName, buttonName);
                throw new ArgumentException (error);
            }
            if (axis < 0 || axis >= AxisConfiguration.MaxJoystickAxes)
                throw new ArgumentOutOfRangeException ("axis");
            if (joystick < 0 || joystick >= AxisConfiguration.MaxJoysticks)
                throw new ArgumentOutOfRangeException ("joystick");

            AxisConfiguration axisConfig = new AxisConfiguration (buttonName);
            axisConfig.type = InputType.AnalogButton;
            axisConfig.joystick = joystick;
            axisConfig.axis = axis;
            axisConfig.positive = KeyCode.None;
            axisConfig.negative = KeyCode.None;
            axisConfig.altPositive = KeyCode.None;
            axisConfig.altNegative = KeyCode.None;
            axisConfig.Initialize ();
            inputConfig.axes.Add (axisConfig);

            var table = _instance._axesTable [inputConfigName];
            table.Add (buttonName, axisConfig);

            return axisConfig;
        }
 public void Copy(AxisConfiguration source)
 {
     name = source.name;
     description = source.description;
     positive = source.positive;
     altPositive = source.altPositive;
     negative = source.negative;
     altNegative = source.altNegative;
     deadZone = source.deadZone;
     gravity = source.gravity;
     sensitivity = source.sensitivity;
     snap = source.snap;
     invert = source.invert;
     type = source.type;
     axis = source.axis;
     joystick = source.joystick;
 }
        public static AxisConfiguration Duplicate(AxisConfiguration source)
        {
            AxisConfiguration axisConfig = new AxisConfiguration();
            axisConfig.name = source.name;
            axisConfig.description = source.description;
            axisConfig.positive = source.positive;
            axisConfig.altPositive = source.altPositive;
            axisConfig.negative = source.negative;
            axisConfig.altNegative = source.altNegative;
            axisConfig.deadZone = source.deadZone;
            axisConfig.gravity = source.gravity;
            axisConfig.sensitivity = source.sensitivity;
            axisConfig.snap = source.snap;
            axisConfig.invert = source.invert;
            axisConfig.type = source.type;
            axisConfig.axis = source.axis;
            axisConfig.joystick = source.joystick;

            return axisConfig;
        }
 private void InitializeAxisConfig()
 {
     m_axisConfig = InputManager.GetAxisConfiguration(m_inputConfigName, m_axisConfigName);
     if (m_axisConfig != null) {
         if (m_rebindType == RebindType.Keyboard || m_rebindType == RebindType.GamepadButton) {
             if (m_changePositiveKey) {
                 if (m_changeAltKey)
                     m_keyDescription.text = m_axisConfig.altPositive == KeyCode.None ? "" : m_axisConfig.altPositive.ToString();
                 else
                     m_keyDescription.text = m_axisConfig.positive == KeyCode.None ? "" : m_axisConfig.positive.ToString();
             }
             else {
                 if (m_changeAltKey)
                     m_keyDescription.text = m_axisConfig.altNegative == KeyCode.None ? "" : m_axisConfig.altNegative.ToString();
                 else
                     m_keyDescription.text = m_axisConfig.negative == KeyCode.None ? "" : m_axisConfig.negative.ToString();
             }
         }
         else {
             m_keyDescription.text = m_axisNames[m_axisConfig.axis];
         }
     }
     else {
         m_keyDescription.text = "";
         Debug.LogError(string.Format(@"Input configuration '{0}' does not exist or axis '{1}' does not exist", m_inputConfigName, m_axisConfigName));
     }
 }
        private void DisplayAxisConfigurationFields(InputConfiguration inputConfigx, AxisConfiguration axisConfig, Rect screenRect)
        {
            GUIContent gravityInfo = new GUIContent("Gravity", "The speed(in units/sec) at which a digital axis falls towards neutral.");
            GUIContent sensitivityInfo = new GUIContent("Sensitivity", "The speed(in units/sec) at which an axis moves towards the target value.");
            GUIContent snapInfo = new GUIContent("Snap", "If input switches direction, do we snap to neutral and continue from there? For digital axes only.");
            GUIContent deadZoneInfo = new GUIContent("Dead Zone", "Size of analog dead zone. Values within this range map to neutral.");

            GUILayout.BeginArea(screenRect);
            _mainPanelScrollPos = GUILayout.BeginScrollView(_mainPanelScrollPos);
            axisConfig.name = EditorGUILayout.TextField("Name", axisConfig.name);
            axisConfig.description = EditorGUILayout.TextField("Description", axisConfig.description);

            //	Positive Key
            EditorToolbox.KeyCodeField(ref _keyString, ref _editingPositiveKey, "Positive",
                                       "editor_positive_key", axisConfig.positive);
            ProcessKeyString(ref axisConfig.positive, ref _editingPositiveKey);
            //	Negative Key
            EditorToolbox.KeyCodeField(ref _keyString, ref _editingNegativeKey, "Negative",
                                       "editor_negative_key", axisConfig.negative);
            ProcessKeyString(ref axisConfig.negative, ref _editingNegativeKey);
            //	Alt Positive Key
            EditorToolbox.KeyCodeField(ref _keyString, ref _editingAltPositiveKey, "Alt Positive",
                                       "editor_alt_positive_key", axisConfig.altPositive);
            ProcessKeyString(ref axisConfig.altPositive, ref _editingAltPositiveKey);
            //	Alt Negative key
            EditorToolbox.KeyCodeField(ref _keyString, ref _editingAltNegativeKey, "Alt Negative",
                                       "editor_alt_negative_key", axisConfig.altNegative);
            ProcessKeyString(ref axisConfig.altNegative, ref _editingAltNegativeKey);

            axisConfig.gravity = EditorGUILayout.FloatField(gravityInfo, axisConfig.gravity);
            axisConfig.deadZone = EditorGUILayout.FloatField(deadZoneInfo, axisConfig.deadZone);
            axisConfig.sensitivity = EditorGUILayout.FloatField(sensitivityInfo, axisConfig.sensitivity);
            axisConfig.snap = EditorGUILayout.Toggle(snapInfo, axisConfig.snap);
            axisConfig.invert = EditorGUILayout.Toggle("Invert", axisConfig.invert);
            axisConfig.type = (InputType)EditorGUILayout.EnumPopup("Type", axisConfig.type);
            axisConfig.axis = EditorGUILayout.Popup("Axis", axisConfig.axis, _axisOptions);
            axisConfig.joystick = EditorGUILayout.Popup("Joystick", axisConfig.joystick, _joystickOptions);

            if(EditorApplication.isPlaying)
            {
                EditorGUILayout.Space();
                GUI.enabled = false;
                EditorGUILayout.FloatField("Raw Axis", axisConfig.GetAxisRaw());
                EditorGUILayout.FloatField("Axis", axisConfig.GetAxis());
                EditorGUILayout.Toggle("Button", axisConfig.GetButton());
                GUI.enabled = true;
            }

            GUILayout.EndScrollView();
            GUILayout.EndArea();
        }
        private void ImportSelectedMapping()
        {
            if(_configurator == null)
            {
                EditorUtility.DisplayDialog("Error", "Unable to import joystick mapping. Did you close the advanced input editor?", "Close");
                return;
            }

            InputConfiguration inputConfig = new InputConfiguration(_mappings[_selection].Name.Replace(' ', '_'));
            foreach(AxisMapping am in _mappings[_selection])
            {
                if(am.ScanType == MappingWizard.ScanType.Button)
                {
                    AxisConfiguration axisConfig = new AxisConfiguration(am.Name);
                    axisConfig.type = InputType.Button;
                    axisConfig.positive = am.Key;
                    inputConfig.axes.Add(axisConfig);
                }
                else
                {
                    if(am.JoystickAxis < 0 || am.JoystickAxis >= AxisConfiguration.MaxJoystickAxes)
                    {
                        Debug.LogError("Joystick axis is out of range. Cannot import axis configuration: " + am.Name);
                        continue;
                    }

                    AxisConfiguration axisConfig = new AxisConfiguration(am.Name);
                    axisConfig.type = InputType.AnalogAxis;
                    axisConfig.axis = am.JoystickAxis;
                    axisConfig.joystick = 0;
                    axisConfig.deadZone = 0.0f;
                    axisConfig.sensitivity = 1.0f;
                    inputConfig.axes.Add(axisConfig);
                }
            }

            _configurator.AddInputConfiguration(inputConfig);
        }
        public static AxisConfiguration CreateMouseAxis(string inputConfigName, string axisName, int axis, float sensitivity)
        {
            InputConfiguration inputConfig = GetInputConfiguration (inputConfigName);
            if (inputConfig == null) {
                throw new ArgumentException (string.Format ("An input configuration named \'{0}\' does not exist", inputConfigName));
            }
            if (_instance._axesTable [inputConfigName].ContainsKey (axisName)) {
                string error = string.Format ("The input configuration named {0} already contains an axis configuration named {1}", inputConfigName, axisName);
                throw new ArgumentException (error);
            }
            if (axis < 0 || axis > 2)
                throw new ArgumentOutOfRangeException ("axis");

            AxisConfiguration axisConfig = new AxisConfiguration (axisName);
            axisConfig.type = InputType.MouseAxis;
            axisConfig.axis = axis;
            axisConfig.sensitivity = sensitivity;
            axisConfig.Initialize ();
            inputConfig.axes.Add (axisConfig);

            var table = _instance._axesTable [inputConfigName];
            table.Add (axisName, axisConfig);

            return axisConfig;
        }
Example #37
0
		private void WriteAxisConfiguration(AxisConfiguration axisConfig, XmlWriter writer)
		{
			writer.WriteStartElement("AxisConfiguration");
			writer.WriteAttributeString("name", axisConfig.name);
			writer.WriteElementString("description", axisConfig.description);
			writer.WriteElementString("positive", axisConfig.positive.ToString());
			writer.WriteElementString("altPositive", axisConfig.altPositive.ToString());
			writer.WriteElementString("negative", axisConfig.negative.ToString());
			writer.WriteElementString("altNegative", axisConfig.altNegative.ToString());
			writer.WriteElementString("deadZone", axisConfig.deadZone.ToString());
			writer.WriteElementString("gravity", axisConfig.gravity.ToString());
			writer.WriteElementString("sensitivity", axisConfig.sensitivity.ToString());
			writer.WriteElementString("snap", axisConfig.snap.ToString().ToLower());
			writer.WriteElementString("invert", axisConfig.invert.ToString().ToLower());
			writer.WriteElementString("type", axisConfig.type.ToString());
			writer.WriteElementString("axis", axisConfig.axis.ToString());
			writer.WriteElementString("joystick", axisConfig.joystick.ToString());
			
			writer.WriteEndElement();
		}
		public static AxisConfiguration CreateMouseAxis(string inputConfigName, string axisName, int axis, float sensitivity)
		{
			InputConfiguration inputConfig = GetInputConfiguration(inputConfigName);
			if(inputConfig == null)
			{
				Debug.LogError(string.Format("An input configuration named \'{0}\' does not exist", inputConfigName));
				return null;
			}
			if(_instance._axesTable[inputConfigName].ContainsKey(axisName))
			{
				Debug.LogError(string.Format("The input configuration named {0} already contains an axis configuration named {1}", inputConfigName, axisName));
				return null;
			}
			if(axis < 0 || axis > 2)
			{
				Debug.LogError("Mouse axis is out of range. Cannot create new mouse axis.");
				return null;
			}
			
			AxisConfiguration axisConfig = new AxisConfiguration(axisName);
			axisConfig.type = InputType.MouseAxis;
			axisConfig.axis = axis;
			axisConfig.sensitivity = sensitivity;
			axisConfig.Initialize();
			inputConfig.axes.Add(axisConfig);
			
			var table = _instance._axesTable[inputConfigName];
			table.Add(axisName, axisConfig);
			
			return axisConfig;
		}
		public static AxisConfiguration CreateAnalogAxis(string inputConfigName, string axisName, int joystick, int axis, float sensitivity, float deadZone)
		{
			InputConfiguration inputConfig = GetInputConfiguration(inputConfigName);
			if(inputConfig == null)
			{
				Debug.LogError(string.Format("An input configuration named \'{0}\' does not exist", inputConfigName));
				return null;
			}
			if(_instance._axesTable[inputConfigName].ContainsKey(axisName))
			{
				Debug.LogError(string.Format("The input configuration named {0} already contains an axis configuration named {1}", inputConfigName, axisName));
				return null;
			}
			if(axis < 0 || axis >= AxisConfiguration.MaxJoystickAxes)
			{
				Debug.LogError("Joystick axis is out of range. Cannot create new analog axis.");
				return null;
			}
			if(joystick < 0 || joystick >= AxisConfiguration.MaxJoysticks)
			{
				Debug.LogError("Joystick is out of range. Cannot create new analog axis.");
				return null;
			}
			
			AxisConfiguration axisConfig = new AxisConfiguration(axisName);
			axisConfig.type = InputType.AnalogAxis;
			axisConfig.axis = axis;
			axisConfig.joystick = joystick;
			axisConfig.deadZone = deadZone;
			axisConfig.sensitivity = sensitivity;
			axisConfig.Initialize();
			inputConfig.axes.Add(axisConfig);
			
			var table = _instance._axesTable[inputConfigName];
			table.Add(axisName, axisConfig);
			
			return axisConfig;
		}
		public static AxisConfiguration CreateRemoteAxis(string inputConfigName, string axisName)
		{
			InputConfiguration inputConfig = GetInputConfiguration(inputConfigName);
			if(inputConfig == null)
			{
				Debug.LogError(string.Format("An input configuration named \'{0}\' does not exist", inputConfigName));
				return null;
			}
			if(_instance._axesTable[inputConfigName].ContainsKey(axisName))
			{
				Debug.LogError(string.Format("The input configuration named {0} already contains an axis configuration named {1}", inputConfigName, axisName));
				return null;
			}
			
			AxisConfiguration axisConfig = new AxisConfiguration(axisName);
			axisConfig.type = InputType.RemoteAxis;
			axisConfig.positive = KeyCode.None;
			axisConfig.negative = KeyCode.None;
			axisConfig.altPositive = KeyCode.None;
			axisConfig.altNegative = KeyCode.None;
			axisConfig.Initialize();
			inputConfig.axes.Add(axisConfig);
			
			var table = _instance._axesTable[inputConfigName];
			table.Add(axisName, axisConfig);
			
			return axisConfig;
		}
		public static AxisConfiguration CreateAnalogButton(string inputConfigName, string buttonName, int joystick, int axis)
		{
			InputConfiguration inputConfig = GetInputConfiguration(inputConfigName);
			if(inputConfig == null)
			{
				Debug.LogError(string.Format("An input configuration named \'{0}\' does not exist", inputConfigName));
				return null;
			}
			if(_instance._axesTable[inputConfigName].ContainsKey(buttonName))
			{
				Debug.LogError(string.Format("The input configuration named {0} already contains an axis configuration named {1}", inputConfigName, buttonName));
				return null;
			}
			if(axis < 0 || axis >= AxisConfiguration.MaxJoystickAxes)
			{
				Debug.LogError("Joystick axis is out of range. Cannot create new analog button.");
				return null;
			}
			if(joystick < 0 || joystick >= AxisConfiguration.MaxJoysticks)
			{
				Debug.LogError("Joystick is out of range. Cannot create new analog button.");
				return null;
			}
			
			AxisConfiguration axisConfig = new AxisConfiguration(buttonName);
			axisConfig.type = InputType.AnalogButton;
			axisConfig.joystick = joystick;
			axisConfig.axis = axis;
			axisConfig.positive = KeyCode.None;
			axisConfig.negative = KeyCode.None;
			axisConfig.altPositive = KeyCode.None;
			axisConfig.altNegative = KeyCode.None;
			axisConfig.Initialize();
			inputConfig.axes.Add(axisConfig);
			
			var table = _instance._axesTable[inputConfigName];
			table.Add(buttonName, axisConfig);
			
			return axisConfig;
		}
Example #42
0
		private AxisConfiguration ReadAxisConfiguration(XmlReader reader)
		{
			AxisConfiguration axisConfig = new AxisConfiguration();
			axisConfig.name = reader["name"];
			
			bool endOfAxis = false;
			while(reader.Read() && reader.IsStartElement() && !endOfAxis)
			{
				switch(reader.LocalName)
				{
				case "description":
					axisConfig.description = reader.IsEmptyElement ? string.Empty : reader.ReadElementContentAsString();
					break;
				case "positive":
					axisConfig.positive = AxisConfiguration.StringToKey(reader.ReadElementContentAsString());
					break;
				case "altPositive":
					axisConfig.altPositive = AxisConfiguration.StringToKey(reader.ReadElementContentAsString());
					break;
				case "negative":
					axisConfig.negative = AxisConfiguration.StringToKey(reader.ReadElementContentAsString());
					break;
				case "altNegative":
					axisConfig.altNegative = AxisConfiguration.StringToKey(reader.ReadElementContentAsString());
					break;
				case "deadZone":
					axisConfig.deadZone = reader.ReadElementContentAsFloat();
					break;
				case "gravity":
					axisConfig.gravity = reader.ReadElementContentAsFloat();
					break;
				case "sensitivity":
					axisConfig.sensitivity = reader.ReadElementContentAsFloat();
					break;
				case "snap":
					axisConfig.snap = reader.ReadElementContentAsBoolean();
					break;
				case "invert":
					axisConfig.invert = reader.ReadElementContentAsBoolean();
					break;
				case "type":
					axisConfig.type = AxisConfiguration.StringToInputType(reader.ReadElementContentAsString());
					break;
				case "axis":
					axisConfig.axis = reader.ReadElementContentAsInt();
					break;
				case "joystick":
					axisConfig.joystick = reader.ReadElementContentAsInt();
					break;
				default:
					endOfAxis = true;
					break;
				}
			}
			
			return axisConfig;
		}
        public static AxisConfiguration CreateDigitalAxis(string inputConfigName, string axisName, KeyCode positive, KeyCode negative,
                                                          KeyCode altPositive, KeyCode altNegative, float gravity, float sensitivity)
        {
            InputConfiguration inputConfig = GetInputConfiguration (inputConfigName);
            if (inputConfig == null) {
                throw new ArgumentException (string.Format ("An input configuration named \'{0}\' does not exist", inputConfigName));
            }
            if (_instance._axesTable [inputConfigName].ContainsKey (axisName)) {
                string error = string.Format ("The input configuration named {0} already contains an axis configuration named {1}", inputConfigName, axisName);
                throw new ArgumentException (error);
            }

            AxisConfiguration axisConfig = new AxisConfiguration (axisName);
            axisConfig.type = InputType.DigitalAxis;
            axisConfig.positive = positive;
            axisConfig.negative = negative;
            axisConfig.altPositive = altPositive;
            axisConfig.altNegative = altNegative;
            axisConfig.gravity = gravity;
            axisConfig.sensitivity = sensitivity;
            axisConfig.Initialize ();
            inputConfig.axes.Add (axisConfig);

            var table = _instance._axesTable [inputConfigName];
            table.Add (axisName, axisConfig);

            return axisConfig;
        }
        public static AxisConfiguration CreateEmptyAxis(string inputConfigName, string axisName)
        {
            InputConfiguration inputConfig = GetInputConfiguration (inputConfigName);
            if (inputConfig == null) {
                throw new ArgumentException (string.Format ("An input configuration named \'{0}\' does not exist", inputConfigName));
            }
            if (_instance._axesTable [inputConfigName].ContainsKey (axisName)) {
                string error = string.Format ("The input configuration named {0} already contains an axis configuration named {1}", inputConfigName, axisName);
                throw new ArgumentException (error);
            }

            AxisConfiguration axisConfig = new AxisConfiguration (axisName);
            axisConfig.Initialize ();
            inputConfig.axes.Add (axisConfig);

            var table = _instance._axesTable [inputConfigName];
            table.Add (axisName, axisConfig);

            return axisConfig;
        }
		public static AxisConfiguration CreateButton(string inputConfigName, string buttonName, KeyCode primaryKey, KeyCode secondaryKey)
		{
			InputConfiguration inputConfig = GetInputConfiguration(inputConfigName);
			if(inputConfig == null)
			{
				Debug.LogError(string.Format("An input configuration named \'{0}\' does not exist", inputConfigName));
				return null;
			}
			if(_instance._axesTable[inputConfigName].ContainsKey(buttonName))
			{
				Debug.LogError(string.Format("The input configuration named {0} already contains an axis configuration named {1}", inputConfigName, buttonName));
				return null;
			}
			
			AxisConfiguration axisConfig = new AxisConfiguration(buttonName);
			axisConfig.type = InputType.Button;
			axisConfig.positive = primaryKey;
			axisConfig.altPositive = secondaryKey;
			axisConfig.Initialize();
			inputConfig.axes.Add(axisConfig);
			
			var table = _instance._axesTable[inputConfigName];
			table.Add(buttonName, axisConfig);
			
			return axisConfig;
		}
        public static AxisConfiguration CreateRemoteButton(string inputConfigName, string buttonName)
        {
            InputConfiguration inputConfig = GetInputConfiguration (inputConfigName);
            if (inputConfig == null) {
                throw new ArgumentException (string.Format ("An input configuration named \'{0}\' does not exist", inputConfigName));
            }
            if (_instance._axesTable [inputConfigName].ContainsKey (buttonName)) {
                string error = string.Format ("The input configuration named {0} already contains an axis configuration named {1}", inputConfigName, buttonName);
                throw new ArgumentException (error);
            }

            AxisConfiguration axisConfig = new AxisConfiguration (buttonName);
            axisConfig.type = InputType.RemoteButton;
            axisConfig.positive = KeyCode.None;
            axisConfig.negative = KeyCode.None;
            axisConfig.altPositive = KeyCode.None;
            axisConfig.altNegative = KeyCode.None;
            axisConfig.Initialize ();
            inputConfig.axes.Add (axisConfig);

            var table = _instance._axesTable [inputConfigName];
            table.Add (buttonName, axisConfig);

            return axisConfig;
        }
        private void Dispose()
        {
            if(!_isDisposed)
            {
                IsOpen = false;
                Texture2D.DestroyImmediate(_highlightTexture);
                _highlightTexture = null;
                _copySource = null;

                EditorApplication.playmodeStateChanged -= HandlePlayModeChanged;
                _isDisposed = true;
            }
        }
        private void CopySelectedAxisConfig()
        {
            if(_copySource == null)
                _copySource = new AxisConfiguration();

            InputConfiguration inputConfig = _inputManager.inputConfigurations[_selectionPath[0]];
            AxisConfiguration axisConfig = inputConfig.axes[_selectionPath[1]];
            _copySource.Copy(axisConfig);
        }
Example #49
0
        private AxisConfiguration ReadAxisConfiguration(XmlReader reader)
        {
            AxisConfiguration axisConfig = new AxisConfiguration();

            axisConfig.name = reader["name"];

            bool endOfAxis = false;

            while (reader.Read() && reader.IsStartElement() && !endOfAxis)
            {
                switch (reader.LocalName)
                {
                case "description":
                    axisConfig.description = reader.IsEmptyElement ? string.Empty : reader.ReadElementContentAsString();
                    break;

                case "positive":
                    axisConfig.positive = AxisConfiguration.StringToKey(reader.ReadElementContentAsString());
                    break;

                case "altPositive":
                    axisConfig.altPositive = AxisConfiguration.StringToKey(reader.ReadElementContentAsString());
                    break;

                case "negative":
                    axisConfig.negative = AxisConfiguration.StringToKey(reader.ReadElementContentAsString());
                    break;

                case "altNegative":
                    axisConfig.altNegative = AxisConfiguration.StringToKey(reader.ReadElementContentAsString());
                    break;

                case "deadZone":
                    axisConfig.deadZone = reader.ReadElementContentAsFloat();
                    break;

                case "gravity":
                    axisConfig.gravity = reader.ReadElementContentAsFloat();
                    break;

                case "sensitivity":
                    axisConfig.sensitivity = reader.ReadElementContentAsFloat();
                    break;

                case "snap":
                    axisConfig.snap = reader.ReadElementContentAsBoolean();
                    break;

                case "invert":
                    axisConfig.invert = reader.ReadElementContentAsBoolean();
                    break;

                case "type":
                    axisConfig.type = AxisConfiguration.StringToInputType(reader.ReadElementContentAsString());
                    break;

                case "axis":
                    axisConfig.axis = reader.ReadElementContentAsInt();
                    break;

                case "joystick":
                    axisConfig.joystick = reader.ReadElementContentAsInt();
                    break;

                default:
                    endOfAxis = true;
                    break;
                }
            }

            return(axisConfig);
        }
 private void OnDestroy()
 {
     IsOpen = false;
     Texture2D.DestroyImmediate(_highlightTexture);
     _highlightTexture = null;
     _copySource = null;
 }
		private void OnDisable()
		{
			IsOpen = false;
			Texture2D.DestroyImmediate(_highlightTexture);
			_highlightTexture = null;
			_copySource = null;
			
			EditorApplication.playmodeStateChanged -= HandlePlayModeChanged;
		}