Add save and loader classes and some QoL improvements

This commit is contained in:
Stone_Red
2023-07-29 23:38:48 +02:00
parent 61a0166599
commit 6d0ca85b7f
33 changed files with 875 additions and 153 deletions
@@ -2,25 +2,23 @@
using MonoGame.Extended.Input;
using StoneRed.LogicSimulator.Simulation.LogicGates.Attributes;
using StoneRed.LogicSimulator.Simulation.LogicGates.Interfaces;
namespace StoneRed.LogicSimulator.Simulation.LogicGates;
[LogicGateName("Switch")]
[LogicGateDescription("A switch is a toggleable switch that can be turned on and off.")]
internal class Switch : LogicGate, IInteractable, IColorable
{
public override int OutputCount => 1;
public override int OutputCount { get; set; } = 1;
public override int InputCount => 0;
public override int InputCount { get; set; } = 0;
public bool IsPressed { get; set; }
public Color Color { get; set; } = Color.Purple;
public string Info { get; set; } = "OFF";
public Switch()
{
Metadata.Name = "Switch";
}
public void OnInteraction(MouseStateExtended mouseState, MouseStateExtended previousMouseState, KeyboardStateExtended keyboardStateExtended)
{
if (mouseState.IsButtonDown(MouseButton.Left) && !previousMouseState.IsButtonDown(MouseButton.Left))