Ejemplo n.º 1
0
		/// <summary>
		/// 	Gets the axes info.
		/// </summary>
		/// <param name="output">Output.</param>
		public static void GetAxesInfo(ref AxisInfo[] output)
		{
			Object inputManager = AssetDatabase.LoadAllAssetsAtPath(INPUT_MANAGER_PATH)[0];

			SerializedObject serialized = new SerializedObject(inputManager);
			SerializedProperty axisArray = serialized.FindProperty(AXES_ARRAY_NAME);

			Array.Resize(ref output, axisArray.arraySize);

			for (int index = 0; index < axisArray.arraySize; index++)
			{
				SerializedProperty axis = axisArray.GetArrayElementAtIndex(index);

				string name = axis.FindPropertyRelative(AXIS_NAME).stringValue;
				int axisVal = axis.FindPropertyRelative(AXIS_AXIS).intValue;
				AxisInfo.InputType inputType = (AxisInfo.InputType)axis.FindPropertyRelative(AXIS_TYPE).intValue;

				output[index] = new AxisInfo(name, axisVal, inputType);
			}
		}
Ejemplo n.º 2
0
        /// <summary>
        ///     Gets the axes info.
        /// </summary>
        /// <param name="output">Output.</param>
        public static void GetAxesInfo(ref AxisInfo[] output)
        {
            Object inputManager = AssetDatabase.LoadAllAssetsAtPath(INPUT_MANAGER_PATH)[0];

            SerializedObject   serialized = new SerializedObject(inputManager);
            SerializedProperty axisArray  = serialized.FindProperty(AXES_ARRAY_NAME);

            Array.Resize(ref output, axisArray.arraySize);

            for (int index = 0; index < axisArray.arraySize; index++)
            {
                SerializedProperty axis = axisArray.GetArrayElementAtIndex(index);

                string             name      = axis.FindPropertyRelative(AXIS_NAME).stringValue;
                int                axisVal   = axis.FindPropertyRelative(AXIS_AXIS).intValue;
                AxisInfo.InputType inputType = (AxisInfo.InputType)axis.FindPropertyRelative(AXIS_TYPE).intValue;

                output[index] = new AxisInfo(name, axisVal, inputType);
            }
        }