void RoomCloseGates() { if (ActorManager.Singleton.MainActor.mCurRoomGUID == ID) { for (int i = 0; i < CurRoomInfo.m_gateList.Count; i++) { if (!CurRoomInfo.m_gateList[i].isGateOpen) { continue; } if (!CurRoomInfo.m_gateList[i].OutIsActive) { continue; } //关闭闸门 Gate gate = CurRoomInfo.m_gateList[i]; ENGateOpenCondType condType = gate.gateOpenCondId; if (condType == ENGateOpenCondType.enNone) { gate.gateOpenCondId = ENGateOpenCondType.enKillAllMonsters; } RoomOperateGate(gate, i, false); } IsOpenState = false; } }
bool CheckOpenGatesCondition(ENGateOpenCondType condType, List <int> condParam, List <int> paramCount) { // direct open gate if (condType == ENGateOpenCondType.enNone) { return(true); } else if (condType == ENGateOpenCondType.enKillAllMonsters) { for (int n = 0; n < mNpcList.Count; n++) { Actor actor = mNpcList[n]; if (actor != null && !actor.IsRealDead) { return(false); } } } else if (condType == ENGateOpenCondType.enKillSpecialMonster) { for (int n = 0; n < mNpcList.Count; n++) { NPC actor = mNpcList[n]; if (actor != null && !actor.IsRealDead) { for (int i = 0; i < condParam.Count; i++) { if (actor.roomElement.MonsterData.monsterId == condParam[i]) { return(false); } } } } } else if (condType == ENGateOpenCondType.enSatisfyCondID) { for (int n = 0; n < condParam.Count; n++) { int count = 0; if (mSatisfyIDMap.TryGetValue(condParam[n], out count)) { if (count < paramCount[n]) { return(false); } } else { return(false); } } } else if (condType == ENGateOpenCondType.enUseKey) { return(false); } return(true); }
void RoomOpenGates() { IsOpenState = true; for (int i = 0; i < CurRoomInfo.m_gateList.Count; i++) { if (!CurRoomInfo.m_gateList[i].isGateOpen) { continue; } if (CurRoomInfo.m_gateList[i].OutIsActive) { continue; } Gate gate = CurRoomInfo.m_gateList[i]; ENGateOpenCondType condType = gate.gateOpenCondId; if (CheckOpenGatesCondition(condType, gate.gateOpenCondParam, gate.gateOpenCondCount)) { if (gate.OpenGateTime < 1) { gate.OpenGateTime = Time.time + 0.5f; } if (Time.time > gate.OpenGateTime) { RoomOperateGate(gate, i, true); if (CurRoomInfo.m_gateList[i].BridgeData != null && gate.OutIsReactive) { RandomRoomLevel.Singleton.ActiveSceneRoom(CurRoomInfo.m_gateList[i].BridgeData.nextRoomNode, this); gate.OutIsReactive = false; } } else { IsOpenState = false; } } else { gate.OpenGateTime = 0; } } }