11using System.Collections.Generic;
29 #pragma warning disable 0649
31 [Tooltip(
"The list of observed detectors.")]
32 private List<Detector> Detectors;
33 #pragma warning restore 0649
43 [Tooltip(
"Add all detectors on this object automatically.")]
50 [Tooltip(
"The type of logic used to combine detector state.")]
57 [Tooltip(
"Whether to negate the gate output.")]
68 if(!Detectors.Contains(detector)){
69 Detectors.Add(detector);
70 activateDetector(detector);
83 Detectors.Remove(detector);
94 Detector[] detectors = GetComponents<Detector>();
95 for(
int g = 0; g < detectors.Length; g++){
96 if ( detectors[g] !=
this && detectors[g].enabled) {
102 private void Awake(){
103 for (
int d = 0; d < Detectors.Count; d++) {
104 activateDetector(Detectors[d]);
111 private void activateDetector(Detector detector){
118 private void OnEnable() {
122 private void OnDisable () {
132 if (Detectors.Count < 1)
134 bool state = Detectors[0].IsActive;
135 for(
int a = 1; a < Detectors.Count; a++){
137 state = state && Detectors[a].IsActive;
139 state = state || Detectors[a].IsActive;
virtual void Deactivate()
void AddAllSiblingDetectors()
void RemoveDetector(Detector detector)
bool AddAllSiblingDetectorsOnAwake
void AddDetector(Detector detector)