private IEnumerator EnterUnloadedZone(ZoneLoader loader, ZoneData from, ZoneData to, bool waitForConnections) { Pause(); if (to.Status == ZoneStatus.Unloaded || to.Status == ZoneStatus.Unloading) { yield return(StartCoroutine(LoadZone(to))); } while (to.Status == ZoneStatus.Loading) { yield return(null); } if (waitForConnections) { yield return(StartCoroutine(LoadConnections(to, from))); } else { StartCoroutine(LoadConnections(to, from)); } EnterZone(to, from); Unpause(); loader.IsDone = true; }
public ZoneLoader ChangeZone(ZoneData to, bool waitForConnections) { var from = CurrentZone; var loader = new ZoneLoader { IsDone = false }; if (from != null) { LeaveZone(from, to); } if (to != null) { if (to.Status == ZoneStatus.Loaded && !waitForConnections) { EnterLoadedZone(loader, to, from); } else { StartCoroutine(EnterUnloadedZone(loader, from, to, waitForConnections)); } } else { loader.IsDone = true; } return(loader); }
public ZoneLoader TransitionZone(Zone zone, string spawnName, Transition transition, bool waitForConnections) { var to = Zones[zone.Scene.Index]; var loader = new ZoneLoader(); StartCoroutine(TransitionZone(loader, to, spawnName, transition, waitForConnections)); return(loader); }
private IEnumerator TransitionZone(ZoneLoader loader, ZoneData to, string spawnName, Transition transition, bool waitForConnections) { Player.Instance.Controller.Freeze(); yield return(StartCoroutine(TransitionManager.Instance.StartTransition(transition))); var zoneLoader = ChangeZone(to, false); yield return(StartCoroutine(TransitionManager.Instance.ObscureTransition())); while (!zoneLoader.IsDone) { yield return(null); } var spawn = to.GetSpawnPoint(spawnName); Player.Instance.Mover.WarpToPosition(spawn.Position, spawn.Direction, spawn.Layer); yield return(StartCoroutine(TransitionManager.Instance.FinishTransition())); Player.Instance.Controller.Thaw(); loader.IsDone = true; }
private void EnterLoadedZone(ZoneLoader loader, ZoneData to, ZoneData from) { StartCoroutine(LoadConnections(to, from)); EnterZone(to, from); loader.IsDone = true; }