Example #1
0
    private void SpawnDragon(GameObject dragonPrefab)
    {
        SpawnPointsTracker location = getRandomDragonSpawnLocation();
        var dragon = _pool.spawnObject(dragonPrefab, location.SpawnHere, Quaternion.identity);

        dragon.GetComponent <Dragon>().dragonId = location.dragonId;
        dragon.GetComponent <Dragon>().ResetDragon();
        dragon.GetComponent <Dragon>().StartDragon();
    }
Example #2
0
    private void Awake()
    {
        Instance = this;

        _player            = GameObject.FindGameObjectWithTag("Player");
        spawnPoints        = GameObject.FindGameObjectsWithTag("Spawn Point");
        spawnPointTrackers = new SpawnPointsTracker[spawnPoints.Length - 1];

        for (int i = 0; i < spawnPointTrackers.Length; i++)
        {
            spawnPointTrackers[i]           = new SpawnPointsTracker(i);
            spawnPointTrackers[i].SpawnHere = spawnPoints[i].transform.position;
            spawnPointTrackers[i].dragonId  = (Random.Range(0, 100) + Random.Range(0, 100) + Random.Range(0, 100)).ToString();
        }

        StartGameUI();
    }