public static ActionMapInput Create(ActionMap actionMap)
        {
            ActionMapInput map =
                (ActionMapInput)Activator.CreateInstance(actionMap.mapType, new object[] { actionMap });

            return(map);
        }
        protected ActionMapInput(ActionMap actionMap)
        {
            autoReinitialize = true;
            m_ActionMap      = actionMap;
            ResetControlSchemes();

            // Create list of controls from ActionMap.
            var controls = new List <InputControl>();

            for (int i = 0; i < actionMap.actions.Count; i++)
            {
                var action  = actionMap.actions[i];
                var control = (InputControl)Activator.CreateInstance(action.controlType);
                control.name = action.name;
                controls.Add(control);
            }
            SetControls(controls);

            m_SelfBindings = new InputBinding[actionMap.actions.Count];
            for (int i = 0; i < actionMap.actions.Count; i++)
            {
                if (actionMap.actions[i].combined)
                {
                    m_SelfBindings[i] = (InputBinding)(actionMap.actions[i].selfBinding.Clone());
                    m_SelfBindings[i].Initialize(this);
                }
            }
        }
Exemplo n.º 3
0
 public ActionMapInput GetActions(ActionMap actionMap)
 {
     // If already contains ActionMapInput based on this ActionMap, return that.
     for (int i = 0; i < maps.Count; i++)
     {
         if (maps[i].actionMap == actionMap)
         {
             return(maps[i]);
         }
     }
     return(null);
 }
Exemplo n.º 4
0
 public ControlScheme(string name, ActionMap actionMap)
 {
     m_Name      = name;
     m_ActionMap = actionMap;
 }