Пример #1
0
    public bool CheckCurRoomPathEnd()
    {
        bool tmpBool = false;

        for (int i = 0; i < m_curSceneRoom.CurRoomInfo.m_gateList.Count; i++)
        {
            SM.Gate tmpGate = m_curSceneRoom.CurRoomInfo.m_gateList[i];
            if (!tmpGate.isGateOpen)
            {//检测当前房间房间门是否开放
                continue;
            }
            if (GetAutoMoveRoomData(m_curSceneRoom.ID).m_gatePathEndList[i])
            {//检测当前闸门是否还用再去探索
                continue;
            }
            if (!tmpGate.OutIsActive)
            {
                AutoMoveRoom curRoomMoveData = GetAutoMoveRoomData(m_curSceneRoom.ID);
                if (curRoomMoveData.m_openAllTrap)
                {
                    tmpBool = true;
                }
            }
        }
        return(tmpBool);
    }
Пример #2
0
    public override bool Execute()
    {
        if (base.Execute())
        {
            SM.SceneRoom curRoom = SM.RandomRoomLevel.Singleton.LookupRoom(RoomGUID);
            if (null == curRoom)
            {
                return(false);
            }
            foreach (var item in mGateDataList)
            {
                switch (item.mGateType)
                {
                case ENGateType.specifiedGate:
                    SM.Gate gate = curRoom.CurRoomInfo.GetGate(item.mGateId);
                    if (gate.isGateOpen)
                    {
                        if (gate.OutIsActive != item.mGateAction)
                        {
                            curRoom.RoomOperateGate(gate, gate.gateDirectionIndex, item.mGateAction);
                        }
                    }
                    break;

                default:
                    break;
                }
            }

            return(true);
        }
        return(false);
    }
Пример #3
0
    public override void Tick()
    {
        base.Tick();
        SM.SceneRoom room = SM.RandomRoomLevel.Singleton.LookupRoom(RoomId);
        if (null != room)
        {
            SM.Gate curGateData = room.GetGateByID(mGateId);
            if (null != curGateData)
            {
                switch (mGateActiveType)
                {
                case GateActiveType.enOpen:
                    if (curGateData.OutIsActive)
                    {
                        IsEnabled = true;
                    }
                    break;

                case GateActiveType.enClose:
                    if (!curGateData.OutIsActive)
                    {
                        IsEnabled = true;
                    }
                    break;

                default:
                    break;
                }
            }
        }
    }
Пример #4
0
 public override bool Execute()
 {
     if (IsEnabled)
     {
         SM.SceneRoom room = SM.RandomRoomLevel.Singleton.LookupRoom(RoomGUID);
         SM.Gate      gate = room.GetGateByID(gateId);
         room.RoomOperateGate(gate, gate.gateDirectionIndex, gateActive);
     }
     return(true);
 }
Пример #5
0
    public bool AutoPathing()
    {
        if (m_curSceneRoom == null)
        {//监测当前所站立位置死否有房间
            return(false);
        }
        if (!m_curSceneRoom.IsOpenState)
        {//监测当前房间是否开门
            return(false);
        }
        if (Self.ActionControl.IsActionRunning(ActorAction.ENType.enStandAction) && m_autoMove)
        {//监测当前是否在站立状态
            m_autoMove = false;
        }
        else if (Self.ActionControl.IsActionRunning(ActorAction.ENType.enMoveAction))
        {//检测是否在移动状态
            MoveAction action = Self.ActionControl.LookupAction(ActorAction.ENType.enMoveAction) as MoveAction;
            if (action.IsStopMove && m_autoMove)
            {//在移动状态停止移动
                m_autoMove = false;
            }
        }
        if (m_autoMove)
        {
            return(false);
        }
        SM.SceneRoom curSceneRoom    = m_curSceneRoom;
        AutoMoveRoom curRoomMoveData = GetAutoMoveRoomData(curSceneRoom.ID);
        int          moveToRoomID    = -1;
        bool         noRoomCanTo     = true;

        for (int i = 0; i < curSceneRoom.CurRoomInfo.m_gateList.Count; i++)
        {//遍历当前房间闸门
            SM.Gate curGate = curSceneRoom.CurRoomInfo.m_gateList[i];
            if (curGate.GateToRoomObjID == -1)
            {
                continue;
            }
            if (!curGate.OutIsActive)
            {//检测当前房间房间门是否开放
                noRoomCanTo = false;
                continue;
            }
            if (curRoomMoveData.NeedToSearch(curGate.gateId))
            {//检测当前闸门是否还用再去探索
                continue;
            }
            moveToRoomID = curGate.GateToRoomObjID;
            break;
        }

        if (moveToRoomID == -1)
        {//闸门没有可去的那么返回上一个房间
            SM.SceneRoom preRoom = m_curSceneRoom.m_preRoom;
            if (preRoom == null)
            {
                return(false);
            }
            moveToRoomID = preRoom.ID;
            if (noRoomCanTo)
            {
                for (int i = 0; i < preRoom.CurRoomInfo.m_gateList.Count; i++)
                {
                    SM.Gate gate = preRoom.CurRoomInfo.m_gateList[i];
                    if (gate.GateToRoomObjID == curSceneRoom.ID)
                    {//将上一个房间通向这个房间的闸门标记为不再探索
                        GetAutoMoveRoomData(moveToRoomID).AcceptGatePathList(gate.gateId);
                    }
                }
            }
        }
        FindPathLogicData logicData = ScenePathfinder.Singleton.FindRoomNode(m_curSceneRoom.CurRoomInfo.m_GUID);

        foreach (FindPathLogicData.LinkInfo linkData in logicData.m_links)
        {
            foreach (FindPathLogicData.LinkInfo linkData1 in linkData.m_linkRoom.m_links)
            {
                if (linkData1.m_linkRoom.GUID == moveToRoomID)
                {
                    ActionMoveTo(linkData1.m_linkPos);
                    m_autoMove = true;
                    return(true);
                }
            }
        }
        return(false);
    }