public void SpecialMark(Vector2 coord) { //Get the coordinates of the special cube that was activated int xCoord = (int)coord.x; int yCoord = (int)coord.y; //Cycle through the 9 coords surrounding and including the pos of the special cube for (int yPos = yCoord - 1; yPos < yCoord + 2; yPos++) { for (int xPos = xCoord - 1; xPos < xCoord + 2; xPos++) { Vector2 tempCoord = new Vector2(xPos, yPos); foreach (GameObject floor in floorCubes) { //If there is a floor cube in the coord mark it as a special tile FloorInfo floorInfo = floor.GetComponent <FloorInfo>(); if (floorInfo.GetCoord() == tempCoord) { floorInfo.SpecialMarkTile(); //Add the coord to a list so that it can be used to find blocks above the floor tiles to activate if (!gameManager.specialBlockCoords.Contains(tempCoord)) { gameManager.specialBlockCoords.Add(tempCoord); } } } } } }
private void MarkFloorCube() { RaycastHit hit; if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.down), out hit, Mathf.Infinity)) { if (hit.collider.tag == "Floor") { FloorInfo info = hit.collider.GetComponent <FloorInfo>(); //Mark the tile markedTileCoord = info.GetCoord(); markedTile = info; info.MarkTile(); tileMarked = true; } } }