#pragma warning restore 0649 #endregion public override Queue <Vector3Int> Modify(Grid3D grid, Vector3Int index) { Core.Cell root; if ((root = grid.TryGetCellByIndex(ref index)) == null) { return(null); } Queue <Vector3Int> newIndexes = new Queue <Vector3Int>(); List <Core.Cell> neighb = grid.GetNeighboursCell(ref index); foreach (Core.Cell cell in neighb) { newIndexes.Enqueue(cell.GetIndex()); } //Modif Vector3Int upIndex = root.GetIndex() + grid.GetConnexAxes()[1]; if (!grid.HaveCell(ref upIndex)) { int height = Random.Range(Min_Random, Max_Random); GameObject prefab = FuncEditor.GetPrefabFromInstance(root.gameObject); for (int i = 0; i < height; i++) { if (!grid.HaveCell(ref upIndex)) { FuncEditor.InstantiateCell(prefab, grid, upIndex); } upIndex += grid.GetConnexAxes()[1]; } } return(newIndexes); }
private void SpawnGasAtDistance(int distance) { foreach (Vector3Int axis in grid.GetConnexAxes()) { // Skip top and down axes if (axis.y != 0) { continue; } SpawnGasOnAxisAtDistance(axis, distance); } }
private void Explode() { Vector3 position = transform.position; Instantiate(explosionPrefab, position, Quaternion.identity); Instantiate(firePrefab, position, Quaternion.identity); Vector3Int index = grid.GetIndexByPosition(ref position); foreach (Vector3Int axis in grid.GetConnexAxes()) { // Skip top and down axes if (axis.y != 0) { continue; } FireOnAxis(index, axis); } player.OnBombExploded(); Destroy(gameObject); }