Esempio n. 1
0
        public void Initialize(ReferenceManager referenceManager)
        {
            reference   = referenceManager;
            waveManager = reference.waveManager;
            Random.InitState((int)DateTime.Now.Ticks);
            intSpawnChance        = (int)(spawnChance * 100);
            intPowerupSpawnChance = (int)(powerupSpawnChance * 100);

            enemySpawnChances = new Chances[enemySpawnChanceSetup.Length];
            typeIds           = new int[enemySpawnChanceSetup.Length];
            int high = 0;

            for (int i = 0; i < enemySpawnChances.Length; ++i)
            {
                int low = high;
                high      += (int)(enemySpawnChanceSetup[i].percentChance * 100);
                typeIds[i] = waveManager.EnemyIDs[(int)enemySpawnChanceSetup[i].enemyType];

                enemySpawnChances[i] = new Chances(low, high, enemySpawnChanceSetup[i].firstWave);
            }

            powerupSpawnChances = new Chances[powerupSpawnChanceSetup.Length];
            powerupPrefabs      = new GameObject[powerupSpawnChanceSetup.Length];
            high = 0;

            for (int i = 0; i < powerupSpawnChanceSetup.Length; ++i)
            {
                int low = high;
                high += (int)(powerupSpawnChanceSetup[i].percentChance * 100);
                powerupPrefabs[i] =
                    waveManager.powerupPrefabs[(int)powerupSpawnChanceSetup[i].powerup];

                powerupSpawnChances[i] =
                    new Chances(low, high, powerupSpawnChanceSetup[i].firstWave);
            }

            paths = new Hashtable {
                { "child", false }
            };

            foreach (string zone in waveManager.PathNames)
            {
                for (int num = 0; num < 13; ++num)
                {
                    string path = zone + num;
                    paths.Add(path, false);
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes the Reference Manager and Object Pool Manager references
 /// </summary>
 private void Awake()
 {
     reference         = GameObject.Find("Reference Manager").GetComponent <ReferenceManager>();
     waveManager       = reference.waveManager;
     objectPoolManager = reference.objectPoolManager;
 }