public IEnumerator DestroyArea(AreaInstance area, ExitAreaType type) { if (area != null && m_Areas.Remove(area)) { yield return(area.DestroyArea(this, type)); } }
IEnumerator DoExitArea(ExitAreaType type) { if (curArea != null) { yield return(curArea.ExitArea(type)); curArea = null; } }
public IEnumerator ExitLevel(ExitLevelType type) { if (isEnterLevel) { isEnterLevel = false; GameEvent.LevelEvent.FireOnBeforeExitLevel(this, type); ExitAreaType exitAreaType = type == ExitLevelType.EnterNextLevel ? ExitAreaType.EnterNextArea : ExitAreaType.ExitArea; yield return(DoExitArea(exitAreaType)); GameEvent.LevelEvent.FireOnExitLevel(this, type); } }
public IEnumerator DestroyRoom(RoomInstance room, ExitAreaType type) { switch (type) { case ExitAreaType.EnterNextArea: yield return(DestroyRoom(room, ExitRoomType.EnterNextRoom)); break; case ExitAreaType.ExitArea: yield return(DestroyRoom(room, ExitRoomType.ExitRoom)); break; } }
/// <summary> /// 只能由Level调用 /// </summary> public IEnumerator DestroyArea(LevelInstance level, ExitAreaType type) { if (isEnterArea) { Debug.LogError("区域还没有退出,不能直接销毁"); } GameEvent.AreaEvent.FireOnBeginDestroyArea(level, this, type); foreach (RoomInstance room in new List <RoomInstance>(m_Rooms)) { yield return(DestroyRoom(room, type)); } GameEvent.AreaEvent.FireOnDestroyAreaComplete(level, this, type); level = null; m_AreaData = null; DestroyImmediate(gameObject); }
/// <summary> /// 只能由LevelManager调用 /// </summary> /// <param name="type"></param> /// <returns></returns> public IEnumerator DestroyLevel(LevelManager manager, ExitLevelType type) { if (isEnterLevel) { Debug.LogError("关卡还没有退出,不能直接销毁"); } GameEvent.LevelEvent.FireOnBeginDestroyLevel(this, type); ExitAreaType exitAreaType = type == ExitLevelType.EnterNextLevel ? ExitAreaType.EnterNextArea : ExitAreaType.ExitArea; List <AreaInstance> tempList = new List <AreaInstance>(m_Areas); foreach (AreaInstance area in tempList) { yield return(DestroyArea(area, exitAreaType)); } tempList.Clear(); GameEvent.LevelEvent.FireOnDestroyLevelComplete(this, type); m_LevelData = null; DestroyImmediate(gameObject); }
public IEnumerator ExitArea(ExitAreaType type) { if (isEnterArea) { isEnterArea = false; GameEvent.AreaEvent.FireOnBeforeExitArea(level, this, type); switch (type) { case ExitAreaType.EnterNextArea: yield return(EixtRoom(ExitRoomType.EnterNextRoom)); break; case ExitAreaType.ExitArea: yield return(EixtRoom(ExitRoomType.ExitRoom)); break; } GameEvent.AreaEvent.FireOnExitArea(level, this, type); } }
public static void FireOnExitArea(LevelInstance level, AreaInstance area, ExitAreaType type) { Debug.Log("onExitArea"); onExitArea.Invoke(level, area, type); }
public static void FireOnDestroyAreaComplete(LevelInstance level, AreaInstance area, ExitAreaType type) { Debug.Log("onDestroyAreaComplete"); onDestroyAreaComplete.Invoke(level, area, type); }