Esempio n. 1
0
    // ********* AWAKE *********
    void Awake()
    {
        // SET SIZES FOR EACH TYPE
        bigSize.x = 50;
        bigSize.y = 50;
        bigSize.z = 10;

        medSize.x = bigSize.x * modifierMedium;
        medSize.y = bigSize.y * modifierMedium;
        medSize.z = 10;

        smallSize.x = bigSize.x * modifierSmall;
        smallSize.y = bigSize.y * modifierSmall;
        smallSize.z = 10;

        // pool elements creation
        // BIG ASTEROIDS
        poolBig = new GameObject[bigAmount];
        for(int i = 0; i < poolBig.Length; i++){
            poolBig[i] = GameObject.Instantiate(Prefab) as GameObject;
            SetSize(poolBig[i],Sizes.big); // set name, sound and size. Radius set by itself
            poolBig[i].SetActiveRecursively(false);
        }

        // MEDIUM ASTEROIDS
        poolMed = new GameObject[bigAmount*2]; // 2 med asteroid, for each big one
        for(int i = 0; i < poolMed.Length; i++){
            poolMed[i] = GameObject.Instantiate(Prefab) as GameObject;
            SetSize(poolMed[i],Sizes.medium); // set name, sound and size. Radius set by itself
            poolMed[i].SetActiveRecursively(false);
        }

        // SMALL ASTEROIDS
        poolSma = new GameObject[bigAmount*4]; // 4 small asteroid, for each big one
        for(int i = 0; i < poolSma.Length; i++){
            poolSma[i] = GameObject.Instantiate(Prefab) as GameObject;
            SetSize(poolSma[i],Sizes.small); // set name, sound and size. Radius set by itself
            poolSma[i].SetActiveRecursively(false);
        }

        // Set starting position
        startPos.x = Screen.width;
        startPos.y = Screen.height;
        startPos.z = 0;

        // Explosions pool
        ep = MonoBehaviour.FindObjectOfType(typeof(ExplPool)) as ExplPool;
    }
Esempio n. 2
0
 void Awake()
 {
     ep = MonoBehaviour.FindObjectOfType(typeof(ExplPool)) as ExplPool;
     texOffset.x = 0.0f;
     texOffset.y = 0.0f;
 }
Esempio n. 3
0
 protected override void Awake()
 {
     base.Awake();
     this.Radius = 25;
     ep = MonoBehaviour.FindObjectOfType(typeof(ExplPool)) as ExplPool;
 }