Exemple #1
0
 internal void RegisterSubsystem(Subsystem system)
 {
     if (system != null)
     {
         m_subsystems.Add(system);
     }
 }
Exemple #2
0
 /// <summary>
 /// Checks if the command requires the given <see cref="Subsystem"/>.
 /// </summary>
 /// <param name="system">The system</param>
 /// <returns>Whether or not the subsystem is required, or false if given null.</returns>
 public bool DoesRequire(Subsystem system)
 {
     lock (m_syncRoot)
     {
         return m_requirements?.Contains(system) ?? false;
     }
 }
 public AttributedMockCommand(Subsystem subsystem)
 {
     m_subsystem = subsystem;
 }
Exemple #4
0
        /// <summary>
        /// This method specifies that the given <see cref="Subsystem"/> is used by this command.
        /// </summary><remarks>
        /// This method is crucial to the functioning of the Command System in general.
        /// <para> </para>
        /// Note that the recommended way to call this method is in the constructor.
        /// </remarks>
        /// <param name="subsystem">The <see cref="Subsystem"/> required</param>
        /// <exception cref="ArgumentNullException">If subsystem is null</exception>
        /// <exception cref="IllegalUseOfCommandException">If this command has started before or if it has been given to a <see cref="CommandGroup"/></exception>
        /// <seealso cref="Subsystem"/>
        protected internal void Requires(Subsystem subsystem)
        {
            lock (m_syncRoot)
            {

                Validate("Can not add new requirement to command");
                if (subsystem != null)
                {
                    if (m_requirements == null)
                        m_requirements = new HashSet<Subsystem>();
                    m_requirements.Add(subsystem);
                }
                else
                {
                    throw new ArgumentNullException(nameof(subsystem), "Subsystem must not be null.");
                }
            }
        }
 public void AddRequires(Subsystem subsystem)
 {
     Requires(subsystem);
 }