コード例 #1
0
        public override void OnEnable()
        {
            base.OnEnable();

            NSTSampleController _target = (NSTSampleController)target;
            bool isRoot = _target.transform.parent == null;

            // If targetPreset == -1 then this has been run before
            if ((int)_target.keyPresets == -1)             //NSTSampleController.NSTControllerPresets.None)
            {
                _target.ApplyPreset(_target.mapping, isRoot ? NSTControllerPresets.FreeController : NSTControllerPresets.Secondary);
            }
            lastSelectedPreset = (int)_target.keyPresets;
        }
コード例 #2
0
        public override void OnInspectorGUI()
        {
            NSTSampleController _target = (NSTSampleController)target;

            // If the preset selection has changed... apply that presets values (unless its Custom ... custom will not overwrite user settings)
            if (lastSelectedPreset != (int)_target.keyPresets && _target.keyPresets != NSTControllerPresets.Custom)
            {
                _target.ApplyPreset(_target.mapping, _target.keyPresets);
            }

            // if there are differences in the input mappings from the preset, switch the selection to Custom so they don't keep getting overwritten.
            else if (_target.keyPresets != NSTControllerPresets.Custom && _target.CompareToPreset(_target.keyPresets) == false)
            {
                _target.keyPresets = NSTControllerPresets.Custom;
            }

            lastSelectedPreset = (int)_target.keyPresets;

            base.OnInspectorGUI();
        }