Esempio n. 1
0
        public void Spawn(Vector3 position)
        {
            var currentInstance = _pool.GetObject(position + Vector3.up);

            currentInstance.transform.SetParent(_figureHandler.transform);

            if (_previousInstance != null)
            {
                if (DistanceBetweenFigures(currentInstance.transform.position, _previousInstance.transform.position) < _lineBreakDistance)
                {
                    RotateSpawnedFigures(currentInstance);
                }
            }

            _figureHandler.HandleCreatedFigure(currentInstance);

            currentInstance.FigureFellAndLeftScreen += Despawn;

            _previousInstance = currentInstance;
        }
Esempio n. 2
0
 private void HandleFigure(DominoFigure figure)
 {
     _handles.Add(figure);
     figure.FigureFell += ResetFigureTimer;
 }
Esempio n. 3
0
 public void HandleCreatedFigure(DominoFigure figure)
 {
     HandleFigure(figure);
 }
Esempio n. 4
0
        private void Despawn(DominoFigure instance)
        {
            instance.FigureFellAndLeftScreen -= Despawn;

            _pool.ReturnObject(instance);
        }
Esempio n. 5
0
 private void RotateSpawnedFigures(DominoFigure current)
 {
     _previousInstance.SetRotation(current.transform);
     current.SetRotation(_previousInstance.transform);
 }
Esempio n. 6
0
 public void ReturnObject(DominoFigure instance)
 {
     instance.gameObject.SetActive(false);
     _availableObjects.Enqueue(instance);
 }