protected IEnumerator ActivateGhostOverTime(ObexGhost ghost) { double waitUntil = WorldClock.AdjustedRealTime + State.TriggerDelay; while (WorldClock.AdjustedRealTime < waitUntil) { yield return(null); } if (ghost != null) { ghost.ActivateGhost(); } yield break; }
public override bool OnPlayerEnter() { ObexGhost ghost = null; ObexGhost [] ghosts = GameObject.FindObjectsOfType <ObexGhost> (); for (int i = 0; i < ghosts.Length; i++) { if (ghosts [i].worlditem.FileName.Equals(State.ObexGhostName)) { ghost = ghosts [i]; } } Array.Clear(ghosts, 0, ghosts.Length); ghosts = null; if (ghost != null) { StartCoroutine(ActivateGhostOverTime(ghost)); return(true); } return(false); }