Exemplo n.º 1
0
        private void Trace(Connection c, TraceTrigger trigger)
        {
            if (c)
            {
                Resistor r = c.container as Resistor;

                if (r)
                {
                    resistors.Add(r);
                }

                Connection next = c.GetNext();
                if (next)
                {
                    if (next.container == powersource)
                    {
                        if (resistors.Count == 0)
                        {
                            circuitType = CircuitType.Short;
                        }
                        else
                        {
                            circuitType = CircuitType.Closed;
                        }

                        return;
                    }
                    else
                    {
                        Trace(next, trigger);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void Trace(TraceTrigger trigger = TraceTrigger.Test)
        {
            foreach (var v in resistors)
            {
                v.Activate(false);
            }

            resistors.Clear();
            circuitType = CircuitType.Open;
            Trace(powersource.live, trigger);

            foreach (var v in resistors)
            {
                v.Activate(circuitType == CircuitType.Closed);
            }

            Debug.LogFormat("Circuit result: {0}", circuitType);

            shortCircuit.SetActive(circuitType == CircuitType.Short);

            CallOnTraceComplete?.Invoke(circuitType, trigger);
        }
 public ReportFileTraceLine(TraceTrigger traceTrigger)
 {
     this.TraceTrigger = traceTrigger;
     this.experimentObservers = new List<ExperimentObserver>();
 }