Esempio n. 1
0
    public override void Reset()
    {
        base.Reset();


        anger  = 0;
        inRage = false;


        rightDroneSpawner.Clear();
        rightDroneSpawner.gameObject.SetActive(false);
        leftDroneSpawner.Clear();
        leftDroneSpawner.gameObject.SetActive(false);
    }
Esempio n. 2
0
    private void GenerateLevel()
    {
        //clear level
        _levelGenerator.Clear();
        foreach (GameObject room in GameObject.FindGameObjectsWithTag("Room"))
        {
            Destroy(room);
        }
        //clear enemies
        _enemySpawner.Clear();
        foreach (GameObject enemy in GameObject.FindGameObjectsWithTag("Enemy"))
        {
            Destroy(enemy);
        }
        //clear items
        foreach (GameObject powerup in GameObject.FindGameObjectsWithTag("PowerUp"))
        {
            Destroy(powerup);
        }
        //clear effects
        foreach (GameObject effect in GameObject.FindGameObjectsWithTag("Effect"))
        {
            Destroy(effect);
        }
        //clear guns that are not picked up
        foreach (GameObject gun in GameObject.FindGameObjectsWithTag("Gun"))
        {
            if (!gun.GetComponent <WeaponPickupScript>().IsPickedUp)
            {
                Destroy(gun);
            }
        }

        //generate level
        _levelGenerator.GenerateLevel(_width, _height, _randomRooms, _itemRooms);

        //set cuby position to spawn room
        _cuby.transform.position       = new Vector3(_levelGenerator.GetCubySpawnPos().x, _levelGenerator.GetCubySpawnPos().y, -5);
        _minimapCam.transform.position = new Vector3(_cuby.transform.position.x, _cuby.transform.position.y, -100);

        //init enemies
        if (_doSpawnEnemies)
        {
            StartCoroutine(Init());
        }
    }