/// <summary> /// Cause this Ghost to respawn. /// </summary> void GhostRespawn() // This is called in the 'Ghost Dead State' animation as an event at the end of the animation. { CancelInvoke(); // Stop all invoke methods. //transform.localPosition = new Vector3(1f, 1f, -.05f); // Do not use for Assignment 3. GhostController GC = GetComponent <GhostController>(); GC.ResetLBM(); // If this Ghost is the Light Blue Ghost, reset the strict clockwise movement. GC.ResetPositions(); // Reset the positions of the Ghosts to their spawn point. ResetState(); // Reset this Ghost's state. }
/// <summary> /// Resets the game to the necessary default values. /// </summary> void ResetGame() { IsAlive = true; // Sets Pac Man to be alive. DeadStateAnim.SetBool("PacManIsDead", false); // Stop Pac Man's death animation. moveSpeed = DefaultMoveSpeed; // Pac Man's movement speed is back to it's default value. IsOutOfPortal = true; // Set Pac Man to be outside of any Portal. transform.position = SpawnPoint.transform.position; // Pac Man will be moved to his spawn point. R(); // Pac Man will turn right by default. PlaySound("AMBIENT"); // Play the ambient sound. for (int i = 0; i < 4; i++) { GameObject Ghost = GhostHolder.GetChild(i).gameObject; GhostController GC = Ghost.GetComponent <GhostController>(); GC.enabled = true; GC.ResetPositions(); GhostMechanics GM = Ghost.GetComponent <GhostMechanics>(); GM.enabled = true; GM.ResetPositions(); } }