Exemple #1
0
 // Update is called once per frame
 void Update()
 {
     if (_pickedUp)
     {
         Asteroid_Pooler_Script a = transform.parent.GetComponent <Asteroid_Pooler_Script>();
         a._currentAmountOfAsteroids--;
         Destroy(gameObject);
     }
 }
    /// <summary>
    /// Here we can spawn n amount of asteroid poolers at desired locations, which each hold n amount of asteroids.
    /// </summary>
    /// <param name="value"></param>
    /// <param name="spawnLocations"></param>
    void SpawnSomeSpawnersAndShit(int value, List <Vector3> spawnLocations)
    {
        for (int i = 0; i < spawnLocations.Count; i++)
        {
            GameObject go = Instantiate(_asteroid_ContainerAndSpawnerPrefab, this.transform.position, _asteroid_ContainerAndSpawnerPrefab.transform.rotation, this.transform);

            _asteroidSpawnerList.Add(go);
            _asteroidPoolerScript = go.GetComponent <Asteroid_Pooler_Script>();
            go.transform.Translate(spawnLocations[i]);

            _asteroidPoolerScript.SetInitialValues(spawnLocations[i], 6f + i * 4, 10f + i * 4, -1.5f, 1.5f, 250, 300);
        }
    }