예제 #1
0
        /******************************************* UNITY FUNCTIONS ********************************************
         * This section holds all functions strictly related to Unity, such as updates, collision detection etc.*
         * In principle, every function in this section will run once per frame, except Start().                *
         **********************************************************************************************************/

        // Use this for initialization
        void Start()
        {
            DontDestroyOnLoad(initializer);

            xmlInterpreter = new XMLInterpreter();

            string        path  = Constants.teamsDirectory;
            List <string> teams = xmlInterpreter.allTeamsInXmlFiles(path);

            red_team.AddOptions(teams);
            blue_team.AddOptions(teams);

            initializer.GetComponent <Managers.Initializer>().red_team  = teams[0];
            initializer.GetComponent <Managers.Initializer>().blue_team = teams[0];
        }
예제 #2
0
        void Start()
        {
            /*A REECRIRE*/
            string         teamName    = "DoudouLaMalice";
            string         unitName    = "explorer";
            XMLInterpreter interpreter = new XMLInterpreter();

            List <Instruction> behavior = new List <Instruction>();

            /** Ecriture d'un fichier xml **/

/*            Condition bag = new IsBagEmpty();
 *          Action idle = new Idle();
 *          Action shoot = new Shoot();
 *          Action move = new Move();
 *          When when = new When();
 *
 *          when.addCondition(bag);
 *          when.addAction(move);
 *          when.addAction(shoot);
 *
 *          behavior.Add(when);
 *          behavior.Add(idle);
 *
 */         interpreter.behaviorToXml(teamName, Constants.teamsDirectory, unitName, behavior);
            Debug.Log("fini");

            /*
             * behavior = interpreter.xmlToUnitBehavior(teamName, Constants.teamsDirectory, unitName);
             * Debug.Log(behavior.Count);
             * foreach(Instruction i in behavior)
             * {
             *  Debug.Log(i.xmlStructure().OuterXml);
             * }
             * /* */
        }