Beispiel #1
0
        public TileController(Object tilePrefab, CrystalController crystalController)
        {
            var holder = new GameObject("Tiles");

            _crystalController = crystalController;
            _pooler            = new PoolController(tilePrefab, holder.transform);
        }
Beispiel #2
0
 public override void RePool(IPooler poolingScript)
 {
     childController.TriggerAutoFire = false;
     hitDetected  = false;
     frameBuffer  = 3;
     rend.enabled = true;
     base.RePool(poolingScript);
 }
        public void Add(System.Type type, string tag, IPooler <Component> value)
        {
            if (!dict.ContainsKey(type))
            {
                dict.Add(type, new Dictionary <string, IPooler <Component> >(1));
            }

            dict[type].Add(tag, value);
        }
Beispiel #4
0
 public void Init(IPooler pooler, Vector3 position)
 {
     _pooler            = pooler;
     transform.position = position;
     transform.rotation = Quaternion.identity;
     _hasFallenDeep     = false;
     _fallTimerStarted  = false;
     _fallTimer         = 0;
     Freeze();
 }
Beispiel #5
0
        public void Play(IPooler pooler, AudioClip audioClip)
        {
            Debug.Assert(_state == State.Unused);

            _pooler            = pooler;
            audioSource.volume = gameConfiguration.Volume;
            audioSource.clip   = audioClip;
            audioSource.Play();
            _state = State.Playing;
        }
Beispiel #6
0
 private void Start()
 {
     _puzzlePooler = pooler.GetComponent <IPooler>();
     openedDoors   = 0;
     //puzzleComplete += GameOver;
     gameOverPanel.SetActive(false);
     gamePanel.gameObject.SetActive(false);
     gamePanel.sizeDelta = new Vector2(gamePanel.rect.height, gamePanel.sizeDelta.y);
     //Debug.Log(panel.rect.width + "panel scale X");
     //StartGame();
 }
Beispiel #7
0
        public virtual void RePool(IPooler poolingScript)                                                                      //default re-pool Behavior. Override to to accomodate custom behaviors on repool.
        {
            if (PoolBank && this is IRePoolable && !(GlobalShotBank.Instance.PoolCount > GlobalShotBank.Instance.PoolMaxSize)) //and pool available
            {
                poolingScript.AddToPool(this.gameObject, GlobalShotBank.Instance.transform);
            }
            else
            {
                poolingScript.AddToPool(this.gameObject, Emitter);
            }

            GlobalShotManager.Instance.ActiveBullets--;
        }
        private void Awake()
        {
            IFactory <GameObject>  objectFactory     = new BaseGameObjectFactory(_gameObjectPrefab, Parent);
            IStore <GameObject>    unusedObjectStore = new BaseListStore <GameObject>();
            IStore <GameObject>    usedObjectStore   = new BaseListStore <GameObject>();
            IDisposer <GameObject> objectDisposer    = new BaseGameObjectDisposer();
            int maximumCapacity = _maximumCapacity > 0 ? _maximumCapacity : int.MaxValue;

            Pooler = new BasePooler <GameObject>(
                objectFactory,
                unusedObjectStore,
                usedObjectStore,
                objectDisposer,
                maximumCapacity);
            if (_initialCapacity > 0)
            {
                Pooler.EnsureCapacity(_initialCapacity);
            }
        }
Beispiel #9
0
        private void Start()
        {
            _objPooler   = objPooler.GetComponent <IPooler>();
            _foodManager = foodManager.GetComponent <IFoodManager>();

            _snakeLength = _initialSnakeLength;

            transform.position = new Vector3(_snakeX, _snakeY);

            _moveRate = 1 / _movesPerSecond;

            _grid = new int[GRID_WIDTH, GRID_HEIGHT];

            _snakeTransform         = this.transform;
            _direction              = Vector3.right;
            _grid[_snakeX, _snakeY] = _snakeLength;

            UpdateText();

            for (int i = 0; i < _initialFoodAmnt; i++)
            {
                SpawnFood();
            }
        }
Beispiel #10
0
 public void RePool(IPooler poolingScript)
 {
     transform.localScale = scale;
     poolingScript.AddToPool(this.gameObject, GlobalShotManager.Instance.transform);
 }
Beispiel #11
0
 public override void RePool(IPooler poolingScript)
 {
     childController.TriggerAutoFire = false;
     rend.enabled = true;
     base.RePool(poolingScript);
 }
Beispiel #12
0
 public void Init(IPooler pooler, Vector3 position)
 {
     _pooler = pooler;
     gameObject.SetActive(true);
     transform.position = position;
 }
Beispiel #13
0
        public CrystalController(Object crystalPrefab)
        {
            var holder = new GameObject("Crystals");

            _pooler = new PoolController(crystalPrefab, holder.transform);
        }
 public void Add <T>(string tag, IPooler <Component> value) where T : Component
 {
     Add(typeof(T), tag, value);
 }