Cleanup
This commit is contained in:
@@ -144,7 +144,7 @@ public static class LevelEditor
|
||||
|
||||
private static bool SameDoorEdge(DoorState door, GridPosition a, GridPosition b)
|
||||
{
|
||||
return door.A == a && door.B == b || door.A == b && door.B == a;
|
||||
return (door.A == a && door.B == b) || (door.A == b && door.B == a);
|
||||
}
|
||||
|
||||
private static ReactorBinding BindConsumer(ReactorBinding reactor, ECarrierType carrier, GridPosition consumerPosition)
|
||||
|
||||
@@ -2,6 +2,24 @@
|
||||
|
||||
internal static class SurfaceInteractionSystem
|
||||
{
|
||||
private sealed class SurfaceDelta
|
||||
{
|
||||
public SurfaceState Apply(SurfaceState surface)
|
||||
{
|
||||
return surface with {
|
||||
Fuel = surface.Fuel + Fuel,
|
||||
Coolant = surface.Coolant + Coolant,
|
||||
Electricity = surface.Electricity + Electricity,
|
||||
Heat = surface.Heat + Heat
|
||||
};
|
||||
}
|
||||
|
||||
public float Fuel { get; set; }
|
||||
public float Coolant { get; set; }
|
||||
public float Electricity { get; set; }
|
||||
public float Heat { get; set; }
|
||||
}
|
||||
|
||||
public static LevelState Resolve(LevelState level)
|
||||
{
|
||||
var deltas = Enumerable.Range(0, level.Width * level.Height).Select(_ => new SurfaceDelta()).ToArray();
|
||||
@@ -114,22 +132,4 @@ internal static class SurfaceInteractionSystem
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class SurfaceDelta
|
||||
{
|
||||
public SurfaceState Apply(SurfaceState surface)
|
||||
{
|
||||
return surface with {
|
||||
Fuel = surface.Fuel + Fuel,
|
||||
Coolant = surface.Coolant + Coolant,
|
||||
Electricity = surface.Electricity + Electricity,
|
||||
Heat = surface.Heat + Heat
|
||||
};
|
||||
}
|
||||
|
||||
public float Fuel { get; set; }
|
||||
public float Coolant { get; set; }
|
||||
public float Electricity { get; set; }
|
||||
public float Heat { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -108,8 +108,10 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Content="Fuel" Click="BindFuel_Click" HorizontalAlignment="Stretch" />
|
||||
<Button Grid.Column="1" Content="Coolant" Click="BindCoolant_Click" HorizontalAlignment="Stretch" />
|
||||
<Button Grid.Column="2" Content="Electric" Click="BindElectricity_Click" HorizontalAlignment="Stretch" />
|
||||
<Button Grid.Column="1" Content="Coolant" Click="BindCoolant_Click"
|
||||
HorizontalAlignment="Stretch" />
|
||||
<Button Grid.Column="2" Content="Electric" Click="BindElectricity_Click"
|
||||
HorizontalAlignment="Stretch" />
|
||||
</Grid>
|
||||
|
||||
<TextBlock Text="Rule Events" FontSize="16" FontWeight="SemiBold" Foreground="#F4F1E8" />
|
||||
@@ -120,7 +122,8 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Content="Warn Next Turn" Click="AddWarningRule_Click" HorizontalAlignment="Stretch" />
|
||||
<Button Grid.Column="1" Content="Leak Next Turn" Click="AddLeakRule_Click" HorizontalAlignment="Stretch" />
|
||||
<Button Grid.Column="1" Content="Leak Next Turn" Click="AddLeakRule_Click"
|
||||
HorizontalAlignment="Stretch" />
|
||||
</Grid>
|
||||
<Button Content="Remove Last Rule" Click="RemoveLastRule_Click" HorizontalAlignment="Stretch" />
|
||||
|
||||
@@ -139,4 +142,4 @@
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
</Window>
|
||||
@@ -334,7 +334,7 @@ public sealed partial class MainWindow
|
||||
private static Rect TilemapSourceRect(int wallMask)
|
||||
{
|
||||
var tilePosition = wallMask switch {
|
||||
c_BottomLeftCorner => new GridPosition(0, 0),
|
||||
c_BottomLeftCorner => new(0, 0),
|
||||
c_TopRightCorner | c_BottomRightCorner => new(1, 0),
|
||||
c_TopLeftCorner | c_BottomLeftCorner | c_BottomRightCorner => new(2, 0),
|
||||
c_BottomLeftCorner | c_BottomRightCorner => new(3, 0),
|
||||
@@ -1005,11 +1005,11 @@ public sealed partial class MainWindow
|
||||
private LevelState m_Level;
|
||||
private double m_PanX;
|
||||
private double m_PanY;
|
||||
private GridPosition? m_PendingDoorCell;
|
||||
private GridPosition? m_PendingElectricityLeakCell;
|
||||
private CanvasBitmap? m_RobotSprite;
|
||||
private GridPosition? m_SelectedCell;
|
||||
private int? m_SelectedReactorId = 1;
|
||||
private GridPosition? m_PendingDoorCell;
|
||||
private GridPosition? m_PendingElectricityLeakCell;
|
||||
private EditorToolCommand m_SelectedTool = new() { Tool = EEditorTool.Cursor };
|
||||
private CanvasBitmap? m_TerrainTilemap;
|
||||
private double m_Zoom = 1;
|
||||
|
||||
Reference in New Issue
Block a user