Пример #1
0
        public static void CreateMapActivationRules(this Player player)
        {
            ControllerMapEnabler.RuleSet enabledControlsRuleSet = new ControllerMapEnabler.RuleSet()
            {
                enabled = true,
                tag     = k_enabledControlsRuleSetTag,
                rules   = new List <ControllerMapEnabler.Rule>()
            };

            IEnumerable <ControllerMap> allMaps = player.controllers.maps.GetAllMaps();

            foreach (ControllerMap map in allMaps)
            {
                enabledControlsRuleSet.rules.Add(new ControllerMapEnabler.Rule()
                {
                    enable                = map.enabled,
                    categoryId            = map.categoryId,
                    controllerSetSelector = ControllerSetSelector.SelectAll()
                });
            }

            player.controllers.maps.mapEnabler.ruleSets.Clear();
            player.controllers.maps.mapEnabler.ruleSets.Add(enabledControlsRuleSet);
            player.controllers.maps.mapEnabler.Apply();
        }
Пример #2
0
        public static void SetAllControlsActive(this Player player, bool isActive)
        {
            ControllerMapEnabler.RuleSet enabledControlsRuleSet = player.controllers.maps.mapEnabler.ruleSets.Find(
                queryRuleSet => queryRuleSet.tag == k_enabledControlsRuleSetTag
                );

            foreach (ControllerMapEnabler.Rule rule in enabledControlsRuleSet.rules)
            {
                rule.enable = isActive;
            }

            player.controllers.maps.mapEnabler.Apply();
        }