// Zorgt ervoor dat de enemies kunnen beginnen met schieten, en checked of de pools aan staan zodat een enemy bullet
    // pool geregeld kan worden.
    private void Start()
    {
        StartCoroutine(Shoot());

        if (GameManager.Instance.useObjectPool)
        {
            bulletPool = gameObject.AddComponent <SimplePool.ObjectPool>() as SimplePool.ObjectPool;
            bulletPool.pooledObject = bullet;
            bulletPool.autoExpand   = true;
        }
    }
    // haalt alle componenten op, en begint de lijst met actieve turrets. Checked ook gelijk of de pool aan staat
    // en voegt deze toe voor de player bullets.
    void Start()
    {
        playerCollider      = gameObject.GetComponent <CircleCollider2D>();
        playerRenderer      = gameObject.GetComponent <Renderer>();
        activePlayerTurrets = new List <GameObject> {
            startWeapon
        };
        shootSoundFX    = gameObject.GetComponent <AudioSource>();
        playerRigidbody = GetComponent <Rigidbody2D>();

        if (GameManager.Instance.useObjectPool)
        {
            bulletPool = gameObject.AddComponent <SimplePool.ObjectPool>() as SimplePool.ObjectPool;
            bulletPool.pooledObject = playerBullet;
            bulletPool.autoExpand   = true;
        }
    }
Пример #3
0
    // Start is called before the first frame update
    void Start()
    {
        instance = this;

        obstaclePool1 = gameObject.AddComponent <SimplePool.ObjectPool>() as ObjectPool;
        obstaclePool1.pooledObject = randomObject1;
        obstaclePool1.autoExpand   = true;

        obstaclePool2 = gameObject.AddComponent <SimplePool.ObjectPool>() as ObjectPool;
        obstaclePool2.pooledObject = randomObject2;
        obstaclePool2.autoExpand   = true;

        obstaclePool3 = gameObject.AddComponent <SimplePool.ObjectPool>() as ObjectPool;
        obstaclePool3.pooledObject = randomObject3;
        obstaclePool3.autoExpand   = true;

        obstaclePool4 = gameObject.AddComponent <SimplePool.ObjectPool>() as ObjectPool;
        obstaclePool4.pooledObject = randomObject4;
        obstaclePool4.autoExpand   = true;
    }