Пример #1
0
    public Supervisor(XElement automaton, StructurePlant parentPlant)
    {
        // Get Nodes
        IEnumerable events      = automaton.Descendants("Event");      // Enumerável de eventos
        IEnumerable states      = automaton.Descendants("State");      // Enumerável de estados
        IEnumerable transitions = automaton.Descendants("Transition"); // Enumerável de transições


        // Get lists
        eventsContainer = LoadEvents(events);
        statesContainer = LoadStates(states, parentPlant.shape);
        transitionsList = LoadTransitions(transitions);
    }
    //Load the Simulation for one supervisor
    void LoadScenario()
    {
        //Load Selected Scenario or the Default one
        GameObject sceneInfo = GameObject.FindGameObjectWithTag("SceneInfo");

        if (sceneInfo != null)
        {
            supervisorName = sceneInfo.GetComponent <Text>().text.Split('-')[0];
            firstSup       = int.Parse(sceneInfo.GetComponent <Text>().text.Split('-')[1]);
            firstState     = sceneInfo.GetComponent <Text>().text.Split('-')[2];
            print("Loaded: " + supervisorName + "supervisor");
        }
        else
        {
            supervisorName = defaultSupervisor;
            print("Loaded: " + defaultSupervisor + "(Default) supervisor");
        }


        // Setup Scenario StructurePlant
        structurePlant = new StructurePlant(supervisorName);

        Destroy(sceneInfo);
    }
 public void SetStructurePlant(StructurePlant plant)
 {
     structurePlant = plant;
 }