Exemplo n.º 1
0
        /// <summary>
        /// ゲームパッドのプロパティを作成
        /// </summary>
        /// <param name="name"></param>
        /// <param name="gravity"></param>
        /// <param name="dead"></param>
        /// <param name="sensitivity"></param>
        /// <param name="snap"></param>
        /// <param name="invert"></param>
        /// <param name="axis"></param>
        /// <param name="joyNum_"></param>
        /// <returns></returns>
        public static InputProperty CreateGamePadProperty(string name, float gravity, float dead, float sensitivity, bool snap, bool invert, int axis, int joyNum_)
        {
            InputProperty inputProperty = new InputProperty
            {
                name        = name,
                gravity     = gravity,
                dead        = dead,
                sensitivity = sensitivity,
                invert      = invert,
                type        = Type.JoystickAxis,
                axis        = axis,
                joyNum      = joyNum_,
            };

            return(inputProperty);
        }
Exemplo n.º 2
0
        /// <summary>
        ///  設定プロパティの追加
        /// </summary>
        public void AddInputProperty(InputProperty inputProperty)
        {
            axesProperty.arraySize++;
            inputObject.ApplyModifiedProperties();

            SerializedProperty property = axesProperty.GetArrayElementAtIndex(axesProperty.arraySize - 1);

            GetNextProperty(property, "m_Name").stringValue                  = inputProperty.name;
            GetNextProperty(property, "descriptiveName").stringValue         = inputProperty.descriptiveName;
            GetNextProperty(property, "descriptiveNegativeName").stringValue = inputProperty.descriptiveNegativeName;
            GetNextProperty(property, "negativeButton").stringValue          = inputProperty.negativeButton;
            GetNextProperty(property, "positiveButton").stringValue          = inputProperty.positiveButton;
            GetNextProperty(property, "altNegativeButton").stringValue       = inputProperty.altNegativeButton;
            GetNextProperty(property, "altPositiveButton").stringValue       = inputProperty.altPositiveButton;
            GetNextProperty(property, "gravity").floatValue                  = inputProperty.gravity;
            GetNextProperty(property, "dead").floatValue        = inputProperty.dead;
            GetNextProperty(property, "sensitivity").floatValue = inputProperty.sensitivity;
            GetNextProperty(property, "snap").boolValue         = inputProperty.snap;
            GetNextProperty(property, "invert").boolValue       = inputProperty.invert;
            GetNextProperty(property, "type").intValue          = (int)inputProperty.type;
            GetNextProperty(property, "axis").intValue          = inputProperty.axis - 1;
            GetNextProperty(property, "joyNum").intValue        = inputProperty.joyNum;
        }