Пример #1
0
    void Spawn()
    {
        LifeCounter mc = GetComponent <LifeCounter>();

        if (GameObject.Find("screenSpawn").GetComponent <LifeCounter> ().spawn) //will check if true
        {
            Vector3    SpawnPosition = new Vector3(Random.Range(xMin, xMax), Random.Range(yMin, yMax), Random.Range(zMin, zMax));
            GameObject meteor        = Instantiate(meteorPrefab, SpawnPosition, Quaternion.identity);

            meteorMovement mv = meteor.GetComponent <meteorMovement>();
            mv.target = GameObject.FindWithTag("Player").transform;
            mv.speed  = speed;
        }
    }
Пример #2
0
    void Spawn()
    {
        if (counter.spawn) //will check if true
        {
            Vector3    SpawnPosition = new Vector3(Random.Range(xMin, xMax), Random.Range(yMin, yMax), Random.Range(zMin, zMax));
            GameObject meteor        = Instantiate(Meteors[Random.Range(0, Meteors.Length)], SpawnPosition, Quaternion.identity);

            meteorMovement mv = meteor.GetComponent <meteorMovement>();
            mv.target = GameObject.FindWithTag("Player").transform;
            mv.speed  = speed;

            meteorDeleter md = meteor.GetComponent <meteorDeleter>();
            md.explosionSound = ExplosionSound;
        }
    }