public SolarPylon(String pylonKey) { _pylonKey = pylonKey; _vRotor = new SolarRotor(_pylonKey, SolarRotorType.Vertical); _hRotors.Add(new SolarRotor(_pylonKey, SolarRotorType.HorizontalLeft)); _hRotors.Add(new SolarRotor(_pylonKey, SolarRotorType.HorizontalRight)); _panel = new SolarPanel(_hRotors); }
void updateRotors() { this.solarRotors.Clear(); foreach (IMyCubeGrid metagrid in this.tmpRotorMetagridAssociations.Values) { this.tmpSolarGridsInMetaGrid.AddRange(this.tmpSolarGrids.Where(grid => this.tmpSolarMetagridAssociations[grid] == metagrid)); if (this.tmpSolarGridsInMetaGrid.Count != 0) { this.tmpControllingRotors.AddRange(this.tmpRotorMetagridAssociations.Where(kv => kv.Value == metagrid).Select(kv => kv.Key)); var solarPanel = new SolarPanel(this.tmpSolarGridsInMetaGrid, this.tmpPanels); var solarRotor = new SolarRotor(this.keyword, this.tmpControllingRotors, solarPanel, this.logger); IMyCubeGrid baseMetaGrid = this.tmpSolarMetagridAssociations[this.tmpControllingRotors.First().CubeGrid]; List <SolarRotor> solarRotors; if (this.tmpBaseMetagridSolarRotorAssociation.TryGetValue(baseMetaGrid, out solarRotors)) { solarRotors.Add(solarRotor); } else { this.tmpBaseMetagridSolarRotorAssociation.Add(baseMetaGrid, new List <SolarRotor> { solarRotor }); } this.tmpControllingRotors.Clear(); this.tmpSolarGridsInMetaGrid.Clear(); } } foreach (KeyValuePair <IMyCubeGrid, List <SolarRotor> > kv in this.tmpBaseMetagridSolarRotorAssociation) { this.tmpControllingRotors.AddRange(this.tmpRotorMetagridAssociations.Where(kv2 => kv2.Value == kv.Key).Select(kv2 => kv2.Key)); if (this.tmpControllingRotors.Count == 0) { this.solarRotors.AddRange(kv.Value); } else { this.solarRotors.Add(new SolarRotor(this.keyword, this.tmpControllingRotors, kv.Value, this.logger)); this.tmpControllingRotors.Clear(); } } this.tmpBaseMetagridSolarRotorAssociation.Clear(); }