private void Update() { if (isActive) { List <List <Glyph> > rotationGrid = curAbility.GetRotatedGrid(); List <Vector4> cellsToRender = new List <Vector4>(); for (int y = 0; y < rotationGrid.Count; y++) { for (int x = 0; x < rotationGrid[y].Count; x++) { if (rotationGrid[x][y]) { cellsToRender.Add(new Vector4(x, y, 0, 0)); visualGrid[x][y].GetComponent <SpriteRenderer>().sprite = rotationGrid[x][y].sprite; } visualGrid[x][y].SetActive(true); } } Shader.SetGlobalVectorArray("cellsToRender", cellsToRender); } }
IEnumerator Attack() { List <List <Glyph> > rotatedAbilityGrid = new List <List <Glyph> >(); List <List <Vector2Int> > nearbyIndices = new List <List <Vector2Int> >(); rotatedAbilityGrid = ability.GetRotatedGrid(); nearbyIndices = GameManager.Instance.gridManager.GetNearbyCellIndicesAsGrid(transform.position, 3); for (int i = 0; i < rotatedAbilityGrid.Count; i++) { for (int j = 0; j < rotatedAbilityGrid[i].Count; j++) { if (rotatedAbilityGrid[i][j] != null) { GameManager.Instance.glyphManager.PlaceGlyph(rotatedAbilityGrid[i][j], nearbyIndices[i][j]); } } } attackGrid.DeactivateGrid(); yield return(null); }