private void Awake()
    {
        if (Instance == null)
        {
            player = gameManager.Player;

            AddToPool(spawnablesPools.transform.GetChild(0), ref cansPool);
            AddToPool(spawnablesPools.transform.GetChild(1), ref bottlesPool);
            //AddToPool(strawsPoolT, ref strawsPool);

            AddToPool(wpT, ref wpPool, true, false);
            currentWPMax   = (int)wpPool[wpPool.Count - 1].transform.position.x; // wallpapers are centered (and 6 int large)
            currentBlocMax = startingBlocMin;
            allBlocs       = spawnablesPools.selectedBlocsScriptable.storedBlocs;
            RankBlocs();
            // add trees to pool
            AddToPool(backTreesAnchor, ref backTreesPool, false, false);
            AddToPool(spawnablesAnchor, ref backTreesPool, true, false, "Tree"); // back objects in the Spawnables on start are also part of the pool
            // add rocks to pool
            AddToPool(backRocksAnchor, ref backRocksPool, false, false);
            AddToPool(spawnablesAnchor, ref backRocksPool, true, false, "Rock"); // back objects in the Spawnables on start are also part of the pool
            // add bushes to pool
            AddToPool(backBushesAnchor, ref backBushesPool, false, false);
            AddToPool(spawnablesAnchor, ref backBushesPool, true, false, "Bush"); // back objects in the Spawnables on start are also part of the pool
            // add far trees to pool
            AddToPool(backTreesFarAnchor, ref backTreesFarPool, false, false);
            AddToPool(spawnablesAnchor, ref backTreesFarPool, true, false, "Far"); // back objects in the Spawnables on start are also part of the pool

            // total probabilities of bonuses
            bonusProbaTotal = shieldBonusProba + rageBonusProba + smallerBonusProba;

            Instance = this;
        }
        else
        {
            Destroy(this);
        }
    }
Exemple #2
0
 private void Start()
 {
     blocManager             = BlocManager.Instance;
     transform.localPosition = Vector2.left * GetComponentInParent <Camera>().orthographicSize *GetComponentInParent <Camera>().aspect + Vector2.left * 0.5f;
 }