public override void Update(float dt) { base.Update(dt); if (!RedrawRequested) { return; } RedrawRequested = false; DrawNode.Clear(); List <HexagonNode> handledPositions = new List <HexagonNode>(); foreach (var structure in World.StructureManager) { if (structure is Construction) { continue; } handledPositions.Add(structure.Position); foreach (var accessibleNode in structure.Position.GetAccessibleAdjacentHexagonNodes(World.HexagonManager).Where(h => !handledPositions.Contains(h))) { var p1 = structure.Position.GetWorldPosition(World.GameSettings.LayoutSettings.HexagonRadius, World.GameSettings.LayoutSettings.HexagonMargin); var p2 = accessibleNode.GetWorldPosition(World.GameSettings.LayoutSettings.HexagonRadius, World.GameSettings.LayoutSettings.HexagonMargin); var color = World.GameSettings.VisualSettings.ColorCollection.EdgeBackground; DrawNode.DrawSegment(p1, p2, World.GameSettings.VisualSettings.EdgeThickness, color); } } }
public override void Update(float dt) { base.Update(dt); if (!RedrawRequested) { return; } DrawNode.Clear(); foreach (var button in Buttons.OfType <BuildButton>()) { var position = button.Position; var delta = GameSettings.VisualSettings.BuildButtonRadius * 0.5f; DrawNode.DrawCircle(position, GameSettings.VisualSettings.BuildButtonRadius, GameSettings.VisualSettings.ColorCollection.BuildButtonBackground, GameSettings.VisualSettings.StructureBorderThickness, GameSettings.VisualSettings.ColorCollection.BuildButtonBorder); DrawNode.DrawSegment(position - CCPoint.AnchorUpperLeft * delta, position + CCPoint.AnchorUpperLeft * delta, GameSettings.VisualSettings.PlusCrossRadius, GameSettings.VisualSettings.ColorCollection.BuildButtonForeground); DrawNode.DrawSegment(position - CCPoint.AnchorLowerRight * delta, position + CCPoint.AnchorLowerRight * delta, GameSettings.VisualSettings.PlusCrossRadius, GameSettings.VisualSettings.ColorCollection.BuildButtonForeground); } }
public void DrawRoundedLine(CCPoint from, CCPoint to, float radius, CCColor4F fill, float borderThickness, CCColor4F borderColor) { DrawNode.DrawSegment(from, to, radius + borderThickness, borderColor); DrawNode.DrawSegment(from, to, radius, fill); }