Esempio n. 1
0
        public IEnumerator GenerateResources(Random random, int[,] map, int squareSize, int openTile)
        {
            yield return(CorutineUtilities.Wait(0.01f, "Started resource generation"));

            goldParent  = GameObject.Find("Gold").transform;
            scrapParent = GameObject.Find("Scrap").transform;

            this.random       = random;
            this.map          = map;
            this.openTile     = openTile;
            this.squareSize   = squareSize;
            resourcePositions = new List <Vector2>();

            RandomizeResourcePlacements();
            yield return(CorutineUtilities.Wait(0.01f, "Randomized resource positions"));

            if (GameObject.FindGameObjectWithTag(ReferenceManager.Singleton.LocalPlayerTag).GetComponent <NetworkBehaviour>().isServer)
            {
                foreach (Vector2 position in resourcePositions)
                {
                    GenerateResource(position);
                }
            }
            yield return(CorutineUtilities.Wait(0.01f, "Generated resources"));
        }
Esempio n. 2
0
        public IEnumerator GenerateEnemies(Random random)
        {
            yield return(CorutineUtilities.Wait(0.01f, "Started enemy generation"));

            //Todo parentmap spawns all Enemies at 0,0,0. Must be insstaniated right (world position)
            parentMap = GameObject.Find("Enemies").transform;

            this.random    = random;
            enemyPositions = new List <Vector2>();

            enemyTypes.Add(EnemyType.Booba, spawnRateBobba);
            enemyTypes.Add(EnemyType.Clonker, spawnRateClonker);
            enemyTypes.Add(EnemyType.Popper, spawnRatePopper);
            enemyTypes.Add(EnemyType.Spook, spawnRateSpook);


            RandomizeEnemyPlacements();
            yield return(CorutineUtilities.Wait(0.01f, "Randomized enemy positions"));

            if (GameObject.FindGameObjectWithTag(ReferenceManager.Singleton.LocalPlayerTag).GetComponent <NetworkBehaviour>().isServer)
            {
                foreach (Vector2 position in enemyPositions)
                {
                    GenerateEnemies(position);
                }
            }
            yield return(CorutineUtilities.Wait(0.01f, "Generated enemies"));
        }
Esempio n. 3
0
 private WaitForSeconds Wait(string text = "") => CorutineUtilities.Wait(timeToWait, text);