# HG changeset patch # User Alys Brooks # Date 2022-03-16 06:43:05 # Node ID 9119936854939dad0378a81a32413473308e47f1 # Parent 3cfbcc27396b6fcbee1be4358dd7361cdf28d1da Use red for dezone. diff --git a/isometric-park-fna/Components/AreaComponent.cs b/isometric-park-fna/Components/AreaComponent.cs --- a/isometric-park-fna/Components/AreaComponent.cs +++ b/isometric-park-fna/Components/AreaComponent.cs @@ -7,5 +7,6 @@ public struct AreaComponent : IComponent { public Vector2[] squares; + public Tool Tool; } } diff --git a/isometric-park-fna/Engines/BuildToolEngine.cs b/isometric-park-fna/Engines/BuildToolEngine.cs --- a/isometric-park-fna/Engines/BuildToolEngine.cs +++ b/isometric-park-fna/Engines/BuildToolEngine.cs @@ -113,7 +113,8 @@ && message.Start.Y >= 0 && message.Start.Y < this.Map.MapHeight) { var entity = CreateEntity(); - AddComponent(entity, new AreaComponent { squares = new[] {message.Start} }); + AddComponent(entity, new AreaComponent { squares = new[] {message.Start} , + Tool=Tool.Preserve}); AddComponent(entity, new SelectedComponent { selected = true, Type= SelectionType.Area}); } } @@ -145,7 +146,7 @@ } } - SetComponent(entity, new AreaComponent { squares = newSquares.ToArray() /*new[]{ area.squares[0], message.End}*/}); + SetComponent(entity, new AreaComponent { squares = newSquares.ToArray() /*new[]{ area.squares[0], message.End}*/, Tool = area.Tool}); } } } @@ -159,7 +160,8 @@ && message.Start.Y >= 0 && message.Start.Y < this.Map.MapHeight) { var entity = CreateEntity(); - AddComponent(entity, new AreaComponent { squares = new[] {message.Start} }); + AddComponent(entity, new AreaComponent { squares = new[] {message.Start}, + Tool = Tool.Dezone }); AddComponent(entity, new SelectedComponent { selected = true, Type= SelectionType.Area}); } } @@ -192,7 +194,7 @@ } } } - SetComponent(entity, new AreaComponent { squares = newSquares.ToArray() /*new[]{ area.squares[0], message.End}*/}); + SetComponent(entity, new AreaComponent { squares = newSquares.ToArray(), Tool = area.Tool}); } } } diff --git a/isometric-park-fna/Renderers/AreaRenderer.cs b/isometric-park-fna/Renderers/AreaRenderer.cs --- a/isometric-park-fna/Renderers/AreaRenderer.cs +++ b/isometric-park-fna/Renderers/AreaRenderer.cs @@ -34,10 +34,15 @@ // var SelectedComponent = GetComponent(entity); var selected = GetComponent(entity).selected; - if (!HasComponent(entity) ) - { + if (HasComponent(entity) || areaComponent.Tool == Tool.Preserve) + { Quad.FillSquares(batch, areaComponent.squares, Color.Blue, 0.5f, 0.79f); Tile.DrawOutlinedSquares(batch, areaComponent.squares, Color.Blue); + } + else if (!HasComponent(entity)) + { + Quad.FillSquares(batch, areaComponent.squares, Color.Red, 0.5f, 0.79f); + Tile.DrawOutlinedSquares(batch, areaComponent.squares, Color.Red); } else if ((!HasComponent(entity) || GetComponent(entity).status == ContractStatus.Accepted)