Exemplo n.º 1
0
    public void FireRockets()
    {
        for (int i = 0; i < asteroids.Count; i++)
        {
            GameObject rocket = Instantiate(rocketPrefab);
            rockets.Add(rocket);
            Vector3 spawnPos = new Vector3(player.transform.position.x, player.transform.position.y, player.transform.position.z + 5);
            rocket.transform.position = spawnPos;

            RocketController rc = rocket.GetComponent <RocketController>();
            rc.gameManager = this;
            rc.PassTarget(asteroids[i]);

            ParticleSystem parts = rocket.GetComponent <ParticleSystem>();
            Destroy(rocket, parts.main.duration);
        }
    }