public void Update() { Tag = Detectable.Tag; m_Observations = Detectable.InitObservations(); if (m_Observations.HasObservations(out IList <string> names)) { bool hasEmpty = m_ObservationsList.Contains(""); bool hasDuplicates = m_ObservationsList.Count > m_ObservationsList.Distinct().Count(); // true if exposed observations were changed in detectable class. bool hasChange = !Enumerable.SequenceEqual(m_AllObservations, names); if (hasEmpty || hasDuplicates || hasChange) { // Show all observation names in inspector. m_AllObservations.Clear(); m_AllObservations.AddRange(names); m_ObservationsList.Clear(); m_ObservationsList.AddRange(names); } } else { m_AllObservations.Clear(); m_ObservationsList.Clear(); } }
public override Observations InitObservations() { base.InitObservations(); if (Observations.IsEmpty) { // Required. Observations.Add(OneHot, "One-Hot"); } return(Observations); }
public override Observations InitObservations() { base.InitObservations(); if (m_AddOneHotObservation) { // Optional. Observations.Add(OneHot, "One-Hot"); } return(Observations); }
public virtual Observations InitObservations() { Observations = new Observations(); AddObservations(); return(Observations); }