Upgrade structure of code base
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
using Enigmos.Modules.ControllingModules;
|
||||
using Enigmos.Ports;
|
||||
using Enigmos.Ports.DataPorts;
|
||||
using Godot;
|
||||
using Nocturnis.Enigmos.Modules;
|
||||
using Nocturnis.Enigmos.Ports;
|
||||
using TabulaSmaragdina.Constants;
|
||||
using Nocturnis.Enigmos.Ports.DataPorts.Directions;
|
||||
using Nocturnis.GlobalManagement.Constants;
|
||||
|
||||
namespace Enigmos.Modules.TerminalModules.TestingModules;
|
||||
|
||||
public partial class LightEmittingDiodeModule : TerminalModule
|
||||
{
|
||||
private Sprite2D LightEmittingDiode { get; set; }
|
||||
private DataInPort Input { get; set; }
|
||||
public override IEnumerable<IBasePort> Ports => new[] { Input };
|
||||
private Sprite2D? LightEmittingDiode { get; set; }
|
||||
private IDataInPort? Input { get; set; }
|
||||
public override IEnumerable<IBasePort> Ports => new[] { Input! };
|
||||
|
||||
private static readonly Texture2D TrueTexture =
|
||||
ResourceLoader.Load<Texture2D>("res://Resources/Circuits/Modules/Terminal/Testing/LEDBubble-T.png");
|
||||
@@ -22,17 +23,17 @@ public partial class LightEmittingDiodeModule : TerminalModule
|
||||
base.Init();
|
||||
Finished = true;
|
||||
LightEmittingDiode = GetNode<Sprite2D>("LightEmittingDiode");
|
||||
Input = GetPort<DataInPort>("Input");
|
||||
Input = this.GetPort<DataInPort>("Input");
|
||||
Input.SetDataType(EnigmosConstant.DataPortTypes.Bit);
|
||||
PostInit();
|
||||
}
|
||||
|
||||
protected override void Consume(RootModule root)
|
||||
public override void Drain()
|
||||
{
|
||||
if (Input.GetData(root).Bit)
|
||||
LightEmittingDiode.Texture = TrueTexture;
|
||||
if (Input!.GetData.Get!.Bit)
|
||||
LightEmittingDiode!.Texture = TrueTexture;
|
||||
else
|
||||
LightEmittingDiode.Texture = FalseTexture;
|
||||
LightEmittingDiode!.Texture = FalseTexture;
|
||||
Finished = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user