public TronicSequence(N8Tronic Initial, NodeType InitialOut = NodeType.FlowOutA) { data = new List<DataBlock>(); tronics = new N8BlockFactory(); CurrentTronic = (FlowTronic)Initial; CurrentOut = Initial.GetNode(InitialOut); sequence = new List<FlowTronic>(); Branches = new Stack<Tuple<FlowTronic, Node>>(); }
private void WireArithmeticNode(FlowTronic next, DataNodeIn DataInA, DataNodeIn DataInB, DataNodeOut DataOut, NodeType NextOut = NodeType.FlowOutA) { next.DataInA(DataInA); next.DataInB(DataInB); next.DataOutA(DataOut); Append(next, next.GetNode(NextOut)); }
private void Append(FlowTronic NextTronic, Node NextOut) { if (CurrentTronic != null) { NextTronic.FlowInFrom(CurrentTronic, CurrentOut); } CurrentTronic = NextTronic; CurrentOut = NextOut; sequence.Add(NextTronic); }
protected TronicSequence Target(string name = "Target") { Target p = tronics.Target(name); CurrentTronic = p; CurrentOut = p.GetNode(NodeType.FlowOutA); sequence.Add(p); return this; }
protected TronicSequence Proxy(string name = "Proxy") { Proxy p = tronics.Proxy(name); CurrentTronic = p; CurrentOut = p.GetNode(NodeType.FlowOutA); sequence.Add(p); return this; }
protected TronicSequence Keyboard(DataNodeOut Out, string name = "Keyboard") { Keyboard k = tronics.Keyboard(name); k.DataOutA(Out); CurrentTronic = k; CurrentOut = k.GetNode(NodeType.FlowOutA); sequence.Add(k); return this; }
protected TronicSequence CoinVendInit(string name = "CoinVend") { CoinVend c = tronics.CoinVend(name); CurrentTronic = c; CurrentOut = c.GetNode(NodeType.FlowOutB); sequence.Add(c); return this; }
protected TronicSequence Button(int type = 1, string name = "Button") { Button b = tronics.Button(type, name); CurrentTronic = b; CurrentOut = b.GetNode(NodeType.FlowOutA); sequence.Add(b); return this; }
public void FlowInFrom(FlowTronic n, NodeType Out = NodeType.FlowOutA) { this.GetFirst().FlowInFrom(n, Out); }
public TronicSequence Append(TronicSequence other) { if (this.CurrentTronic != null) { other.GetFirst().FlowInFrom(this.CurrentTronic, CurrentOut); } Tuple<FlowTronic, Node> temp = other.GetCurrent(); this.CurrentTronic = temp.Item1; this.CurrentOut = temp.Item2; this.sequence.AddRange(other.sequence); this.data.AddRange(other.data); this.tronics.CopyFromDestructive(other.tronics); return this; }
/// <summary> /// Wires one of this tronic's FlowOut nodes to another tronic's FlowIn node /// </summary> /// <param name="other">Which tronic to wire to</param> /// <param name="which">Which FlowOut node to use, out of FlowOutA or FlowOutB. Most nodes just have FlowOutA</param> public virtual void FlowOutTo(FlowTronic other, NodeType which = NodeType.FlowOutA) { if (!(which == NodeType.FlowOutA || which == NodeType.FlowOutB)) { throw new Exception("Expected a FlowOut node, got something else"); } this.WireTo(this.GetNode(which), other.GetNode(NodeType.FlowIn)); }
public virtual void FlowInFrom(FlowTronic other, Node which) { other.FlowOutTo(this, which.Type); }
/// <summary> /// Wires this tronic's FlowIn node to one of the other tronic's FlowOut nodes /// </summary> /// <param name="other">The other tronic that's being wired</param> /// <param name="which">Which FlowOut node to use</param> public virtual void FlowInFrom(FlowTronic other, NodeType which = NodeType.FlowOutA) { other.FlowOutTo(this, which); }