private IEnumerator TrackNewTurbineCoroutine(JetStreamT242Controller obj) { yield return(new WaitForEndOfFrame()); GameObject newSeaBase = obj?.gameObject?.transform?.parent?.gameObject; if (newSeaBase != null && newSeaBase == _seaBase) { Turbines.Add(obj.ID, obj); _marineMonitorDisplay.ItemModified <string>(null); } }
private IEnumerator TrackNewTurbineCoroutine(AIJetStreamT242Controller obj) { // We yield to the end of the frame as we need the parent/children tree to update. yield return(new WaitForEndOfFrame()); GameObject newSeaBase = obj?.gameObject?.transform?.parent?.gameObject; QuickLogger.Debug("Attempting to add turbine", true); if (newSeaBase != null && newSeaBase == _seaBase) { Turbines.Add(obj.GetPrefabId(), obj); QuickLogger.Debug($"Turbine Count: {Turbines.Count}", true); _aiMarineMonitorDisplay.ItemModified(TechType.None); } }
/// <summary> /// Gets all the turbines in the base /// </summary> private void GetTurbines() { //Clear the list Turbines.Clear(); //Check if there is a base connected if (_seaBase != null) { var jetStreamT242S = _seaBase.GetComponentsInChildren <JetStreamT242Controller>().ToList(); foreach (var turbine in jetStreamT242S) { Turbines.Add(turbine.ID, turbine); } } }