示例#1
0
 public IEnumerator DestroyArea(AreaInstance area, ExitAreaType type)
 {
     if (area != null && m_Areas.Remove(area))
     {
         yield return(area.DestroyArea(this, type));
     }
 }
示例#2
0
    IEnumerator DoExitArea(ExitAreaType type)
    {
        if (curArea != null)
        {
            yield return(curArea.ExitArea(type));

            curArea = null;
        }
    }
示例#3
0
    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);
        }
    }
示例#4
0
    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;
        }
    }
示例#5
0
 /// <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);
 }
示例#6
0
    /// <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);
    }
示例#7
0
    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);
        }
    }
示例#8
0
 public static void FireOnExitArea(LevelInstance level, AreaInstance area, ExitAreaType type)
 {
     Debug.Log("onExitArea");
     onExitArea.Invoke(level, area, type);
 }
示例#9
0
 public static void FireOnDestroyAreaComplete(LevelInstance level, AreaInstance area, ExitAreaType type)
 {
     Debug.Log("onDestroyAreaComplete");
     onDestroyAreaComplete.Invoke(level, area, type);
 }