예제 #1
0
    //resolve the group. Only execute if dirty is set
    //return if there is a new resolving
    public void ResolveIfDirty()
    {
        if (dirtyBit == false)
        {
            return;
        }

        solver.Resolve();
        var newSolvers = solver.Split();

        foreach (var groupSolver in newSolvers)
        {
            ConductorGroup group = null;
            if (groupSolver == solver)
            {
                //the same group as this
                group        = this;
                group.solver = groupSolver;
            }
            else
            {
                group = new ConductorGroup(groupSolver);
            }

            var nodes = groupSolver.GetNodes(0);
            foreach (var node in nodes)
            {
                var newNode = (node as ElectricConductor);
                newNode.Group = group;
            }

            group.dirtyBit = false;
        }
        return;
    }
예제 #2
0
 private void Start()
 {
     Group = new ConductorGroup(new List <ElectricConductor>()
     {
         this
     });
     isOnPrev = IsOn;
 }