private void Initialize(int[,] matrix) { Barriers = new List <Barrier>(); DammageableBarriers = new List <DammageableBarrier>(); EnemySpawns = new List <EnemySpawn>(); Configuration.Width = matrix.GetLength(1); Configuration.Height = matrix.GetLength(0); for (int i = 0; i < Configuration.Height; i++) { for (int j = 0; j < Configuration.Width; j++) { var item = DefineItem(matrix[i, j], i, j); if (item.Type == ItemType.Wall) { Barriers.Add((Barrier)item); } else if (item.Type == ItemType.DammageableWall) { DammageableBarriers.Add((DammageableBarrier)item); } else if (item.Type == ItemType.EnemySpawn) { EnemySpawns.Add((EnemySpawn)item); } else if (item.Type == ItemType.Enemy) { Enemies.Add((Enemy)item); } else if (item.Type == ItemType.Bonus) { Bonuses.Add((Bonus)item); } else if (item.Type == ItemType.Empty) { Empties.Add((Empty)item); } else if (item.Type == ItemType.Water) { Waters.Add((Water)item); } } } GenerateEnemies(); GenerateBonuses(); }
private void GenerateEmpties(Point position) { var item = new Empty(new Point(position)); Empties.Add(item); }