Ejemplo n.º 1
0
    public void SetUpWithGamePiece(Tile piece)
    {
        this.piece = piece;

        foreach (Coordinate pair in piece.squareInfo.Keys)
        {
            GameObject obj             = Resources.Load("Prefabs/GameCell") as GameObject;
            GameObject instantiatedObj = GameObject.Instantiate(obj);
            instantiatedObj.transform.SetParent(transform);
            instantiatedObj.transform.localPosition = new Vector2(GameCellBehavior.TILE_SIZE * pair.row, GameCellBehavior.TILE_SIZE * pair.column);
            instantiatedObj.transform.localScale    = Vector3.one;

            GameCellBehavior cellBehavior = instantiatedObj.GetComponent <GameCellBehavior>();
            cellBehavior.InitializeWithGameCell(piece.squareInfo[pair]);
        }
    }
Ejemplo n.º 2
0
    public void Initialize(GameBoardSquare square)
    {
        this.boardSquare = square;
        GameCell topCell = square.TopCell;

        if (topCell != null)
        {
            GameObject obj             = Resources.Load("Prefabs/GameCell") as GameObject;
            GameObject instantiatedObj = GameObject.Instantiate(obj);
            instantiatedObj.transform.SetParent(transform);
            instantiatedObj.transform.localPosition = Vector2.zero;
            instantiatedObj.transform.localScale    = Vector2.one;

            GameCellBehavior cellBehavior = instantiatedObj.GetComponent <GameCellBehavior>();
            cellBehavior.InitializeWithGameCell(topCell);
            this.AddGameCell(cellBehavior);
        }
    }
Ejemplo n.º 3
0
 public virtual void RemoveGameCell(GameCellBehavior cell)
 {
     this.stackedGameCells.Remove(cell);
 }
Ejemplo n.º 4
0
 public virtual void AddGameCell(GameCellBehavior cell)
 {
     this.stackedGameCells.Add(cell);
 }
Ejemplo n.º 5
0
 public override void RemoveGameCell(GameCellBehavior cell)
 {
     this.stackedGameCells.Remove(cell);
     cell.EnableCellEditing();
 }