예제 #1
0
    public void landSpawning()
    {
        Debug.Log("In landSpawning function");
        int numGolems = (int)(Random.Range(1, 3) + 0.5f);
        int numShrabs = 1;

        for (int i = 1; i <= numGolems; i++)
        {
            RandomEnemySpawn.spawnEnemyWithinRadius(EnemyType.Brawler, golemPrefab, 2.0f, instantiationPoint.position, 1.0f);
        }
        for (int i = 1; i <= numShrabs; i++)
        {
            RandomEnemySpawn.spawnEnemyWithinRadius(EnemyType.Shrab, shrabPrefab, 4.0f, instantiationPoint.position, 1.0f);
        }
        landSpawingCheck = false;
    }
예제 #2
0
 public void spawnEnemy(EnemyType[] types, Dictionary <GameObject, int> enemiesToSpawn, float radius)
 {
     Debug.Log("In spawnEnemy function");
     if (enemyStats.getHealth() <= enemyStats.getMaxHealth() * 0.1)
     {
         //Spawn code for other enemies - Anshul Task 6
         float maxHPProportion = Random.Range(1, 101) * 0.01f;
         int   j = 0;
         foreach (KeyValuePair <GameObject, int> kvp in enemiesToSpawn)
         {
             EnemyType typeToPass = types[j];
             for (int i = 0; i < kvp.Value; i++)
             {
                 RandomEnemySpawn.spawnEnemyWithinRadius(typeToPass, kvp.Key, radius, referenceObject.transform.position, maxHPProportion);
             }
             j++;
         }
     }
 }
예제 #3
0
    // Update is called once per frame
    void Update()
    {
        //Assumes that the timers are in the order presented above

        /*
         * shlyTimer -= Time.deltaTime;
         * if(shlyTimer <= 0 && activateShly)
         * {
         *  shly.SetActive(true);
         *  activateShly = false;
         * }
         *
         * kamikazeTimer -= Time.deltaTime;
         * if (kamikazeTimer <= 0 && activateKamikaze)
         * {
         *  kamikaze.SetActive(true);
         *  //kamikaze.GetComponent<PlayerAttack>().enabled = true;
         *  activateKamikaze = false;
         * }
         *
         * starshipTimer -= Time.deltaTime;
         * if(starshipTimer <= 0 && activateStarship)
         * {
         *  Instantiate(starship, starshipInstantionPoint, Quaternion.identity);
         *  starshipTimer = oStarshipTimer;
         *  //starship.GetComponent<StarshipEndgame>().enabled = true;
         *  //activateStarship = false;
         * }
         * shrab1Timer -= Time.deltaTime;
         * if (shrab1Timer <= 0 && activateShrab1)
         * {
         *  shrab1.SetActive(true);
         *  activateShrab1 = false;
         * }
         *
         * shrab2Timer -= Time.deltaTime;
         * if (shrab2Timer <= 0 && activateShrab2)
         * {
         *  shrab2.SetActive(true);
         *  activateShrab2 = false;
         * }
         *
         * shrab3Timer -= Time.deltaTime;
         * if (shrab3Timer <= 0 && activateShrab3)
         * {
         *  shrab3.SetActive(true);
         *  activateShrab3 = false;
         * }
         *
         * shrab4Timer -= Time.deltaTime;
         * if (shrab4Timer <= 0 && activateShrab4)
         * {
         *  shrab4.SetActive(true);
         *  activateShrab4 = false;
         * }
         *
         * golemTimer -= Time.deltaTime;
         * if(golemTimer <= 0 && activateGolem)
         * {
         *  golem.SetActive(true);
         *  activateGolem = false;
         *
         * }
         */
        shlyTimer -= Time.deltaTime;
        if (shlyTimer <= 0 && activateShly)
        {
            for (int i = 1; i <= 3; i++)
            {
                RandomEnemySpawn.spawnEnemyWithinRadius(EnemyType.Shly, shlyPrefab, 20.0f, player.transform.position + new Vector3(0f, 30f, 0f), 1.0f);
            }
            shlyTimer = oShlyTimer;
        }
        shrabTimer -= Time.deltaTime;
        if (shrabTimer <= 0 && activateShrab)
        {
            for (int i = 1; i <= 10; i++)
            {
                RandomEnemySpawn.spawnEnemyWithinRadius(EnemyType.Shrab, shrabPrefab, 20.0f, player.transform.position + new Vector3(0f, 30f, 0f), 1.0f);
            }
            shrabTimer = oShrabTimer;
        }
        kamikazeTimer -= Time.deltaTime;
        if (kamikazeTimer <= 0 && activateKamikaze)
        {
            for (int i = 1; i <= 3; i++)
            {
                RandomEnemySpawn.spawnEnemyWithinRadius(EnemyType.FlyingKamikaze, kamikazePrefab, 20f, player.transform.position + new Vector3(0f, 30f, 0f), 1.0f);
            }
            kamikazeTimer = oKamikazeTimer;
        }
        golemTimer -= Time.deltaTime;
        if (golemTimer <= 0 && activateGolem)
        {
            for (int i = 1; i <= 4; i++)
            {
                RandomEnemySpawn.spawnEnemyWithinRadius(EnemyType.Brawler, golemPrefab, 20f, player.transform.position + new Vector3(0f, 30f, 0f), 1.0f);
            }
            golemTimer = oGolemTimer;
        }
    }