Ejemplo n.º 1
0
    void Awake()
    {
        List <TileType> possibleTileTypes = new List <TileType>();

        possibleTileTypes.Add(TileType.C_BLUE);
        possibleTileTypes.Add(TileType.C_GREEN);
        possibleTileTypes.Add(TileType.D_BLACK);
        possibleTileTypes.Add(TileType.D_COPPER);
        possibleTileTypes.Add(TileType.T_CYAN);
        possibleTileTypes.Add(TileType.T_YELLOW);
        possibleTileTypes.Add(TileType.C_RED);

        TileSpriteData gameBoardSpriteData = new TileSpriteData(32, 32, 32);

        gameBoard = new Board(Vector2.zero, 8, 8, possibleTileTypes, gameBoardSpriteData);

        gameBoard.BoardGO = new GameObject("Board");
        gameBoard.TilesGO = new GameObject("Tiles");
        gameBoard.TilesGO.transform.SetParent(gameBoard.BoardGO.transform);

        boardController = new BoardController(gameBoard);

        gameBoard.BoardGO.AddComponent <BoardInput>().controller = boardController;

        boardController.CenterCameraOnBoard(Camera.main);

        gameBoard.SpriteData.TileSprites     = boardController.LoadTileset("tile_set");
        gameBoard.SpriteData.HighLightSprite = Resources.Load <Sprite>("highlightTest");

        boardController.SpawnBoard();
    }
Ejemplo n.º 2
0
    public Board(Vector2 position, int gridWidth, int gridHeight, List <TileType> possibleTileValues, TileSpriteData spriteData)
    {
        this.Position        = position;
        this.Width           = gridWidth;
        this.Height          = gridHeight;
        this.PossibleTileIDs = possibleTileValues;
        this.SpriteData      = spriteData;

        PopulateTlesListWithNULL();
    }