public void buildAttackGrid() { if (AttackGrid == null) { AttackGrid = new int[CellsX.get(), CellsY.get()]; } AttackJobQue.Clear(); for (int x = 0; x < CellsX.get(); x++) { for (int y = 0; y < CellsY.get(); y++) { AttackGrid[x, y] = NeutralCell; } } MiningPlatform forwardPlatform = PathFindingManager.TraceToMiningPlatform(NeutralManager.GetSpawnPosition(), WaveManager.ActiveTeam); foreach (MiningPlatform r in Parent2DScene.Enumerate(typeof(MiningPlatform))) { if (!r.Dead && r.GetTeam() == WaveManager.ActiveTeam) { Vector2 UpperLeftCorner = (r.getUpperLeftCorner() - Parent2DScene.MinBoundary.get()) / Divisor; Vector2 LowerRightCorner = (r.getLowerRightCorner() - Parent2DScene.MinBoundary.get()) / Divisor; int MinX = (int)UpperLeftCorner.X; int MinY = (int)UpperLeftCorner.Y; int MaxX = (int)LowerRightCorner.X; int MaxY = (int)LowerRightCorner.Y; for (int x = MinX; x < MaxX; x++) { for (int y = MinY; y < MaxY; y++) { AttackJobQue.Enqueue(x); AttackJobQue.Enqueue(y); AttackJobQue.Enqueue(r == forwardPlatform && WaveManager.CurrentWave > 5 ? StartingCell / 2 : StartingCell); } } } } foreach (UnitTurret u in Parent2DScene.Enumerate(typeof(UnitTurret))) { if (!u.Dead && u.GetTeam() == WaveManager.ActiveTeam && ((u.MyCard == null && !NeutralManager.MyPattern.CurrentCard.Type.Equals("Heavy")) || (u.MyCard != null && !u.MyCard.StrongVs.Equals(NeutralManager.MyPattern.CurrentCard.Type)))) { Vector2 UpperLeftCorner = (u.getUpperLeftCorner() - Parent2DScene.MinBoundary.get()) / Divisor; Vector2 LowerRightCorner = (u.getLowerRightCorner() - Parent2DScene.MinBoundary.get()) / Divisor; int MinX = (int)UpperLeftCorner.X; int MinY = (int)UpperLeftCorner.Y; int MaxX = (int)LowerRightCorner.X; int MaxY = (int)LowerRightCorner.Y; for (int x = MinX; x < MaxX; x++) { for (int y = MinY; y < MaxY; y++) { AttackJobQue.Enqueue(x); AttackJobQue.Enqueue(y); AttackJobQue.Enqueue(StartingCell); } } } } }