Exemple #1
0
    public override void Init()
    {
        Debug.Log("[TEST] GameManager.Init()");
        inGameUI.SetActive(false);

        touchWidget.OnStartControl += HandleStartControl;
        touchWidget.OnEndControl   += HandleEndControl;

        explosions = ObjectsPoolUtils.CreateBehavioursPool(() =>
        {
            var explosion         = Instantiate(explosionPrefab);
            explosion.OnComplete += () => explosions.Free(explosion);
            return(explosion);
        }, false);

        regularBombs = ObjectsPoolUtils.CreateBehavioursPool(() =>
        {
            var bomb = Instantiate(regularBombPrefab);
            bomb.explosive.OnExplode += () =>
            {
                var pos       = bomb.transform.position;
                var explosion = explosions.Lock();
                explosion.Explode(pos);
                soundManager.PlayExplosion(pos);
                regularBombs.Free(bomb);
            };
            return(bomb);
        }, false);

        powerBombs = ObjectsPoolUtils.CreateBehavioursPool(() =>
        {
            var bomb = Instantiate(powerBombPrefab);
            bomb.explosive.OnExplode += () =>
            {
                var pos       = bomb.transform.position;
                var explosion = explosions.Lock();
                explosion.Explode(pos);
                soundManager.PlayExplosion(pos);
                powerBombs.Free(bomb);
            };
            return(bomb);
        }, false);

        player = Instantiate(skins[0]);
        player.DORadius(testRadius, levelChangeDuration);
        cameraController.moveTarget = player.cameraAnchor;
    }
Exemple #2
0
 void Awake()
 {
     _pool = ObjectsPoolUtils.CreateTransformsPool(() => Instantiate(prefab, transform));
 }