void enableElevatorGhosts() { GameObject[] elevatorGhosts = GameObject.FindGameObjectsWithTag("ElevatorGhost"); foreach (GameObject ghost in elevatorGhosts) { GhostScript script = ghost.GetComponent <GhostScript>(); script.StartMoving(); } }
void enableGhosts() { foreach (GameObject ghost in ghosts) { GhostScript script = ghost.GetComponent <GhostScript>(); if (script != null) { script.StartMoving(); } } //special hacky fix for up-down ghosts :/ GameObject[] upDownGhosts = GameObject.FindGameObjectsWithTag("upDownGhost"); foreach (GameObject ghost in upDownGhosts) { upDownGhost script = ghost.GetComponent <upDownGhost>(); if (script != null) { script.upDownGhostsMoving = true; } } //special hacky fix for square ghosts :/ GameObject[] squareGhosts = GameObject.FindGameObjectsWithTag("squareGhost"); foreach (GameObject ghost in squareGhosts) { squareGhost script = ghost.GetComponent <squareGhost>(); if (script != null) { script.squareGhostMoving = true; } } GameObject upDownDoor = GameObject.FindGameObjectWithTag("upDownDoor"); try { upDownDoor doorScript = upDownDoor.GetComponent <upDownDoor>(); if (doorScript != null) { doorScript.upDownDoorMoving = true; } } catch { } }