Example #1
0
        protected CircuitNode(CircuitManager manager, int inputCount, int outputCount, bool hasReset, Port.PortType statePortType = StatePort.PortType.None)
        {
            this.inputPortCount  = inputCount;
            this.outputPortCount = outputCount;
            this.hasReset        = hasReset;
            this.settings        = CreateSettings();
            int totalInputCount = inputCount + (hasReset ? 1 : 0);

            inputPorts = new InputPort[totalInputCount];
            for (int i = 0; i < inputCount; i++)
            {
                inputPorts[i] = new InputPort(this, false);
                inputPorts[i].UnconnectedValue = DefaultInputValue(i);
                inputPorts[i].ValueChanged    += CircuitNode_ValueChanged;
                inputPorts[i].Connected       += CircuitNode_Connected;
                inputPorts[i].Disconnected    += CircuitNode_Disconnected;
            }
            if (hasReset)
            {
                inputPorts[inputCount] = new InputPort(this, true);
                inputPorts[inputCount].UnconnectedValue = false;
                inputPorts[inputCount].ValueChanged    += CircuitNode_ValueChanged;
                inputPorts[inputCount].Connected       += CircuitNode_Connected;
                inputPorts[inputCount].Disconnected    += CircuitNode_Disconnected;
            }

            int totalOutputCount = outputCount + (hasReset ? 1 : 0);

            outputPorts = new OutputPort[totalOutputCount];
            for (int i = 0; i < outputCount; i++)
            {
                outputPorts[i] = new OutputPort(this, false);
                outputPorts[i].expectedType  = ExpectedOutputType(i);
                outputPorts[i].Connected    += CircuitNode_Connected;
                outputPorts[i].Disconnected += CircuitNode_Disconnected;
            }
            if (hasReset)
            {
                outputPorts[outputCount]               = new OutputPort(this, true);
                outputPorts[outputCount].Connected    += CircuitNode_Connected;
                outputPorts[outputCount].Disconnected += CircuitNode_Disconnected;
            }

            if ((statePortType & Port.PortType.StatePort) != 0)
            {
                statePort = new StatePort(this, (statePortType & Port.PortType.StateRoot) == Port.PortType.StateRoot);
            }

            Manager = manager;
        }
Example #2
0
        protected override CircuitNode CreateNode(CircuitManager manager)
        {
            switch (type)
            {
            case GizmoType.Piston:
                return(new Piston(manager));

            case GizmoType.Rotator:
                return(new Rotator(manager));

            case GizmoType.LookAt:
                return(new LookAt(manager));

            case GizmoType.Clamp:
                return(new Clamp(manager));

            default:
                return(null);
            }
        }
Example #3
0
 protected override CircuitNode CreateNode(CircuitManager manager)
 {
     return(sign = new Sign(manager));
 }
Example #4
0
 public SqrtChip(CircuitManager manager)
     : base(manager)
 {
 }
 protected AdvancedCombarerChipBase(CircuitManager manager)
     : base(manager, 4, 2, true)
 {
 }
