Beispiel #1
0
    public void goToNextPieceContainer()
    {
        if (movementCoroutine != null)
        {
            StopCoroutine(movementCoroutine);
        }

        NextTetrominoManager _nextPieceManager = FindObjectOfType <NextTetrominoManager> ();
        Vector3 _destination = _nextPieceManager.NextTetrominoPos.position;

        movementCoroutine = StartCoroutine(movePieceCoroutine(_destination, false));
    }
Beispiel #2
0
    public Group spawnNext()
    {
        NextTetrominoManager _nextPieceManager = FindObjectOfType <NextTetrominoManager> ();

        if (_nextPieceManager.CheckIfTetroAvailable())
        {
            Group _piece = _nextPieceManager.ExtractTetromino();
            _piece.goToSpawner();
            return(_piece);
        }
        else
        {
            MaterialPosition _naturalResources = FindObjectOfType <MaterialPosition> ();
            _naturalResources.deleteElements(1);
            // Random Shape
            int   i      = Random.Range(0, groups.Length);
            Shape _shape = (Shape)System.Enum.Parse(typeof(Shape), "" + i);

            // Spawn Group at current Position
            Group _piece = spawn(_shape, transform.position);
            _piece.startPlaying();
            return(_piece);
        }
    }
 void Awake()
 {
     tetrominoManager = FindObjectOfType <NextTetrominoManager> ();
 }