private void setUpModel() { model = new GameModel(); ScenarioComponent scenario = new ScenarioComponent(20, 20); // 20 x 20 Gameworld. Building obstruction = new Building(); // Add grass cells at each cell. ZRTSModel.Map map = scenario.GetGameWorld().GetMap(); for (int i = 0; i < map.GetWidth(); i++) { for (int j = 0; j < map.GetHeight(); j++) { CellComponent cell = new CellComponent(); cell.AddChild(new Sand()); cell.X = i; cell.Y = j; if (i >= 2 && i <= 10 && j >= 2 && j <= 10) { cell.AddEntity(obstruction); } if (i >= 15 && i <= 18 && j >= 15 && j <= 18) { cell.AddEntity(obstruction); } if (i == 16 && j == 16) { cell.RemoveEntity(obstruction); } map.AddChild(cell); } } model.AddChild(scenario); }
public void Do() { player.GetUnitList().AddChild(unit); unit.PointLocation = new PointF((float)cell.X, (float)cell.Y); cell.AddEntity(unit); }