public void Update() { foreach (var tile in tiles) { tile.shape.OutlineColor = Color.Black; } if (MathModule.CorrectVector(Controller.NormalizedMousePosition)) { activeTile = tiles[Controller.NormalizedMousePosition.X, Controller.NormalizedMousePosition.Y]; activeTile.shape.OutlineColor = Color.White; } if (Model.TowerListChanged) { Model.TowerListChanged = false; Towers.Clear(); if (Model.Towers.Count != 0) { foreach (var tower in Model.Towers) { Towers.Add(new RectangleShape() { Size = new Vector2f(100, 100), Origin = new Vector2f(50, 50), Position = MathModule.ViewTransform((Vector2f)tower.position) + Config.PositionShift, Texture = tower.configs.texture }); } } Towers.Sort(CompareSpriteDepth); } Mobs.Clear(); if (Model.Wave.Count != 0) { foreach (var mob in Model.Wave) { /*Mobs.Add(new CircleShape() * { * Radius = 10, * Origin = new Vector2f(10, -10), * Position = MathModule.ViewTransform(mob.position) + mob.shift + Config.PositionShift, * FillColor = Color.Black, * OutlineColor = Color.Black, * OutlineThickness = 2 * });*/ Mobs.Add(new RectangleShape() { Size = new Vector2f(40, 50), Origin = new Vector2f(20, 20), Position = MathModule.ViewTransform((Vector2f)mob.position) + Config.PositionShift, Texture = mob.configs.texture }); } } Mobs.Sort(CompareSpriteDepth); }
public Tile(int id) { shape = new ConvexShape(4) { OutlineColor = Color.Black, OutlineThickness = 2, Texture = new Texture(Sources.TileTextures[id]) //FillColor = getTileColor(id) }; shape.SetPoint(0, MathModule.ViewTransform(0, 0)); shape.SetPoint(1, MathModule.ViewTransform(0, 1)); shape.SetPoint(2, MathModule.ViewTransform(1, 1)); shape.SetPoint(3, MathModule.ViewTransform(1, 0)); }
} // хуита но робит и влом менять public void SetTile(int x, int y, int id) { tiles[x, y] = new Tile(id); tiles[x, y].Position = MathModule.ViewTransform(x, y) + Config.PositionShift; }