stateful gates
This commit is contained in:
@@ -16,6 +16,9 @@ namespace UntitledLogicGame
|
||||
|
||||
#region Unity Properties
|
||||
|
||||
[Header("Interaction")]
|
||||
public float MinDistanceInteracting;
|
||||
|
||||
[Header("Click")]
|
||||
public float DoubleClickThreshold;
|
||||
public float DoubleClickDelay;
|
||||
@@ -30,8 +33,9 @@ namespace UntitledLogicGame
|
||||
#region Public Properties
|
||||
|
||||
public static Vector3 MousePos { get; set; }
|
||||
public bool Interacting => _currentCable != null || _currentGate != null;
|
||||
public bool MovingObject => _currentGate != null;
|
||||
public bool Interacting => DraggingCable || MovingObject;
|
||||
public bool DraggingCable => _currentCable != null && (_currentCableInitialMousePos - MousePos).magnitude > MinDistanceInteracting;
|
||||
public bool MovingObject => _currentGate != null && (_currentGateInitialPos == null || (_currentGateInitialPos.Value - _currentGate.transform.position).magnitude > MinDistanceInteracting);
|
||||
public bool Clicking => Input.GetButton("Fire1");
|
||||
public bool DeleteOnRelease { get; set; }
|
||||
|
||||
@@ -40,6 +44,7 @@ namespace UntitledLogicGame
|
||||
#region Private Properties
|
||||
|
||||
private Cable _currentCable;
|
||||
private Vector3 _currentCableInitialMousePos;
|
||||
private Gate _currentGate;
|
||||
private Vector3? _currentGateInitialPos;
|
||||
private Vector3 _currentGateDelta;
|
||||
@@ -57,11 +62,11 @@ namespace UntitledLogicGame
|
||||
|
||||
if (Clicking)
|
||||
{
|
||||
UpdateDrag();
|
||||
UpdateDrag();
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateDrop();
|
||||
UpdateDrop();
|
||||
}
|
||||
|
||||
UpdateCursor();
|
||||
@@ -78,7 +83,7 @@ namespace UntitledLogicGame
|
||||
_currentGateInitialPos = created ? (Vector3?)null : _currentGate.transform.position;
|
||||
foreach (var renderer in _currentGate.GetComponentsInChildren<SpriteRenderer>())
|
||||
{
|
||||
renderer.sortingLayerName = "moving";
|
||||
renderer.sortingLayerName = "moving";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,8 +91,8 @@ namespace UntitledLogicGame
|
||||
{
|
||||
if (_currentGate != null)
|
||||
{
|
||||
Destroy(_currentGate.gameObject);
|
||||
_currentGate = null;
|
||||
Destroy(_currentGate.gameObject);
|
||||
_currentGate = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,24 +101,24 @@ namespace UntitledLogicGame
|
||||
|
||||
if (Clicking)
|
||||
{
|
||||
_clicked += Time.deltaTime;
|
||||
_clicked += Time.deltaTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_clicked >= DoubleClickThreshold)
|
||||
{
|
||||
if(Time.time - _clicktime < DoubleClickDelay)
|
||||
if(_clicked >= DoubleClickThreshold)
|
||||
{
|
||||
_clicked = 0f;
|
||||
_clicktime = 0f;
|
||||
return true;
|
||||
if(Time.time - _clicktime < DoubleClickDelay)
|
||||
{
|
||||
_clicked = 0f;
|
||||
_clicktime = 0f;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_clicktime = Time.time;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_clicktime = Time.time;
|
||||
}
|
||||
}
|
||||
_clicked = 0f;
|
||||
_clicked = 0f;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -133,22 +138,23 @@ namespace UntitledLogicGame
|
||||
{
|
||||
var cursor = DefaultCursor;
|
||||
var position = Vector2.zero;
|
||||
var interacting = _currentCable != null || _currentGate != null;
|
||||
|
||||
if (!Interacting && GameManager.Instance.CurrentAnchor != null || Interacting && _currentCable != null)
|
||||
if (!interacting && GameManager.Instance.CurrentAnchor != null || _currentCable != null)
|
||||
{
|
||||
cursor = PointerCursor;
|
||||
position = new Vector2(cursor.width / 2f, 0f);
|
||||
cursor = PointerCursor;
|
||||
position = new Vector2(cursor.width / 2f, 0f);
|
||||
}
|
||||
else if (!Interacting && GameManager.Instance.CurrentGate != null || Interacting && _currentGate != null)
|
||||
else if (!interacting && GameManager.Instance.CurrentGate != null || _currentGate != null)
|
||||
{
|
||||
cursor = MoveCursor;
|
||||
position = new Vector2(cursor.width / 2f, cursor.height / 2f);
|
||||
cursor = MoveCursor;
|
||||
position = new Vector2(cursor.width / 2f, cursor.height / 2f);
|
||||
}
|
||||
|
||||
if(_currentCursor != cursor)
|
||||
{
|
||||
Cursor.SetCursor(cursor, position, CursorMode.Auto);
|
||||
_currentCursor = cursor;
|
||||
Cursor.SetCursor(cursor, position, CursorMode.Auto);
|
||||
_currentCursor = cursor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,21 +162,22 @@ namespace UntitledLogicGame
|
||||
{
|
||||
if (_currentCable != null) // Dragging cable
|
||||
{
|
||||
_currentCable.FallbackEndPos = MousePos;
|
||||
_currentCable.FallbackEndPos = MousePos;
|
||||
}
|
||||
else if (_currentGate != null) // Dragging gate
|
||||
{
|
||||
_currentGate.transform.position = MousePos - _currentGateDelta;
|
||||
_currentGate.transform.position = MousePos - _currentGateDelta;
|
||||
}
|
||||
else if (GameManager.Instance.CurrentAnchor != null) // Dragging new cable
|
||||
{
|
||||
_currentCable = Instantiate(GameManager.Instance.CablePrefab, GameManager.Instance.CablesGroup, true);
|
||||
_currentCable.StartAnchor = GameManager.Instance.CurrentAnchor;
|
||||
_currentCable.FallbackEndPos = MousePos;
|
||||
_currentCable = Instantiate(GameManager.Instance.CablePrefab, GameManager.Instance.CablesGroup, true);
|
||||
_currentCable.StartAnchor = GameManager.Instance.CurrentAnchor;
|
||||
_currentCable.FallbackEndPos = MousePos;
|
||||
_currentCableInitialMousePos = MousePos;
|
||||
}
|
||||
else if (GameManager.Instance.CurrentGate != null) // Dragging new gate
|
||||
{
|
||||
DragGate(GameManager.Instance.CurrentGate, false);
|
||||
DragGate(GameManager.Instance.CurrentGate, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,48 +185,48 @@ namespace UntitledLogicGame
|
||||
{
|
||||
if (_currentCable != null) // Dropping cable
|
||||
{
|
||||
if (GameManager.Instance.CurrentAnchor == null || _currentCable.StartAnchor.IsInput == GameManager.Instance.CurrentAnchor.IsInput)
|
||||
{
|
||||
Destroy(_currentCable.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentCable.EndAnchor = GameManager.Instance.CurrentAnchor;
|
||||
}
|
||||
_currentCable = null;
|
||||
if (GameManager.Instance.CurrentAnchor == null || _currentCable.StartAnchor.IsInput == GameManager.Instance.CurrentAnchor.IsInput)
|
||||
{
|
||||
Destroy(_currentCable.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentCable.EndAnchor = GameManager.Instance.CurrentAnchor;
|
||||
}
|
||||
_currentCable = null;
|
||||
}
|
||||
else if (_currentGate != null) // Dropping gate
|
||||
{
|
||||
if (DeleteOnRelease)
|
||||
{
|
||||
Destroy(_currentGate.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var renderer in _currentGate.GetComponentsInChildren<SpriteRenderer>())
|
||||
if (DeleteOnRelease)
|
||||
{
|
||||
renderer.sortingLayerName = "default";
|
||||
Destroy(_currentGate.gameObject);
|
||||
}
|
||||
_currentGate.transform.position = _currentGate.transform.position.Round();
|
||||
var currentBox = _currentGate.Box;
|
||||
if (FindObjectsOfType<Gate>()
|
||||
.Where(g => !g.Equals(_currentGate))
|
||||
.Select(g => g.Box)
|
||||
.Any(b => currentBox.IsTouching(b)))
|
||||
else
|
||||
{
|
||||
// Collision with another gate
|
||||
if (_currentGateInitialPos == null)
|
||||
foreach (var renderer in _currentGate.GetComponentsInChildren<SpriteRenderer>())
|
||||
{
|
||||
Destroy(_currentGate.gameObject);
|
||||
renderer.sortingLayerName = "default";
|
||||
}
|
||||
else
|
||||
_currentGate.transform.position = _currentGate.transform.position.Round();
|
||||
var currentBox = _currentGate.Box;
|
||||
if (FindObjectsOfType<Gate>()
|
||||
.Where(g => !g.Equals(_currentGate))
|
||||
.Select(g => g.Box)
|
||||
.Any(b => currentBox.IsTouching(b)))
|
||||
{
|
||||
_currentGate.transform.position = _currentGateInitialPos.Value; // Reset pos
|
||||
// Collision with another gate
|
||||
if (_currentGateInitialPos == null)
|
||||
{
|
||||
Destroy(_currentGate.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentGate.transform.position = _currentGateInitialPos.Value; // Reset pos
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_currentGate = null;
|
||||
DeleteOnRelease = false;
|
||||
_currentGate = null;
|
||||
DeleteOnRelease = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
@@ -11,6 +12,19 @@ namespace UntitledLogicGame.UI
|
||||
{
|
||||
public class UIGate : UIToolbarButton
|
||||
{
|
||||
#region Static Properties
|
||||
|
||||
public float MaxSize {
|
||||
get
|
||||
{
|
||||
if(_maxSize == null)
|
||||
_maxSize = GameManager.Instance.GateSprites.Select(s => s.rect.width).Max();
|
||||
return _maxSize.Value;
|
||||
}
|
||||
}
|
||||
private float? _maxSize;
|
||||
#endregion
|
||||
|
||||
#region Unity Properties
|
||||
|
||||
#endregion
|
||||
@@ -23,9 +37,9 @@ namespace UntitledLogicGame.UI
|
||||
{
|
||||
var sprite = value.GetComponentInChildren<SpriteRenderer>().sprite;
|
||||
Image.sprite = sprite;
|
||||
Image.GetComponent<RectTransform>().sizeDelta = new Vector2(100f, 100 * sprite.rect.width / 700f); // TODO get max width from UIManager
|
||||
gameObject.name = "UI_" + value.Definition.Name;
|
||||
Text.text = value.Definition.Name;
|
||||
Image.GetComponent<RectTransform>().sizeDelta = new Vector2(100f, 100 * sprite.rect.width / MaxSize);
|
||||
gameObject.name = "UI_" + value.GateType.ToString();
|
||||
Text.text = value.UIName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ namespace UntitledLogicGame.Workspace
|
||||
return _definition;
|
||||
}
|
||||
}
|
||||
public string UIName { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -70,7 +71,7 @@ namespace UntitledLogicGame.Workspace
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Utils.RandomName(Definition.Name, gameObject);
|
||||
Utils.RandomName(GateType.ToString(), gameObject);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace UntitledLogicGame.Workspace
|
||||
private Anchor _anchorPrefab;
|
||||
private Anchor _bigAnchorPrefab;
|
||||
private List<Sprite> _gateSprites;
|
||||
private Sprite _defaultSprite => _gateSprites.First(s => s.name == "default");
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -63,10 +64,20 @@ namespace UntitledLogicGame.Workspace
|
||||
}
|
||||
|
||||
gate.GateType = (GateType)key;
|
||||
|
||||
|
||||
var sprite = _gateSprites.First(s => s.name == item.Skin);
|
||||
gate.Sprite.Renderer.sprite = sprite;
|
||||
gate.UIName = string.IsNullOrEmpty(item.Name) ? gate.GateType.ToString() : item.Name;
|
||||
|
||||
if (string.IsNullOrEmpty(item.Skin))
|
||||
{
|
||||
gate.Sprite.Renderer.sprite = _defaultSprite;
|
||||
gate.Sprite.Renderer.drawMode = SpriteDrawMode.Sliced;
|
||||
gate.Sprite.Renderer.size = new Vector2(item.Width, item.Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
var sprite = _gateSprites.First(s => s.name == item.Skin);
|
||||
gate.Sprite.Renderer.sprite = sprite;
|
||||
}
|
||||
gate.Sprite.ResetCollider();
|
||||
|
||||
if(item.Input != null && item.Input.Count > 0)
|
||||
@@ -101,7 +112,7 @@ namespace UntitledLogicGame.Workspace
|
||||
1f
|
||||
);
|
||||
|
||||
Debug.Log($"Loaded gate {gate.Definition.Name}");
|
||||
Debug.Log($"Loaded gate {key} {gate.GateType}");
|
||||
|
||||
return gate;
|
||||
}
|
||||
@@ -122,6 +133,7 @@ namespace UntitledLogicGame.Workspace
|
||||
public class GateBookItem
|
||||
{
|
||||
public string Skin { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int Width { get; set; }
|
||||
public int Height { get; set; }
|
||||
public string Class { get; set; }
|
||||
|
||||
@@ -60,7 +60,8 @@ namespace UntitledLogicGame.Workspace
|
||||
public void ResetCollider()
|
||||
{
|
||||
Destroy(GetComponent<PolygonCollider2D>());
|
||||
gameObject.AddComponent<PolygonCollider2D>();
|
||||
var collider = gameObject.AddComponent<PolygonCollider2D>();
|
||||
collider.autoTiling = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -19,8 +19,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
// Public properties
|
||||
public GateType Type { get; private set; }
|
||||
public GateCategory Category => (GateCategory)((int)Type / 100);
|
||||
public string Name => Type.ToString();
|
||||
public bool HasState => false;
|
||||
public abstract bool HasState { get; }
|
||||
public Dictionary<InputState, OutputState> TruthTable { get; private set; } = new Dictionary<InputState, OutputState>();
|
||||
|
||||
// Herited properties
|
||||
@@ -121,8 +120,13 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
}
|
||||
}
|
||||
|
||||
internal abstract class StateGateDefinition : GateDefinition
|
||||
internal abstract class StatelessGateDefinition : GateDefinition
|
||||
{
|
||||
public new bool HasState => true;
|
||||
public override bool HasState { get; } = false;
|
||||
}
|
||||
|
||||
internal abstract class StatefulGateDefinition : GateDefinition
|
||||
{
|
||||
public override bool HasState { get; } = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
{
|
||||
#region 000 - Technical
|
||||
|
||||
internal class NoneGate : GateDefinition
|
||||
internal class NoneGate : StatelessGateDefinition
|
||||
{
|
||||
public override string[] Inputs { get; } = new string[] { };
|
||||
public override string[] Outputs { get; } = new string[] { };
|
||||
@@ -25,7 +25,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
|
||||
#region 200 - Basic
|
||||
|
||||
internal class BUFGate : GateDefinition
|
||||
internal class BUFGate : StatelessGateDefinition
|
||||
{
|
||||
public override string[] Inputs { get; } = new string[] { "A" };
|
||||
public override string[] Outputs { get; } = new string[] { "Q" };
|
||||
@@ -33,7 +33,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
internal override Func<InputState, OutputState> Function => (input) => new OutputState(input[0]);
|
||||
}
|
||||
|
||||
internal class ANDGate : GateDefinition
|
||||
internal class ANDGate : StatelessGateDefinition
|
||||
{
|
||||
public override string[] Inputs { get; } = new string[] { "A", "B" };
|
||||
public override string[] Outputs { get; } = new string[] { "Q" };
|
||||
@@ -41,7 +41,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
internal override Func<InputState, OutputState> Function => (input) => new OutputState(input[0] && input[1]);
|
||||
}
|
||||
|
||||
internal class ORGate : GateDefinition
|
||||
internal class ORGate : StatelessGateDefinition
|
||||
{
|
||||
public override string[] Inputs { get; } = new string[] { "A", "B" };
|
||||
public override string[] Outputs { get; } = new string[] { "Q" };
|
||||
@@ -49,7 +49,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
internal override Func<InputState, OutputState> Function => (input) => new OutputState(input[0] || input[1]);
|
||||
}
|
||||
|
||||
internal class XORGate : GateDefinition
|
||||
internal class XORGate : StatelessGateDefinition
|
||||
{
|
||||
public override string[] Inputs { get; } = new string[] { "A", "B" };
|
||||
public override string[] Outputs { get; } = new string[] { "Q" };
|
||||
@@ -57,7 +57,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
internal override Func<InputState, OutputState> Function => (input) => new OutputState(input[0] ^ input[1]);
|
||||
}
|
||||
|
||||
internal class NOTGate : GateDefinition
|
||||
internal class NOTGate : StatelessGateDefinition
|
||||
{
|
||||
public override string[] Inputs { get; } = new string[] { "A" };
|
||||
public override string[] Outputs { get; } = new string[] { "Q" };
|
||||
@@ -65,7 +65,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
internal override Func<InputState, OutputState> Function => (input) => new OutputState(!input[0]);
|
||||
}
|
||||
|
||||
internal class NANDGate : GateDefinition
|
||||
internal class NANDGate : StatelessGateDefinition
|
||||
{
|
||||
public override string[] Inputs { get; } = new string[] { "A", "B" };
|
||||
public override string[] Outputs { get; } = new string[] { "Q" };
|
||||
@@ -73,7 +73,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
internal override Func<InputState, OutputState> Function => (input) => new OutputState(!(input[0] && input[1]));
|
||||
}
|
||||
|
||||
internal class NORGate : GateDefinition
|
||||
internal class NORGate : StatelessGateDefinition
|
||||
{
|
||||
public override string[] Inputs { get; } = new string[] { "A", "B" };
|
||||
public override string[] Outputs { get; } = new string[] { "Q" };
|
||||
@@ -81,7 +81,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
internal override Func<InputState, OutputState> Function => (input) => new OutputState(!(input[0] || input[1]));
|
||||
}
|
||||
|
||||
internal class XNORGate : GateDefinition
|
||||
internal class XNORGate : StatelessGateDefinition
|
||||
{
|
||||
public override string[] Inputs { get; } = new string[] { "A", "B" };
|
||||
public override string[] Outputs { get; } = new string[] { "Q" };
|
||||
@@ -93,7 +93,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
|
||||
#region 300 - Latches
|
||||
|
||||
internal class SRLatchGate : StateGateDefinition
|
||||
internal class SRLatchGate : StatefulGateDefinition
|
||||
{
|
||||
public new string Name => "SR Latch";
|
||||
public override string[] Inputs { get; } = new string[] { "S", "R" };
|
||||
@@ -113,7 +113,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
};
|
||||
}
|
||||
|
||||
internal class JKLatchGate : StateGateDefinition
|
||||
internal class JKLatchGate : StatefulGateDefinition
|
||||
{
|
||||
public new string Name => "JK Latch";
|
||||
public override string[] Inputs { get; } = new string[] { "J", "K" };
|
||||
@@ -135,7 +135,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
};
|
||||
}
|
||||
|
||||
internal class DLatchGate : StateGateDefinition
|
||||
internal class DLatchGate : StatefulGateDefinition
|
||||
{
|
||||
public new string Name => "D Latch";
|
||||
public override string[] Inputs { get; } = new string[] { "D", "E" };
|
||||
@@ -157,7 +157,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
|
||||
#region 400 - Flip-Flops
|
||||
|
||||
internal class SRFlipFlopGate : StateGateDefinition
|
||||
internal class SRFlipFlopGate : StatefulGateDefinition
|
||||
{
|
||||
public new string Name => "SR Flip-Flop";
|
||||
public override string[] Inputs { get; } = new string[] { "CLK", "S", "R" };
|
||||
@@ -181,7 +181,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
};
|
||||
}
|
||||
|
||||
internal class JKFlipFlopGate : StateGateDefinition
|
||||
internal class JKFlipFlopGate : StatefulGateDefinition
|
||||
{
|
||||
public new string Name => "JK Flip-Flop";
|
||||
public override string[] Inputs { get; } = new string[] { "CLK", "J", "K" };
|
||||
@@ -207,7 +207,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
};
|
||||
}
|
||||
|
||||
internal class DFlipFlopGate : StateGateDefinition
|
||||
internal class DFlipFlopGate : StatefulGateDefinition
|
||||
{
|
||||
public new string Name => "D Flip-Flop";
|
||||
public override string[] Inputs { get; } = new string[] { "CLK", "D" };
|
||||
@@ -227,7 +227,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
};
|
||||
}
|
||||
|
||||
internal class TFlipFlopGate : StateGateDefinition
|
||||
internal class TFlipFlopGate : StatefulGateDefinition
|
||||
{
|
||||
public new string Name => "T Flip-Flop";
|
||||
public override string[] Inputs { get; } = new string[] { "CLK", "T" };
|
||||
@@ -252,7 +252,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
|
||||
#region 500 - Arithmetic
|
||||
|
||||
internal class HalfAddGate : GateDefinition
|
||||
internal class HalfAddGate : StatelessGateDefinition
|
||||
{
|
||||
public new string Name => "Half Add.";
|
||||
public override string[] Inputs { get; } = new string[] { "A", "B" };
|
||||
@@ -270,7 +270,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
};
|
||||
}
|
||||
|
||||
internal class FullAddGate : GateDefinition
|
||||
internal class FullAddGate : StatelessGateDefinition
|
||||
{
|
||||
public new string Name => "Full Add.";
|
||||
public override string[] Inputs { get; } = new string[] { "A", "B", "Cɪ" };
|
||||
@@ -289,7 +289,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
};
|
||||
}
|
||||
|
||||
internal class HalfSubGate : GateDefinition
|
||||
internal class HalfSubGate : StatelessGateDefinition
|
||||
{
|
||||
public new string Name => "Half Sub.";
|
||||
public override string[] Inputs { get; } = new string[] { "A", "B" };
|
||||
@@ -308,7 +308,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
|
||||
}
|
||||
|
||||
internal class FullSubGate : GateDefinition
|
||||
internal class FullSubGate : StatelessGateDefinition
|
||||
{
|
||||
public new string Name => "Full Add.";
|
||||
public override string[] Inputs { get; } = new string[] { "A", "B", "Cɪ" };
|
||||
@@ -332,7 +332,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
|
||||
#region 600 - Data
|
||||
|
||||
internal class MuxGate : GateDefinition
|
||||
internal class MuxGate : StatelessGateDefinition
|
||||
{
|
||||
public override string[] Inputs { get; } = new string[] { "E", "S", "D₀", "D₁" };
|
||||
public override string[] Outputs { get; } = new string[] { "Y" };
|
||||
@@ -350,7 +350,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
};
|
||||
}
|
||||
|
||||
internal class DemuxGate : GateDefinition
|
||||
internal class DemuxGate : StatelessGateDefinition
|
||||
{
|
||||
public override string[] Inputs { get; } = new string[] { "E", "S", "D" };
|
||||
public override string[] Outputs { get; } = new string[] { "Y₀", "Y₁" };
|
||||
@@ -368,7 +368,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
};
|
||||
}
|
||||
|
||||
internal class Mux2bGate : GateDefinition
|
||||
internal class Mux2bGate : StatelessGateDefinition
|
||||
{
|
||||
public new string Name => "2bits Mux";
|
||||
public override string[] Inputs { get; } = new string[] { "E", "S₀", "S₁", "D₀", "D₁", "D₂", "D₃" };
|
||||
@@ -395,7 +395,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
};
|
||||
}
|
||||
|
||||
internal class Demux2bGate : GateDefinition
|
||||
internal class Demux2bGate : StatelessGateDefinition
|
||||
{
|
||||
public new string Name => "2bits Demux";
|
||||
public override string[] Inputs { get; } = new string[] { "E", "S₀", "S₁", "D" };
|
||||
@@ -417,7 +417,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
};
|
||||
}
|
||||
|
||||
internal class Enc2b4bGate : GateDefinition
|
||||
internal class Enc2b4bGate : StatelessGateDefinition
|
||||
{
|
||||
public new string Name => "2b/4b Enc.";
|
||||
public override string[] Inputs { get; } = new string[] { "D₀", "D₁" };
|
||||
@@ -437,7 +437,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
};
|
||||
}
|
||||
|
||||
internal class Dec4b2bGate : GateDefinition
|
||||
internal class Dec4b2bGate : StatelessGateDefinition
|
||||
{
|
||||
public new string Name => "4b/2b Dec.";
|
||||
public override string[] Inputs { get; } = new string[] { "D₀", "D₁", "D₂", "D₃"};
|
||||
@@ -461,7 +461,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
|
||||
#region 700 - Registers
|
||||
|
||||
internal class SISO4bGate : StateGateDefinition
|
||||
internal class SISO4bGate : StatefulGateDefinition
|
||||
{
|
||||
public new string Name => "4bits SISO";
|
||||
public override string[] Inputs { get; } = new string[] { "CLK", "D" };
|
||||
@@ -489,7 +489,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
};
|
||||
}
|
||||
|
||||
internal class SIPO4bGate : StateGateDefinition
|
||||
internal class SIPO4bGate : StatefulGateDefinition
|
||||
{
|
||||
public new string Name => "4bits SIPO";
|
||||
public override string[] Inputs { get; } = new string[] { "CLK", "D" };
|
||||
@@ -517,7 +517,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
};
|
||||
}
|
||||
|
||||
internal class PIPO4bGate : StateGateDefinition
|
||||
internal class PIPO4bGate : StatefulGateDefinition
|
||||
{
|
||||
public new string Name => "4bits PIPO";
|
||||
public override string[] Inputs { get; } = new string[] { "CLK", "D₀", "D₁", "D₂", "D₃" };
|
||||
@@ -552,7 +552,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
|
||||
#region 800 - Counters
|
||||
|
||||
internal class Counter2bGate : StateGateDefinition
|
||||
internal class Counter2bGate : StatefulGateDefinition
|
||||
{
|
||||
public new string Name => "2bits Count.";
|
||||
public override string[] Inputs { get; } = new string[] { "CLK", "RST" };
|
||||
@@ -584,7 +584,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
||||
};
|
||||
}
|
||||
|
||||
internal class Counter4bGate : StateGateDefinition
|
||||
internal class Counter4bGate : StatefulGateDefinition
|
||||
{
|
||||
public new string Name => "4bits Count.";
|
||||
public override string[] Inputs { get; } = new string[] { "CLK", "RST" };
|
||||
|
||||
Reference in New Issue
Block a user