public RenderInstruction(RenderInstruction instr, Color color) { Type = instr.Type; Vertices = (VertexPositionColor[]) instr.Vertices.Clone(); Indices = instr.Indices; //MemberwiseClone for (int n = 0; n < Vertices.Length; n++) { Vertices[n].Color = color; } }
public MapView(Provinces provinces, Units units, RenderInstruction[][] standardInstrs, RenderInstruction[][] idleInstrs, DialogManager dialogMgr, Wars wars) { _provinces = provinces; _units = units; _wars = wars; _dialogMgr = dialogMgr; _provinceSelection = new ProvinceSelection(); _unitsSelection = new UnitsSelection(); _standardInstrs = standardInstrs; _idleInstrs = idleInstrs; _labelBoxes = provinces.Boundaries.Select(mpoly => mpoly.Polys[0].FindBestLabelBox()).ToArray(); // The boundary depends on the size of the army text, // so the actual boxes are written in the draw method. _labelClickableBoundaries = new Dictionary<int, AABB>(); _units.OnDelete += _unitsSelection.Deselect; }