public CardGrid(GenericGrid <CardGrid> grid, int x, int y) { this.grid = grid; this.x = x; this.y = y; isNotEmpty = true; }
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); }
private void OnCreateLevelStateEnter() { gridBuilder = FindObjectOfType <GridBuilder>(); Grid = gridBuilder.Build(levelName); GameStateMachine.Instance.DoTransition <AnimateHQTransition>(); }
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); }
public void LoadLevel(string levelName) { string assetPath = String.Format(LevelConstants.levelAssetPath, levelName); LevelConfig levelConfig = AssetHelper.LoadAssetAtPath <LevelConfig>(assetPath); grid = levelConfig.Grid; grid.CreateTwoDimensionalGrid(); SetTileRects(); }
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); } } }
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); }
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)); }
public static GridObject CreateGridObject(GenericGrid <GridObject> grid, int x, int y) { return(new GridObject(grid, x, y)); }
private GridObject(GenericGrid <GridObject> grid, int x, int z) { this.grid = grid; this.x = x; this.z = z; }
void Start() { grid = new GenericGrid <GridObject>(gridWidth, gridHeight, cellWidth, cellHeight, GridObject.CreateGridObject, Vector3.zero); grid.ShowDebugGrid(); }
public void CreateNewGrid(int gridWidth, int gridHeight) { grid = new GenericGrid(gridWidth, gridHeight); SetTileRects(); }
public void SetLevelData(GenericGrid grid) { this.grid = grid; }