stateful gates
This commit is contained in:
@@ -98,7 +98,7 @@ SpriteRenderer:
|
|||||||
m_RenderingLayerMask: 1
|
m_RenderingLayerMask: 1
|
||||||
m_RendererPriority: 0
|
m_RendererPriority: 0
|
||||||
m_Materials:
|
m_Materials:
|
||||||
- {fileID: 2100000, guid: 73ddb2958e9cd451c82f37c26efa5eb0, type: 2}
|
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
m_StaticBatchInfo:
|
m_StaticBatchInfo:
|
||||||
firstSubMesh: 0
|
firstSubMesh: 0
|
||||||
subMeshCount: 0
|
subMeshCount: 0
|
||||||
@@ -152,7 +152,7 @@ PolygonCollider2D:
|
|||||||
adaptiveTilingThreshold: 0
|
adaptiveTilingThreshold: 0
|
||||||
drawMode: 0
|
drawMode: 0
|
||||||
adaptiveTiling: 0
|
adaptiveTiling: 0
|
||||||
m_AutoTiling: 0
|
m_AutoTiling: 1
|
||||||
m_Points:
|
m_Points:
|
||||||
m_Paths:
|
m_Paths:
|
||||||
- - {x: 0, y: 1}
|
- - {x: 0, y: 1}
|
||||||
|
|||||||
@@ -530,7 +530,7 @@ MonoBehaviour:
|
|||||||
GateSprites:
|
GateSprites:
|
||||||
- {fileID: 21300000, guid: 7c428151c48a9e7469e49309fd0842fb, type: 3}
|
- {fileID: 21300000, guid: 7c428151c48a9e7469e49309fd0842fb, type: 3}
|
||||||
- {fileID: 21300000, guid: 93ae44d6ee7ae4c4bbfef39811752f3a, type: 3}
|
- {fileID: 21300000, guid: 93ae44d6ee7ae4c4bbfef39811752f3a, type: 3}
|
||||||
- {fileID: -620755829403384321, guid: da2a0d4ce655c0d4cbbb94bd47b72db7, type: 3}
|
- {fileID: 21300000, guid: da2a0d4ce655c0d4cbbb94bd47b72db7, type: 3}
|
||||||
- {fileID: 21300000, guid: 01327adc9a6ecc64f86ce22adff1a362, type: 3}
|
- {fileID: 21300000, guid: 01327adc9a6ecc64f86ce22adff1a362, type: 3}
|
||||||
- {fileID: 21300000, guid: bcba8dfefa97b414f9d2e8ab38cc5e68, type: 3}
|
- {fileID: 21300000, guid: bcba8dfefa97b414f9d2e8ab38cc5e68, type: 3}
|
||||||
- {fileID: 21300000, guid: 6bd139aab8ffc4e46941870cf98a7b92, type: 3}
|
- {fileID: 21300000, guid: 6bd139aab8ffc4e46941870cf98a7b92, type: 3}
|
||||||
@@ -565,6 +565,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 11e573998e532eb42bdb43b80953d23f, type: 3}
|
m_Script: {fileID: 11500000, guid: 11e573998e532eb42bdb43b80953d23f, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
MinDistanceInteracting: 0.5
|
||||||
DoubleClickThreshold: 0.05
|
DoubleClickThreshold: 0.05
|
||||||
DoubleClickDelay: 0.5
|
DoubleClickDelay: 0.5
|
||||||
DefaultCursor: {fileID: 2800000, guid: 65e646daa3ca2db4f991e6231e8dce8f, type: 3}
|
DefaultCursor: {fileID: 2800000, guid: 65e646daa3ca2db4f991e6231e8dce8f, type: 3}
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ namespace UntitledLogicGame
|
|||||||
|
|
||||||
#region Unity Properties
|
#region Unity Properties
|
||||||
|
|
||||||
|
[Header("Interaction")]
|
||||||
|
public float MinDistanceInteracting;
|
||||||
|
|
||||||
[Header("Click")]
|
[Header("Click")]
|
||||||
public float DoubleClickThreshold;
|
public float DoubleClickThreshold;
|
||||||
public float DoubleClickDelay;
|
public float DoubleClickDelay;
|
||||||
@@ -30,8 +33,9 @@ namespace UntitledLogicGame
|
|||||||
#region Public Properties
|
#region Public Properties
|
||||||
|
|
||||||
public static Vector3 MousePos { get; set; }
|
public static Vector3 MousePos { get; set; }
|
||||||
public bool Interacting => _currentCable != null || _currentGate != null;
|
public bool Interacting => DraggingCable || MovingObject;
|
||||||
public bool MovingObject => _currentGate != null;
|
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 Clicking => Input.GetButton("Fire1");
|
||||||
public bool DeleteOnRelease { get; set; }
|
public bool DeleteOnRelease { get; set; }
|
||||||
|
|
||||||
@@ -40,6 +44,7 @@ namespace UntitledLogicGame
|
|||||||
#region Private Properties
|
#region Private Properties
|
||||||
|
|
||||||
private Cable _currentCable;
|
private Cable _currentCable;
|
||||||
|
private Vector3 _currentCableInitialMousePos;
|
||||||
private Gate _currentGate;
|
private Gate _currentGate;
|
||||||
private Vector3? _currentGateInitialPos;
|
private Vector3? _currentGateInitialPos;
|
||||||
private Vector3 _currentGateDelta;
|
private Vector3 _currentGateDelta;
|
||||||
@@ -133,13 +138,14 @@ namespace UntitledLogicGame
|
|||||||
{
|
{
|
||||||
var cursor = DefaultCursor;
|
var cursor = DefaultCursor;
|
||||||
var position = Vector2.zero;
|
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;
|
cursor = PointerCursor;
|
||||||
position = new Vector2(cursor.width / 2f, 0f);
|
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;
|
cursor = MoveCursor;
|
||||||
position = new Vector2(cursor.width / 2f, cursor.height / 2f);
|
position = new Vector2(cursor.width / 2f, cursor.height / 2f);
|
||||||
@@ -167,6 +173,7 @@ namespace UntitledLogicGame
|
|||||||
_currentCable = Instantiate(GameManager.Instance.CablePrefab, GameManager.Instance.CablesGroup, true);
|
_currentCable = Instantiate(GameManager.Instance.CablePrefab, GameManager.Instance.CablesGroup, true);
|
||||||
_currentCable.StartAnchor = GameManager.Instance.CurrentAnchor;
|
_currentCable.StartAnchor = GameManager.Instance.CurrentAnchor;
|
||||||
_currentCable.FallbackEndPos = MousePos;
|
_currentCable.FallbackEndPos = MousePos;
|
||||||
|
_currentCableInitialMousePos = MousePos;
|
||||||
}
|
}
|
||||||
else if (GameManager.Instance.CurrentGate != null) // Dragging new gate
|
else if (GameManager.Instance.CurrentGate != null) // Dragging new gate
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
@@ -11,6 +12,19 @@ namespace UntitledLogicGame.UI
|
|||||||
{
|
{
|
||||||
public class UIGate : UIToolbarButton
|
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
|
#region Unity Properties
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -23,9 +37,9 @@ namespace UntitledLogicGame.UI
|
|||||||
{
|
{
|
||||||
var sprite = value.GetComponentInChildren<SpriteRenderer>().sprite;
|
var sprite = value.GetComponentInChildren<SpriteRenderer>().sprite;
|
||||||
Image.sprite = sprite;
|
Image.sprite = sprite;
|
||||||
Image.GetComponent<RectTransform>().sizeDelta = new Vector2(100f, 100 * sprite.rect.width / 700f); // TODO get max width from UIManager
|
Image.GetComponent<RectTransform>().sizeDelta = new Vector2(100f, 100 * sprite.rect.width / MaxSize);
|
||||||
gameObject.name = "UI_" + value.Definition.Name;
|
gameObject.name = "UI_" + value.GateType.ToString();
|
||||||
Text.text = value.Definition.Name;
|
Text.text = value.UIName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ namespace UntitledLogicGame.Workspace
|
|||||||
return _definition;
|
return _definition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public string UIName { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -70,7 +71,7 @@ namespace UntitledLogicGame.Workspace
|
|||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
Utils.RandomName(Definition.Name, gameObject);
|
Utils.RandomName(GateType.ToString(), gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ namespace UntitledLogicGame.Workspace
|
|||||||
private Anchor _anchorPrefab;
|
private Anchor _anchorPrefab;
|
||||||
private Anchor _bigAnchorPrefab;
|
private Anchor _bigAnchorPrefab;
|
||||||
private List<Sprite> _gateSprites;
|
private List<Sprite> _gateSprites;
|
||||||
|
private Sprite _defaultSprite => _gateSprites.First(s => s.name == "default");
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -64,9 +65,19 @@ namespace UntitledLogicGame.Workspace
|
|||||||
|
|
||||||
gate.GateType = (GateType)key;
|
gate.GateType = (GateType)key;
|
||||||
|
|
||||||
|
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);
|
var sprite = _gateSprites.First(s => s.name == item.Skin);
|
||||||
gate.Sprite.Renderer.sprite = sprite;
|
gate.Sprite.Renderer.sprite = sprite;
|
||||||
|
}
|
||||||
gate.Sprite.ResetCollider();
|
gate.Sprite.ResetCollider();
|
||||||
|
|
||||||
if(item.Input != null && item.Input.Count > 0)
|
if(item.Input != null && item.Input.Count > 0)
|
||||||
@@ -101,7 +112,7 @@ namespace UntitledLogicGame.Workspace
|
|||||||
1f
|
1f
|
||||||
);
|
);
|
||||||
|
|
||||||
Debug.Log($"Loaded gate {gate.Definition.Name}");
|
Debug.Log($"Loaded gate {key} {gate.GateType}");
|
||||||
|
|
||||||
return gate;
|
return gate;
|
||||||
}
|
}
|
||||||
@@ -122,6 +133,7 @@ namespace UntitledLogicGame.Workspace
|
|||||||
public class GateBookItem
|
public class GateBookItem
|
||||||
{
|
{
|
||||||
public string Skin { get; set; }
|
public string Skin { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
public int Width { get; set; }
|
public int Width { get; set; }
|
||||||
public int Height { get; set; }
|
public int Height { get; set; }
|
||||||
public string Class { get; set; }
|
public string Class { get; set; }
|
||||||
|
|||||||
@@ -60,7 +60,8 @@ namespace UntitledLogicGame.Workspace
|
|||||||
public void ResetCollider()
|
public void ResetCollider()
|
||||||
{
|
{
|
||||||
Destroy(GetComponent<PolygonCollider2D>());
|
Destroy(GetComponent<PolygonCollider2D>());
|
||||||
gameObject.AddComponent<PolygonCollider2D>();
|
var collider = gameObject.AddComponent<PolygonCollider2D>();
|
||||||
|
collider.autoTiling = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -19,8 +19,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
|||||||
// Public properties
|
// Public properties
|
||||||
public GateType Type { get; private set; }
|
public GateType Type { get; private set; }
|
||||||
public GateCategory Category => (GateCategory)((int)Type / 100);
|
public GateCategory Category => (GateCategory)((int)Type / 100);
|
||||||
public string Name => Type.ToString();
|
public abstract bool HasState { get; }
|
||||||
public bool HasState => false;
|
|
||||||
public Dictionary<InputState, OutputState> TruthTable { get; private set; } = new Dictionary<InputState, OutputState>();
|
public Dictionary<InputState, OutputState> TruthTable { get; private set; } = new Dictionary<InputState, OutputState>();
|
||||||
|
|
||||||
// Herited properties
|
// 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
|
#region 000 - Technical
|
||||||
|
|
||||||
internal class NoneGate : GateDefinition
|
internal class NoneGate : StatelessGateDefinition
|
||||||
{
|
{
|
||||||
public override string[] Inputs { get; } = new string[] { };
|
public override string[] Inputs { get; } = new string[] { };
|
||||||
public override string[] Outputs { get; } = new string[] { };
|
public override string[] Outputs { get; } = new string[] { };
|
||||||
@@ -25,7 +25,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
|||||||
|
|
||||||
#region 200 - Basic
|
#region 200 - Basic
|
||||||
|
|
||||||
internal class BUFGate : GateDefinition
|
internal class BUFGate : StatelessGateDefinition
|
||||||
{
|
{
|
||||||
public override string[] Inputs { get; } = new string[] { "A" };
|
public override string[] Inputs { get; } = new string[] { "A" };
|
||||||
public override string[] Outputs { get; } = new string[] { "Q" };
|
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 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[] Inputs { get; } = new string[] { "A", "B" };
|
||||||
public override string[] Outputs { get; } = new string[] { "Q" };
|
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 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[] Inputs { get; } = new string[] { "A", "B" };
|
||||||
public override string[] Outputs { get; } = new string[] { "Q" };
|
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 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[] Inputs { get; } = new string[] { "A", "B" };
|
||||||
public override string[] Outputs { get; } = new string[] { "Q" };
|
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 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[] Inputs { get; } = new string[] { "A" };
|
||||||
public override string[] Outputs { get; } = new string[] { "Q" };
|
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 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[] Inputs { get; } = new string[] { "A", "B" };
|
||||||
public override string[] Outputs { get; } = new string[] { "Q" };
|
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 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[] Inputs { get; } = new string[] { "A", "B" };
|
||||||
public override string[] Outputs { get; } = new string[] { "Q" };
|
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 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[] Inputs { get; } = new string[] { "A", "B" };
|
||||||
public override string[] Outputs { get; } = new string[] { "Q" };
|
public override string[] Outputs { get; } = new string[] { "Q" };
|
||||||
@@ -93,7 +93,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
|||||||
|
|
||||||
#region 300 - Latches
|
#region 300 - Latches
|
||||||
|
|
||||||
internal class SRLatchGate : StateGateDefinition
|
internal class SRLatchGate : StatefulGateDefinition
|
||||||
{
|
{
|
||||||
public new string Name => "SR Latch";
|
public new string Name => "SR Latch";
|
||||||
public override string[] Inputs { get; } = new string[] { "S", "R" };
|
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 new string Name => "JK Latch";
|
||||||
public override string[] Inputs { get; } = new string[] { "J", "K" };
|
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 new string Name => "D Latch";
|
||||||
public override string[] Inputs { get; } = new string[] { "D", "E" };
|
public override string[] Inputs { get; } = new string[] { "D", "E" };
|
||||||
@@ -157,7 +157,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
|||||||
|
|
||||||
#region 400 - Flip-Flops
|
#region 400 - Flip-Flops
|
||||||
|
|
||||||
internal class SRFlipFlopGate : StateGateDefinition
|
internal class SRFlipFlopGate : StatefulGateDefinition
|
||||||
{
|
{
|
||||||
public new string Name => "SR Flip-Flop";
|
public new string Name => "SR Flip-Flop";
|
||||||
public override string[] Inputs { get; } = new string[] { "CLK", "S", "R" };
|
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 new string Name => "JK Flip-Flop";
|
||||||
public override string[] Inputs { get; } = new string[] { "CLK", "J", "K" };
|
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 new string Name => "D Flip-Flop";
|
||||||
public override string[] Inputs { get; } = new string[] { "CLK", "D" };
|
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 new string Name => "T Flip-Flop";
|
||||||
public override string[] Inputs { get; } = new string[] { "CLK", "T" };
|
public override string[] Inputs { get; } = new string[] { "CLK", "T" };
|
||||||
@@ -252,7 +252,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
|||||||
|
|
||||||
#region 500 - Arithmetic
|
#region 500 - Arithmetic
|
||||||
|
|
||||||
internal class HalfAddGate : GateDefinition
|
internal class HalfAddGate : StatelessGateDefinition
|
||||||
{
|
{
|
||||||
public new string Name => "Half Add.";
|
public new string Name => "Half Add.";
|
||||||
public override string[] Inputs { get; } = new string[] { "A", "B" };
|
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 new string Name => "Full Add.";
|
||||||
public override string[] Inputs { get; } = new string[] { "A", "B", "Cɪ" };
|
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 new string Name => "Half Sub.";
|
||||||
public override string[] Inputs { get; } = new string[] { "A", "B" };
|
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 new string Name => "Full Add.";
|
||||||
public override string[] Inputs { get; } = new string[] { "A", "B", "Cɪ" };
|
public override string[] Inputs { get; } = new string[] { "A", "B", "Cɪ" };
|
||||||
@@ -332,7 +332,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
|||||||
|
|
||||||
#region 600 - Data
|
#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[] Inputs { get; } = new string[] { "E", "S", "D₀", "D₁" };
|
||||||
public override string[] Outputs { get; } = new string[] { "Y" };
|
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[] Inputs { get; } = new string[] { "E", "S", "D" };
|
||||||
public override string[] Outputs { get; } = new string[] { "Y₀", "Y₁" };
|
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 new string Name => "2bits Mux";
|
||||||
public override string[] Inputs { get; } = new string[] { "E", "S₀", "S₁", "D₀", "D₁", "D₂", "D₃" };
|
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 new string Name => "2bits Demux";
|
||||||
public override string[] Inputs { get; } = new string[] { "E", "S₀", "S₁", "D" };
|
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 new string Name => "2b/4b Enc.";
|
||||||
public override string[] Inputs { get; } = new string[] { "D₀", "D₁" };
|
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 new string Name => "4b/2b Dec.";
|
||||||
public override string[] Inputs { get; } = new string[] { "D₀", "D₁", "D₂", "D₃"};
|
public override string[] Inputs { get; } = new string[] { "D₀", "D₁", "D₂", "D₃"};
|
||||||
@@ -461,7 +461,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
|||||||
|
|
||||||
#region 700 - Registers
|
#region 700 - Registers
|
||||||
|
|
||||||
internal class SISO4bGate : StateGateDefinition
|
internal class SISO4bGate : StatefulGateDefinition
|
||||||
{
|
{
|
||||||
public new string Name => "4bits SISO";
|
public new string Name => "4bits SISO";
|
||||||
public override string[] Inputs { get; } = new string[] { "CLK", "D" };
|
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 new string Name => "4bits SIPO";
|
||||||
public override string[] Inputs { get; } = new string[] { "CLK", "D" };
|
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 new string Name => "4bits PIPO";
|
||||||
public override string[] Inputs { get; } = new string[] { "CLK", "D₀", "D₁", "D₂", "D₃" };
|
public override string[] Inputs { get; } = new string[] { "CLK", "D₀", "D₁", "D₂", "D₃" };
|
||||||
@@ -552,7 +552,7 @@ namespace UntitledLogicGame.Workspace.Gates
|
|||||||
|
|
||||||
#region 800 - Counters
|
#region 800 - Counters
|
||||||
|
|
||||||
internal class Counter2bGate : StateGateDefinition
|
internal class Counter2bGate : StatefulGateDefinition
|
||||||
{
|
{
|
||||||
public new string Name => "2bits Count.";
|
public new string Name => "2bits Count.";
|
||||||
public override string[] Inputs { get; } = new string[] { "CLK", "RST" };
|
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 new string Name => "4bits Count.";
|
||||||
public override string[] Inputs { get; } = new string[] { "CLK", "RST" };
|
public override string[] Inputs { get; } = new string[] { "CLK", "RST" };
|
||||||
|
|||||||
@@ -92,3 +92,33 @@ list:
|
|||||||
- B 0.5 3.5 W
|
- B 0.5 3.5 W
|
||||||
output:
|
output:
|
||||||
- Q 6.5 2.5 E
|
- Q 6.5 2.5 E
|
||||||
|
300:
|
||||||
|
name: SR Latch
|
||||||
|
width: 5
|
||||||
|
height: 6
|
||||||
|
input:
|
||||||
|
- S 0.5 1.5 W
|
||||||
|
- R 0.5 4.5 W
|
||||||
|
output:
|
||||||
|
- Q 4.5 1.5 W
|
||||||
|
- Q̅ 4.5 4.5 W
|
||||||
|
310:
|
||||||
|
name: JK Latch
|
||||||
|
width: 5
|
||||||
|
height: 6
|
||||||
|
input:
|
||||||
|
- J 0.5 1.5 W
|
||||||
|
- K 0.5 4.5 W
|
||||||
|
output:
|
||||||
|
- Q 4.5 1.5 W
|
||||||
|
- Q̅ 4.5 4.5 W
|
||||||
|
320:
|
||||||
|
name: D Latch
|
||||||
|
width: 5
|
||||||
|
height: 6
|
||||||
|
input:
|
||||||
|
- D 0.5 1.5 W
|
||||||
|
- E 0.5 4.5 W
|
||||||
|
output:
|
||||||
|
- Q 4.5 1.5 W
|
||||||
|
- Q̅ 4.5 4.5 W
|
||||||
@@ -68,13 +68,13 @@ TextureImporter:
|
|||||||
nPOTScale: 0
|
nPOTScale: 0
|
||||||
lightmap: 0
|
lightmap: 0
|
||||||
compressionQuality: 50
|
compressionQuality: 50
|
||||||
spriteMode: 2
|
spriteMode: 1
|
||||||
spriteExtrude: 1
|
spriteExtrude: 1
|
||||||
spriteMeshType: 1
|
spriteMeshType: 0
|
||||||
alignment: 1
|
alignment: 1
|
||||||
spritePivot: {x: 0.5, y: 0.5}
|
spritePivot: {x: 0, y: 1}
|
||||||
spritePixelsToUnits: 100
|
spritePixelsToUnits: 100
|
||||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
spriteBorder: {x: 100, y: 100, z: 100, w: 100}
|
||||||
spriteGenerateFallbackPhysicsShape: 1
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
alphaUsage: 1
|
alphaUsage: 1
|
||||||
alphaIsTransparency: 1
|
alphaIsTransparency: 1
|
||||||
@@ -148,7 +148,7 @@ TextureImporter:
|
|||||||
width: 100
|
width: 100
|
||||||
height: 100
|
height: 100
|
||||||
alignment: 0
|
alignment: 0
|
||||||
pivot: {x: 0, y: 0}
|
pivot: {x: 0.5, y: 0.5}
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
outline: []
|
outline: []
|
||||||
physicsShape: []
|
physicsShape: []
|
||||||
@@ -169,7 +169,7 @@ TextureImporter:
|
|||||||
width: 100
|
width: 100
|
||||||
height: 100
|
height: 100
|
||||||
alignment: 0
|
alignment: 0
|
||||||
pivot: {x: 0, y: 0}
|
pivot: {x: 0.5, y: 0.5}
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
outline: []
|
outline: []
|
||||||
physicsShape: []
|
physicsShape: []
|
||||||
@@ -190,7 +190,7 @@ TextureImporter:
|
|||||||
width: 100
|
width: 100
|
||||||
height: 100
|
height: 100
|
||||||
alignment: 0
|
alignment: 0
|
||||||
pivot: {x: 0, y: 0}
|
pivot: {x: 0.5, y: 0.5}
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
outline: []
|
outline: []
|
||||||
physicsShape: []
|
physicsShape: []
|
||||||
@@ -211,7 +211,7 @@ TextureImporter:
|
|||||||
width: 100
|
width: 100
|
||||||
height: 100
|
height: 100
|
||||||
alignment: 0
|
alignment: 0
|
||||||
pivot: {x: 0, y: 0}
|
pivot: {x: 0.5, y: 0.5}
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
outline: []
|
outline: []
|
||||||
physicsShape: []
|
physicsShape: []
|
||||||
@@ -232,7 +232,7 @@ TextureImporter:
|
|||||||
width: 100
|
width: 100
|
||||||
height: 100
|
height: 100
|
||||||
alignment: 0
|
alignment: 0
|
||||||
pivot: {x: 0, y: 0}
|
pivot: {x: 0.5, y: 0.5}
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
outline: []
|
outline: []
|
||||||
physicsShape: []
|
physicsShape: []
|
||||||
@@ -253,7 +253,7 @@ TextureImporter:
|
|||||||
width: 100
|
width: 100
|
||||||
height: 100
|
height: 100
|
||||||
alignment: 0
|
alignment: 0
|
||||||
pivot: {x: 0, y: 0}
|
pivot: {x: 0.5, y: 0.5}
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
outline: []
|
outline: []
|
||||||
physicsShape: []
|
physicsShape: []
|
||||||
@@ -274,7 +274,7 @@ TextureImporter:
|
|||||||
width: 100
|
width: 100
|
||||||
height: 100
|
height: 100
|
||||||
alignment: 0
|
alignment: 0
|
||||||
pivot: {x: 0, y: 0}
|
pivot: {x: 0.5, y: 0.5}
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
outline: []
|
outline: []
|
||||||
physicsShape: []
|
physicsShape: []
|
||||||
@@ -295,7 +295,7 @@ TextureImporter:
|
|||||||
width: 100
|
width: 100
|
||||||
height: 100
|
height: 100
|
||||||
alignment: 0
|
alignment: 0
|
||||||
pivot: {x: 0, y: 0}
|
pivot: {x: 0.5, y: 0.5}
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
outline: []
|
outline: []
|
||||||
physicsShape: []
|
physicsShape: []
|
||||||
@@ -316,7 +316,7 @@ TextureImporter:
|
|||||||
width: 100
|
width: 100
|
||||||
height: 100
|
height: 100
|
||||||
alignment: 0
|
alignment: 0
|
||||||
pivot: {x: 0, y: 0}
|
pivot: {x: 0.5, y: 0.5}
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
outline: []
|
outline: []
|
||||||
physicsShape: []
|
physicsShape: []
|
||||||
|
|||||||
Reference in New Issue
Block a user