Exemplo n.º 1
0
    void FixedUpdate()
    {
        //Debug.Log("Time " + (Time.time/speedUP));
        simulateToTime(simulator, (Time.time / speedUP));
        //simulateToTime(simulator, 0);
        float val;

        for (int i = 0; i < fmuVarRefs.Count; i++)
        {
            val = getRealValueForVarRef(simulator, fmuVarRefs[i]);
            //Debug.Log("get "+val.ToString()+" for var reference " + fmuVarRefs[i].ToString());
            FMUshapeBehaviour shapeGO = GameObject.Find(goIDs[i]).GetComponent <FMUshapeBehaviour>();
            shapeGO.setVarAttribute(attrIDs[i], val);
        }
        for (int i = 0; i < allFMUShapes.Count; i++)
        {
            FMUshapeBehaviour shapeGO = GameObject.Find(allFMUShapes[i]).GetComponent <FMUshapeBehaviour>();
            shapeGO.updateShapes();
        }
    }
Exemplo n.º 2
0
    void analyseShapeAttribute(GameObject shapeGO, XmlNode nodeIn, string shapeName, int attr)
    {
        // the vraiables attributes have to be put in the simulator
        FMU_Simulation fmuSim = simulatorGO.GetComponent <FMU_Simulation>();
        // the constant attributes have to go in the gameObject directly
        FMUshapeBehaviour fmuShape = shapeGO.GetComponent <FMUshapeBehaviour>();

        if (nodeIn.Name == "exp")
        {
            float val = Single.Parse(nodeIn.InnerText);
            //Debug.Log("constant exp "+attr.ToString()+" VAL: "+val.ToString());
            fmuShape.setVarAttribute(attr, val);
        }
        else if (nodeIn.Name == "cref")
        {
            fmuSim.goIDs.Add(shapeName);
            fmuSim.attrIDs.Add(attr);
            fmuSim.varNames.Add(nodeIn.InnerText);
            //FMU_Simulation.varAttr v = new FMU_Simulation.varAttr(shapeName,attr, nodeIn.InnerText, -1);
            //Debug.Log("THE VARATTR " + v1.debugString());
        }
    }