Example #6
0
        protected override CircuitNode CreateNode(CircuitManager manager)
        {
            switch (type)
            {
            case ChipType.Add:
                return(new AddChip(manager));

            case ChipType.Subtract:
                return(new SubtractChip(manager));

            case ChipType.Multiply:
                return(new MultiplyChip(manager));

            case ChipType.Divide:
                return(new DivideChip(manager));

            case ChipType.Modulo:
                return(new ModuloChip(manager));

            case ChipType.And:
                return(new AndChip(manager));

            case ChipType.Or:
                return(new OrChip(manager));

            case ChipType.Not:
                return(new NotChip(manager));

            case ChipType.Equal:
                return(new SimpleEqualsChip(manager));

            case ChipType.NotEqual:
                return(new SimpleNotEqualsChip(manager));

            case ChipType.GreaterThan:
                return(new SimpleGreaterThanChip(manager));

            case ChipType.GreaterThanOrEqual:
                return(new SimpleGreaterThanOrEqualChip(manager));

            case ChipType.LessThan:
                return(new SimpleLessThanChip(manager));

            case ChipType.LessThanOrEqual:
                return(new SimpleLessThanOrEqualChip(manager));

            case ChipType.AdvancedEqual:
                return(new AdvancedEqualsChip(manager));

            case ChipType.AdvancedNotEqual:
                return(new AdvancedNotEqualsChip(manager));

            case ChipType.AdvancedGreaterThan:
                return(new AdvancedGreaterThanChip(manager));

            case ChipType.AdvancedGreaterThanOrEqual:
                return(new AdvancedGreaterThanOrEqualChip(manager));

            case ChipType.AdvancedLessThan:
                return(new AdvancedLessThanChip(manager));

            case ChipType.AdvancedLessThanOrEqual:
                return(new AdvancedLessThanOrEqualChip(manager));

            case ChipType.Variable:
                return(new VariableChip(manager));

            case ChipType.Delay:
                return(new DelayChip(manager));

            case ChipType.Timer:
                return(new TimerChip(manager));

            case ChipType.Random:
                return(new RandomChip(manager));

            case ChipType.Selector:
                return(new SelectorChip(manager));

            case ChipType.StateMachine:
                return(new StateMachineChip(manager));

            case ChipType.State:
                return(new StateChip(manager));

            case ChipType.ExtBreakpoint:
                return(new BreakpointChip(manager));

            case ChipType.ExtBitwiseComplement:
                return(new BitwiseComplementChip(manager));

            case ChipType.ExtBitshiftLeft:
                return(new BitshiftLeftChip(manager));

            case ChipType.ExtBitshiftRight:
                return(new BitshiftRightChip(manager));

            case ChipType.ExtBitwiseAnd:
                return(new BitwiseAndChip(manager));

            case ChipType.ExtBitwiseOr:
                return(new BitwiseOrChip(manager));

            case ChipType.ExtBitwiseXor:
                return(new BitwiseXorChip(manager));

            case ChipType.ExtValueStore:
                return(new ValueStoreChip(manager));

            case ChipType.ExtBuffer:
                return(new BufferChip(manager));

            case ChipType.ExtArray:
                return(new ArrayChip(manager));

            case ChipType.ExtMultiplexer:
                return(new MultiplexerChip(manager));

            case ChipType.ExtMathConstants:
                return(new MathConstantsChip(manager));

            case ChipType.ExtMathAbs:
                return(new AbsChip(manager));

            case ChipType.ExtMathSign:
                return(new SignChip(manager));

            case ChipType.ExtMathClamp:
                return(new ClampChip(manager));

            case ChipType.ExtMathRound:
                return(new RoundChip(manager));

            case ChipType.ExtMathCeil:
                return(new CeilChip(manager));

            case ChipType.ExtMathFloor:
                return(new FloorChip(manager));

            case ChipType.ExtMathSin:
                return(new SinChip(manager));

            case ChipType.ExtMathCos:
                return(new CosChip(manager));

            case ChipType.ExtMathTan:
                return(new TanChip(manager));

            case ChipType.ExtMathAtan:
                return(new AtanChip(manager));

            case ChipType.ExtMathAtan2:
                return(new Atan2Chip(manager));

            case ChipType.ExtMathSqrt:
                return(new SqrtChip(manager));

            case ChipType.ExtMathExp:
                return(new ExpChip(manager));

            case ChipType.ExtMathPow:
                return(new PowChip(manager));

            case ChipType.ExtMathLog:
                return(new LogChip(manager));

            default:
                return(null);
            }
        }
Example #7
0
 public BitshiftRightChip(CircuitManager manager)
     : base(manager)
 {
 }
Example #8
0
 public AdvancedNotEqualsChip(CircuitManager manager) : base(manager)
 {
 }
Example #9
0
 public RandomChip(CircuitManager manager) : base(manager, 3, 1, false)
 {
 }
Example #10
0
 public DelayChip(CircuitManager manager) : base(manager, 2, 1, true)
 {
 }
Example #11
0
 public BufferChip(CircuitManager manager)
     : base(manager, 7, 2, true)
 {
 }
Example #12
0
 public AtanChip(CircuitManager manager)
     : base(manager)
 {
 }
Example #13
0
 public RoundChip(CircuitManager manager)
     : base(manager)
 {
 }
Example #14
0
 public MultiplyChip(CircuitManager manager)
     : base(manager)
 {
 }
Example #15
0
 public TimerChip(CircuitManager manager) : base(manager, 2, 2, true)
 {
 }
Example #16
0
 public RRButton(CircuitManager manager) : base(manager, 0, 3, false)
 {
 }
Example #17
0
 public AdvancedGreaterThanChip(CircuitManager manager) : base(manager)
 {
 }
Example #18
0
 public AdvancedLessThanChip(CircuitManager manager) : base(manager)
 {
 }
Example #19
0
		public MultiplexerChip(CircuitManager manager)
			: base(manager, 7, 1, true)
		{
		}
Example #20
0
 public BitwiseXorChip(CircuitManager manager)
     : base(manager)
 {
 }
Example #21
0
 public SimpleLessThanChip(CircuitManager manager) : base(manager)
 {
 }
Example #22
0
 public SelectorChip(CircuitManager manager) : base(manager, 2, 7, true)
 {
 }
Example #23
0
 public CosChip(CircuitManager manager)
     : base(manager)
 {
 }
Example #24
0
 protected SimpleCombarerChipBase(CircuitManager manager)
     : base(manager, 2, 2, true)
 {
 }
Example #25
0
 public SimpleNotEqualsChip(CircuitManager manager) : base(manager)
 {
 }
Example #26
0
 protected SimpleCombinatorChip(CircuitManager manager)
     : base(manager, 2, 1, true)
 {
 }
Example #27
0
 public Gizmo(CircuitManager manager, int inputCount) :
     base(manager, inputCount, 0, false)
 {
 }
Example #28
0
 public LogChip(CircuitManager manager)
     : base(manager)
 {
 }
Example #29
0
 public SimpleGreaterThanOrEqualChip(CircuitManager manager) : base(manager)
 {
 }
Example #30
0
 public ClampChip(CircuitManager manager)
     : base(manager, 3, 1, true)
 {
 }