Пример #1
0
 public CardGrid(GenericGrid <CardGrid> grid, int x, int y)
 {
     this.grid  = grid;
     this.x     = x;
     this.y     = y;
     isNotEmpty = true;
 }
Пример #2
0
    public GameObject CreateCard(GenericGrid <CardGrid> grid, int x, int y)
    {
        GameObject tmp = Instantiate(CardPrefab);

        tmp.GetComponent <Card>().InitCard(id, face, tile, grid, x, y);

        return(tmp);
    }
Пример #3
0
        private void OnCreateLevelStateEnter()
        {
            gridBuilder = FindObjectOfType <GridBuilder>();

            Grid = gridBuilder.Build(levelName);

            GameStateMachine.Instance.DoTransition <AnimateHQTransition>();
        }
Пример #4
0
 public void InitCard(int id, Sprite face, Sprite tile, GenericGrid <CardGrid> grid, int gridPosX, int gridPosY)
 {
     this.id = id;
     this.spriteRender_Face.sprite = face;
     this.spriteRender_Tile.sprite = tile;
     this.GridPosX = gridPosX;
     this.GridPosY = gridPosY;
     this.grid     = grid;
     this.spriteRender_Selected.gameObject.SetActive(false);
 }
Пример #5
0
        public void LoadLevel(string levelName)
        {
            string assetPath = String.Format(LevelConstants.levelAssetPath, levelName);

            LevelConfig levelConfig = AssetHelper.LoadAssetAtPath <LevelConfig>(assetPath);

            grid = levelConfig.Grid;

            grid.CreateTwoDimensionalGrid();

            SetTileRects();
        }
Пример #6
0
    public void SpawnGrid()
    {
        grid = new GenericGrid <Cell>(width, height, cellSize, gridCenter, gridPivot, false, (int x, int y) => new Cell());

        Transform gridParent = (new GameObject("Grid")).transform;

        for (int x = 0; x < width; x++)
        {
            for (int y = 0; y < height; y++)
            {
                Transform cellWorldObject = Instantiate(cellPrefab).transform;
                cellWorldObject.localPosition = new Vector3(GetCellPosition(x, y).x, GetCellPosition(x, y).y, 5);
                cellWorldObject.SetParent(gridParent);
            }
        }
    }
Пример #7
0
        public GenericGrid Build(string levelName)
        {
            string assetPath = String.Format(LevelConstants.levelAssetPath, levelName);

            LevelConfig levelConfig = AssetHelper.LoadAssetAtPath <LevelConfig>(assetPath);

            GenericGrid grid = new GenericGrid(
                levelConfig.Grid.Width,
                levelConfig.Grid.Height,
                levelConfig.Grid.FlattenedTiles
                );

            for (int x = 0; x < grid.Width; x++)
            {
                for (int y = 0; y < grid.Height; y++)
                {
                    grid.Tiles[x, y].SetupTile(tilePrefab, transform, grid.Width, grid.Height, offset);
                }
            }

            return(grid);
        }
Пример #8
0
 public void CreateGrid()
 {
     x    = GameManager.i.CurrentLevel.GetLevelArray().GetLength(0);
     y    = GameManager.i.CurrentLevel.GetLevelArray().GetLength(1);
     grid = new GenericGrid <CardGrid>(x, y, 1f, 1f, new Vector3(-x / 2, -y / 2, 0), (GenericGrid <CardGrid> g, int x, int y) => new CardGrid(g, x, y));
 }
Пример #9
0
 public static GridObject CreateGridObject(GenericGrid <GridObject> grid, int x, int y)
 {
     return(new GridObject(grid, x, y));
 }
Пример #10
0
 private GridObject(GenericGrid <GridObject> grid, int x, int z)
 {
     this.grid = grid;
     this.x    = x;
     this.z    = z;
 }
Пример #11
0
 void Start()
 {
     grid = new GenericGrid <GridObject>(gridWidth, gridHeight, cellWidth, cellHeight, GridObject.CreateGridObject, Vector3.zero);
     grid.ShowDebugGrid();
 }
Пример #12
0
        public void CreateNewGrid(int gridWidth, int gridHeight)
        {
            grid = new GenericGrid(gridWidth, gridHeight);

            SetTileRects();
        }
Пример #13
0
 public void SetLevelData(GenericGrid grid)
 {
     this.grid = grid;
 }