Beispiel #1
0
 /// <summary>
 /// Registers the command name and the associated Action in the DevCommand system,
 /// and also handles gesture detection for the provided GestureType in the
 /// DevCommandGesture system.
 /// </summary>
 public static void Register <GestureType>(string commandName,
                                           Action commandAction)
     where GestureType : IGesture
 {
     DevCommand.Register(commandName, commandAction);
     DevCommandGesturesManager.RegisterCommand <GestureType>(commandName);
 }
Beispiel #2
0
 /// <summary>
 /// Registers the command name and the associated Action in the DevCommand system,
 /// and also handles gesture detection for the provided GestureType in the
 /// DevCommandGesture system. TwoHandedHeldGestures provide position data, so
 /// you can provide a command Action that takes a Vector3 as input.
 /// </summary>
 public static void Register <GestureType>(string commandName,
                                           Action <Vector3> actionWithGesturePosition)
     where GestureType : TwoHandedHeldGesture
 {
     DevCommand.Register(commandName, actionWithGesturePosition);
     DevCommandGesturesManager.RegisterPositionCommand <GestureType>(commandName);
 }
        private static void RuntimeInitializeOnLoad()
        {
            var runnerObj = new GameObject(DEV_COMMANDS_RUNNER_NAME);

            s_instance = runnerObj.AddComponent <DevCommandGesturesManager>();

            // If there were any registered commands before initialization, create them now.
            s_hasOnLoadOccurred = true;
            foreach (var preloadCommandStore in s_preLoadRegisteredCommandsBuffer)
            {
                if (preloadCommandStore.isPositionCommand)
                {
                    RegisterPositionCommand(preloadCommandStore.commandName,
                                            preloadCommandStore.gestureType);
                }
                else
                {
                    RegisterCommand(preloadCommandStore.commandName,
                                    preloadCommandStore.gestureType);
                }
            }
            s_preLoadRegisteredCommandsBuffer.Clear();
        }