Ejemplo n.º 1
0
    public void SetTrapezoidal(bool val)
    {
        if (val != IsTrapezoidal)
        {
            AttChange change = new AttChange();

            List <float> prop = new List <float>();
            prop.Add((float)this.GetId());
            prop.Add((float)0.0);
            prop.Add((float)0.0);
            prop.Add((float)1.0);                   // value of attribute index,, not nessesary but just frameword for case of adding attributes
            prop.Add((float)1.0);                   // value as a sign of revertion of bool attribute

            change.SetChange(prop);
            UndoAction undoAction = new UndoAction();
            undoAction.AddChange(change);

            GUICircuitComponent.globalUndoList.AddUndo(undoAction);
        }
        IsTrapezoidal = val;
        if (GameObject.Find("PlayToggle").GetComponent <UnityEngine.UI.Toggle>().isOn)
        {
            GameObject.Find("PlayButton").GetComponent <GUICircuit>().RunSimulation();
        }
    }
Ejemplo n.º 2
0
    public void SetInductance(double val)
    {
        if (Inductance != val)
        {
            AttChange change = new AttChange();

            List <float> prop = new List <float>();
            prop.Add((float)this.GetId());
            prop.Add((float)1.0);                   // value of attribute index,, not nessesary but just frameword for case of adding attributes
            prop.Add((float)(Inductance - val));
            prop.Add((float)0.0);                   // hodnoty ostatnych atributov sa nezmenia
            prop.Add((float)0.0);

            change.SetChange(prop);
            UndoAction undoAction = new UndoAction();
            undoAction.AddChange(change);

            GUICircuitComponent.globalUndoList.AddUndo(undoAction);
        }
        Inductance = val;
        if (GameObject.Find("PlayToggle").GetComponent <UnityEngine.UI.Toggle>().isOn)
        {
            GameObject.Find("PlayButton").GetComponent <GUICircuit>().RunSimulation();
        }
    }