Ejemplo n.º 1
0
    public void GameStart()
    {
        gameStart = true;
        uiStartScreenPanel.SetActive(false);
        uiGameScreenPanel.SetActive(true);

        uiHealthbarRectMax = uiHealthbar.rect.width;

        player           = Instantiate(playerPrefab);
        playerController = player.GetComponent <PlayerController>();

        zombieSpawner.StartSpawning();
        camBehaviour.SetTarget(player.transform);

        if (useMobileInput)
        {
            if (!mobileUI.activeSelf)
            {
                mobileUI.SetActive(true);
            }
            playerController.InitMobileInput(mobileLeftJoystick, mobileRightJoystick);
        }
        else
        {
            if (mobileUI.activeSelf)
            {
                mobileUI.SetActive(false);
            }
        }
    }
Ejemplo n.º 2
0
    public void LevelUp()
    {
        level = (level + 1) % LevelData.Length;

        int   numZombies  = (int)LevelData[level][0];
        float zombieDelay = (float)LevelData[level][1];
        int   maxAmmo     = (int)LevelData[level][2];

        playerHUD.ammoCounter.maxAmmo = maxAmmo;
        spawner1.StartSpawning(numZombies / 2, zombieDelay);
        spawner2.StartSpawning(numZombies / 2, zombieDelay);

        kills = 0;
    }
Ejemplo n.º 3
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject hud = GameObject.FindGameObjectWithTag("PlayerHUD");

        playerHUD = hud.GetComponent <PlayerHUD>();

        GameObject s1 = GameObject.Find("ZombieSpawnPoint1");
        GameObject s2 = GameObject.Find("ZombieSpawnPoint2");

        spawner1 = s1.GetComponent <ZombieSpawner>();
        spawner2 = s2.GetComponent <ZombieSpawner>();

        int   numZombies  = (int)LevelData[0][0];
        float zombieDelay = (float)LevelData[0][1];
        int   maxAmmo     = (int)LevelData[0][2];

        playerHUD.ammoCounter.maxAmmo = maxAmmo;
        spawner1.StartSpawning(numZombies / 2, zombieDelay);
        spawner2.StartSpawning(numZombies / 2, zombieDelay);
    }
Ejemplo n.º 4
0
 private void SpawnNextWave()
 {
     currentZombiesSpawned     = initialNumberToSpawn + Mathf.RoundToInt(waveNumber / 2f);
     numberOfZombiesStillAlive = currentZombiesSpawned;
     zombieSpawner.StartSpawning(currentZombiesSpawned);
 }