public ConfigurationGameViewModel()
 {
     Model           = new ConfigurationGame();
     AvailableColors = ((ConfigurationGame)Model).AvailableColors;
     SelectedPlayer  = null;
     IsCancelled     = false;
     Initialize();
 }
 public HistoriqueForm(ConfigurationGame conf, DateTime time, GameSimulation maSimulation)
 {
     InitializeComponent();
     this.conf         = conf;
     this.time         = time;
     this.maSimulation = maSimulation;
     ajoute_element();
 }
 public HistoriqueForm(ConfigurationGame conf, DateTime time, GameSimulation maSimulation)
 {
     InitializeComponent();
     this.conf = conf;
     this.time = time;
     this.maSimulation = maSimulation;
     ajoute_element();
 }
Пример #4
0
 void Awake()
 {
     //Check if instance already exists
     if (instance == null)
     {
         //if not, set instance to this
         instance = this;
     }
     //If instance already exists and it's not this:
     else if (instance != this)
     {
         //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
         Destroy(gameObject);
     }
 }
Пример #5
0
        static public void  GeneratePortoloins(ConfigurationGame game)
        {
            Position old;
            //ETAGE 1
            Portoloin p = new Portoloin(Etage.etage1, Etage.etage2);

            old = p.point;
            game.Plateau.GetZone(p.point).objets.Add(p);

            p = new Portoloin(Etage.etage1, Etage.etage3);
            while (p.point.X == old.X && p.point.Y == old.Y)
            {
                p.GenerateNewPosition();
            }
            game.Plateau.GetZone(p.point).objets.Add(p);
            //ETAGE 2
            p   = new Portoloin(Etage.etage2, Etage.etage1);
            old = p.point;
            game.Plateau.GetZone(p.point).objets.Add(p);

            p = new Portoloin(Etage.etage2, Etage.etage3);
            while (p.point.X == old.X && p.point.Y == old.Y)
            {
                p.GenerateNewPosition();
            }
            game.Plateau.GetZone(p.point).objets.Add(p);
            //ETAGE 3
            p   = new Portoloin(Etage.etage3, Etage.etage1);
            old = p.point;
            game.Plateau.GetZone(p.point).objets.Add(p);

            p = new Portoloin(Etage.etage3, Etage.etage2);
            while (p.point.X == old.X && p.point.Y == old.Y)
            {
                p.GenerateNewPosition();
            }
            game.Plateau.GetZone(p.point).objets.Add(p);
        }
Пример #6
0
        public static void GeneratePortoloins(ConfigurationGame game)
        {
            Position old;
            //ETAGE 1
            Portoloin p = new Portoloin(Etage.etage1, Etage.etage2);
            old = p.point;
            game.Plateau.GetZone(p.point).objets.Add(p);

            p = new Portoloin(Etage.etage1, Etage.etage3);
            while (p.point.X == old.X && p.point.Y == old.Y)
            {
                p.GenerateNewPosition();
            }
            game.Plateau.GetZone(p.point).objets.Add(p);
            //ETAGE 2
            p = new Portoloin(Etage.etage2, Etage.etage1);
            old = p.point;
            game.Plateau.GetZone(p.point).objets.Add(p);

            p = new Portoloin(Etage.etage2, Etage.etage3);
            while (p.point.X == old.X && p.point.Y == old.Y)
            {
                p.GenerateNewPosition();
            }
            game.Plateau.GetZone(p.point).objets.Add(p);
            //ETAGE 3
            p = new Portoloin(Etage.etage3, Etage.etage1);
            old = p.point;
            game.Plateau.GetZone(p.point).objets.Add(p);

            p = new Portoloin(Etage.etage3, Etage.etage2);
            while (p.point.X == old.X && p.point.Y == old.Y)
            {
                p.GenerateNewPosition();
            }
            game.Plateau.GetZone(p.point).objets.Add(p);
        }
Пример #7
0
    // Use this for initialization
    void Start()
    {
        //Instanciate config gameobject

                #if UNITY_EDITOR
        GameObject configGO = Resources.Load("Prefabs/Waves/ConfigurationWave1-6") as GameObject;

        config = Instantiate(configGO, new Vector3(), Quaternion.identity).GetComponent <ConfigurationGame>();
        config.gameObject.name = "ConfigurationWaveForTesting";
                #else
        GameObject  scGO = GameObject.Find("SceneInfos");
        ScenesInfos sc   = scGO.GetComponent <ScenesInfos> ();

        GameObject configGO = Resources.Load("Prefabs/Waves/ConfigurationWave" + sc.actualChapter + "-" + sc.actualLevel) as GameObject;

        config = Instantiate(configGO, new Vector3(), Quaternion.identity).GetComponent <ConfigurationGame>();                 //ConfigurationGame.instance;
        config.gameObject.name = "ConfigurationWave" + sc.actualChapter + "-" + sc.actualLevel;
                #endif

        // Generate random waves
        if (RandomWave)
        {
            GenerateRandomWave();              // Not implement yet
        }
        // Use config to instanciate wave
        else
        {
            int                   count   = 0;
            GameObject            waveTMP = null;
            List <BasicWaveClass> t       = config.GenerateWaves();

            foreach (BasicWaveClass waveComponent in t)
            {
                waveTMP = new GameObject("Wave" + count);
                waveTMP.AddComponent <BasicWave> ();
                waveTMP.GetComponent <BasicWave> ().data = waveComponent;
                count++;
                Waves.Add(waveTMP);
            }

            foreach (GameObject waveObj in Waves)
            {
                BasicWave wave = waveObj.GetComponent <BasicWave> ();

                List <ConfigurationEnemy> tmpEnemyList = new List <ConfigurationEnemy> ();

                foreach (ConfigurationEnemy enemy in wave.data.entities)
                {
                    if (enemy.prefab.gameObject.GetComponent <BasicEnnemy> ())
                    {
                        tmpEnemyList.Add(enemy);
                    }
                }

                TransitionLeft.Add(wave.data.TextDisplay);
                TimeTransitionLeft.Add(wave.data.TimeBetweenWave);
                WaveLeft.Add(tmpEnemyList);
            }

            // INIT settings for first wave
            EnemiesForCurrentWave = WaveLeft [0];

            wc.changeWave(TimeTransitionLeft [0], TransitionLeft [0]);
            TransitionLeft.RemoveAt(0);

            TimeLeft = TimeTransitionLeft [0];
            TimeTransitionLeft.RemoveAt(0);

            WaveLeft.RemoveAt(0);
        }
    }