Represents the intent of a controller input in a ControlScheme. This class uses the Flyweight pattern. You create instances by calling ControlIntent.GetIntent(name). If an intent instance already exists with the given name, it is returned, otherwise a new one is created and returned.
예제 #1
0
        /// <summary>
        /// Get the intent with the given name if it exists, otherwise create it and return it.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static ControlIntent GetIntent(string name)
        {
            if (Intents.ContainsKey(name))
                return Intents[name];

            var intent = new ControlIntent(name);
            Intents.Add(name, intent);

            return intent;
        }
예제 #2
0
        /// <summary>
        /// Get the intent with the given name if it exists, otherwise create it and return it.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static ControlIntent GetIntent(string name)
        {
            if (Intents.ContainsKey(name))
            {
                return(Intents[name]);
            }

            var intent = new ControlIntent(name);

            Intents.Add(name, intent);

            return(intent);
        }