public MyUnits GetMyUnits() { MyUnits ret = new MyUnits(); foreach (Unit u in allUnits) { if (u.Alliance == Alliance.Self) { ret.all.Add(u); if (u.IsArmyUnit()) { ret.armyUnit.Add(u); if (u.EngagedTargetTag != 0) { ret.engaging.Add(u); Unit targetUnit = GetUnitFromTag(u.EngagedTargetTag); if (targetUnit != null) { if (targetUnit.IsArmyUnit()) { ret.engagingUnit.Add(u); } } } } else { ret.building.Add(u); } } } return(ret); }
public void SetVariable(SC2GameState gameState) { this.gameState = gameState; this.newObservation = gameState.NewObservation; this.gameLoop = (int)newObservation.Observation.GameLoop; this.allUnits = newObservation.Observation.RawData.Units.ToList(); this.upgradeIDs = newObservation.Observation.RawData.Player.UpgradeIds; this.enemyUnit = GetEnemyUnits(); this.myUnit = GetMyUnits(); this.baseLocations = allUnits.FindBaseLocation(); }