Exemplo n.º 1
0
 /// <summary>
 /// Enables action and arugment triggers for the given reaction field of the input reaction component.
 /// </summary>
 /// <param name="inputReactionComponent">Reaction component that should have all triggers enabled.</param>
 /// <param name="fieldIdxToEnable">Index of the field whose triggers should become enabled.</param>
 private static void EnableAllTriggers(MobileInputReaction inputReactionComponent, int fieldIdxToEnable)
 {
     inputReactionComponent.reactionFieldsUsingActions.Add(fieldIdxToEnable);
     inputReactionComponent.reactionFieldsUsingArguments.Add(fieldIdxToEnable);
     inputReactionComponent.useActionTriggerContainer.Add(fieldIdxToEnable, true);
     inputReactionComponent.useArgumentTriggerContainer.Add(fieldIdxToEnable, true);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Adds all loaded triggers from the resources to the first field of the reaction component.
        /// </summary>
        /// <param name="inputReactionComponent">Reaction component that should have all triggers added to it.</param>
        /// <param name="fieldIdxToAddTo">Index of the field the triggers should be added to.</param>
        private static void AddAllTriggersToReactionComponent(MobileInputReaction inputReactionComponent, int fieldIdxToAddTo)
        {
            var loadedArgumentTriggers = Resources.LoadAll <InputArgsTrigger>("MobileInputTrigger/ArgumentTriggers");

            foreach (var inputTrigger in loadedArgumentTriggers)
            {
                inputReactionComponent.inputReactionFields[fieldIdxToAddTo].inputArgumentTriggers.Add(inputTrigger);
            }

            var loadedActionTriggers = Resources.LoadAll <InputActionTrigger>("MobileInputTrigger/ActionTriggers");

            foreach (var inputTrigger in loadedActionTriggers)
            {
                inputReactionComponent.inputReactionFields[fieldIdxToAddTo].inputActionTriggers.Add(inputTrigger);
            }
        }