Exemplo n.º 1
0
 // Start is called before the first frame update
 void Awake()
 {
     pawn         = Resources.Load <Tetrion>("Prefabs/TetrisPawn");
     pool         = new Queue <Tetrion>();
     tetrisHolder = new GameObject("tetrisHolder").transform;
     for (int i = 0; i < initialPoolSize; i++)
     {
         pool.Enqueue(Instantiate(pawn, tetrisHolder));
     }
 }
Exemplo n.º 2
0
    void SettingUpInGraph(Tetrimino tetrimino, Tetrion initializer)
    {
        Socket socket;
        int    x = 3, y = 7, z = 3;

        for (int i = 0; i < 4; i++)
        {
            socket            = _boardCreator.SocketLayers[y + (int)tetrimino.Pos[i].y][x + (int)tetrimino.Pos[i].x, z + (int)tetrimino.Pos[i].z];
            socket.TetrisPart = initializer.Parts[i];
            initializer.Parts[i].GetComponent <Part>().CurrentSocket = socket;
        }
    }
Exemplo n.º 3
0
 public Tetrion SpawnPawn()
 {
     _pool = PawnPooler.Instance;
     if (_pool != null)
     {
         Tetrion   pawn      = _pool.GetFromPool();
         Tetrimino randomTet = _tetriminos[Random.Range(0, _tetriminos.Count)];
         pawn.Initialize(randomTet.Pos);
         SettingUpInGraph(randomTet, pawn);
         pawn.transform.position = transform.position;
         pawn.GetComponent <PawnShadow>().EnableShadow();
         bm.GetComponent <Animator>().SetTrigger("Spawned");
         return(pawn);
     }
     return(null);
 }
Exemplo n.º 4
0
 public void AddToPool(Tetrion objectToPooling)
 {
     pool.Enqueue(objectToPooling);
 }