using System.Collections.Generic; using UnityEngine; using UnityEngine.Serialization; namespace MLAgents { /// /// BroadcastHub holds reference to brains and keeps track wether or not the brain be /// remotely controlled. /// [System.Serializable] public class BroadcastHub { [FormerlySerializedAs("_brainsToControl")] [SerializeField] public List brainsToControl = new List(); /// /// The number of Brains inside the BroadcastingHub. /// public int Count { get { return brainsToControl.Count; } } /// /// Sets a brain to controlled. /// /// The Brain that is being set to controlled public void SetControlled(LearningBrain brain) { if (!brainsToControl.Contains(brain)) { brainsToControl.Add(brain); } } /// /// Removes all the Brains of the BroadcastHub /// public void Clear() { brainsToControl.Clear(); } } }