private void setRoomEvents(RoomInterface room) { /** * * //只有30%的概率房间会生成事件 * if (6 == random.Next(0, 1)) * { * * //判定房间是处于什么位置 楼上 地面 楼下, 不能出现 有冲突的事件, 比如楼下不能出现掉落事件 * if (room.getXYZ()[2] == RoomConstant.ROOM_Z_GROUND) * { * //对于地面事件 所有事件都可以发生 * room.setRoomEvent(getRandomEvent(null)); * * // if () { * // } * } * else if (room.getXYZ()[2] == RoomConstant.ROOM_Z_UP) * { * //对于楼上事件 * } * else * { * //地下事件 * } * } */ }
public void setCurrentRoom(RoomInterface nextRoom, string doorFrom) { if (!this.isPlayer()) { setCurrentRoom(nextRoom.getXYZ()); } else { Vector3 temPos; this.xyz = nextRoom.getXYZ(); switch (doorFrom) { case "U": temPos = new Vector3(nextRoom.getNorthDoor().transform.position.x + 0.2f, nextRoom.getNorthDoor().transform.position.y - 2.5f, 0); this.transform.position = temPos; break; case "D": temPos = new Vector3(nextRoom.getNorthDoor().transform.position.x + 0.2f, nextRoom.getSouthDoor().transform.position.y + 2.5f, 0); this.transform.position = temPos; break; case "R": temPos = new Vector3(nextRoom.getWestDoor().transform.position.x + 1.9f, nextRoom.getWestDoor().transform.position.y, 0); this.transform.position = temPos; break; case "L": temPos = new Vector3(nextRoom.getEastDoor().transform.position.x - 1.9f, nextRoom.getEastDoor().transform.position.y, 0); this.transform.position = temPos; break; } this.findthisRoomNews(nextRoom.getXYZ()); } }
public bool excuteLeaveRoomEvent(RoomInterface ri, Character chara) { //这个房间有没有离开事件 eventI = ri.getRoomEvent(EventConstant.LEAVE_EVENT); //不为空有事件 if (eventI != null) { EventResult result = eventI.excute(chara, null, 0); if (result.getResultCode() == EventConstant.LEAVE_EVENT_SAFE) { return(true); } else { chara.updateActionPoint(0); return(false); } } else { //为空没有事件 // Debug.Log("没有离开事件"); return(true); } }
public bool getConditionStatus(Character chara, RoomInterface room, RoundController roundController) { NPC npc = (NPC)chara; List <Item> its = npc.getBag().getAllItems(); bool c1 = false; bool c2 = false; for (int i = 0; i < its.Count; i++) { if (its[i].getCode() == ItemConstant.ITEM_CODE_SPEC_Y0003 ) { Debug.Log("检查剧情开启:找到任务道具" + its[i].getName()); c1 = true; } if (its[i].getCode() == ItemConstant.ITEM_CODE_SPEC_Y0004) { Debug.Log("检查剧情开启:找到任务道具" + its[i].getName()); c2 = true; } } if (c1 && c2) { return(true); } else { return(false); } }
public bool checkStatus(Character chara, RoomInterface room, RoundController roundController) { bool winc = true; for (int i = 0; i < winConditions.Count; i++) { if (!winConditions[i].getConditionStatus(chara, room, roundController)) { winc = false; break; } } if (winc) { Kate kete = (Kate)roundController.getCharaByName(SystemConstant.P4_NAME); if (kete.isDead()) { this.endFlag = 0; } else { this.endFlag = 1; } } Debug.Log("检查好人胜利条件:" + winc); this.winResult = winc; return(winc); }
public new void defaultAction() { // Debug.Log("run default aciont"); if (waitPlan) { if (this.getGuangBoAction().isPlanSuccess()) { this.sendMessageToPlayer(new string[] { "快点来,我的大刀已经饥渴难耐了。" }); } else { this.sendMessageToPlayer(new string[] { "你们都不来吗? 那我等会再来问问" }); waitPlan = false; } } else { if (this.getTargetRoomList().Count <= 0) { Debug.Log("随便找个房间看看"); this.getTargetRoomList().Enqueue(roomContraller.getRandomRoom()); } RoomInterface target = this.getTargetRoomList().Peek(); if (AutoMoveManager.move(this, roomContraller, eventController, diceRoll, aPathManager, target.getXYZ())) { } } endRound(); }
private static bool move(Character chara, RoomContraller roomContraller, EventController eventController, DiceRollCtrl diceRoll, APathManager aPathManager, string targetRoomType, bool goUpOrDown) { // Debug.Log(targetRoomType + ", " + goUpOrDown); RoomInterface targetRoom = roomContraller.findRoomByRoomType(targetRoomType); return(doMove(chara, roomContraller, eventController, diceRoll, aPathManager, targetRoom, goUpOrDown)); }
internal static void SendRoomEvent(RoomInterface.ControllEventType type,string Name,object obj) { if (RoomEvent != null) { RoomEvent(type, Name, obj); } }
private void setRoomStory(RoomInterface room) { // if (room.getRoomType() == RoomConstant.ROOM_TYPE_BOOK) // { // StoryInterface storyScript = new RaceStory(); // room.setRoomStory(storyScript); // } }
override protected void Start() { base.Start(); // Create the next room. nextRoomObject = Instantiate(roomPrefab, startPosition, Quaternion.identity); nextRoom = nextRoomObject.GetComponent <RoomInterface>(); }
virtual protected void Start() { RoomArranger.instance = this; // Create the first room. currentRoomObject = Instantiate(roomPrefab, startPosition, Quaternion.identity); currentRoom = currentRoomObject.GetComponent <RoomInterface>(); StartCoroutine(TriggerDelayedStart()); }
public bool getConditionStatus(Character chara, RoomInterface room, RoundController roundController) { if (chara.getCurrentRoom()[0] == 0 && chara.getCurrentRoom()[1] == 0 && chara.getCurrentRoom()[2] == 0) { return(true); } else { return(false); } }
private void doClickDoor() { if (this.getShowFlag()) { RoomInterface nextRoom = this.getRooController().findRoomByXYZ(getNextRoomXYZ()); if (nextRoom.checkOpen(getRoundController().getPlayerChara())) { //检查玩家的行动力 bool opened = openDoor(getRoundController().getCurrentRoundChar()); //这里有bug,玩家应该是只能点击 所在房间的几个门,其余房间的门都是不能点击的. //生成门时,门启用,但加锁;玩家进入房间,门解锁可点击;玩家离开房间,门加锁不可点击 if (opened) { if (getRoundController().getCurrentRoundChar().isPlayer()) { getEventController().excuteLeaveRoomEvent(this, getRoom(), getRoundController().getCurrentRoundChar()); } else { bool result = getEventController().excuteLeaveRoomEvent(getRoom(), getRoundController().getCurrentRoundChar()); if (result == true) { //离开门成功 Debug.Log("离开房间成功"); //进入下一个房间 //摄像机移动到下一个房间坐标 getCameraCtrl().setTargetPos(getNextRoomXYZ()); //当前人物坐标移动到下一个房间 getRoundController().getCurrentRoundChar().setCurrentRoom(getNextRoomXYZ()); //触发进门事件 getEventController().excuteEnterRoomEvent(nextRoom, getRoundController().getCurrentRoundChar()); //暂时禁用 运行时有异常 } else { //离开失败 Debug.Log("离开房间失败"); // FindObjectOfType<MessageUI> ().ShowMessge ("离开房间失败 ",0); } } } } else { getMSGUI().showMessage("房间被锁的。"); } } }
public bool checkStoryStart(Character chara, RoomInterface room, RoundController roundController) { for (int i = 0; i < triggerConditions.Count; i++) { if (!triggerConditions[i].getConditionStatus(chara, room, roundController)) { return(false); } } return(true); }
public bool excuteLeaveRoomEvent(RoomInterface ri, Character chara) { EventInterface eventI = ri.getEvent(constant.LEAVE_EVENT); //show ui string selectCode = showMessageUi(eventI.getEventBeginInfo(), eventI.getSelectItem()); EventResult result = eventI.excute(chara, selectCode); showMessageUi(eventI.getEventEndInfo(result.getResultCode()), null); return(result.getStatus()); }
public bool getConditionStatus(Character chara, RoomInterface room, RoundController roundController) { if (chara.getCurrentRoom()[0] == 0 && chara.getCurrentRoom()[1] == 0 && roundController.getPlayerChara().isDead()) { Debug.Log("坏人当前房间 " + chara.getCurrentRoom()[0] + "," + chara.getCurrentRoom()[1]); return(true); } else { return(false); } }
public void excuteStayRoomEvent(RoomInterface ri, Character chara) { this.eventI = ri.getRoomEvent(EventConstant.STAY_EVENT); if (this.eventI != null) { EventInfo ei = new EventInfo(); ei.RoomXyz = ri.getXYZ(); ei.EffectedList.Add(chara.getName()); this.stayEventList.Add(ei); eventI.excute(chara, null, 0); } }
public bool getConditionStatus(Character chara, RoomInterface room, RoundController roundController) { if (room.getRoomType() == RoomConstant.ROOM_TYPE_BOOK && chara.getName() == SystemConstant.P1_NAME) { Debug.Log("检查剧情开启:" + room.getRoomType() + "," + chara.getName()); return(true); } else { Debug.Log("检查剧情没开启:" + room.getRoomType() + "," + chara.getName()); return(false); } }
public bool getConditionStatus(Character chara, RoomInterface room, RoundController roundController) { Player player = (Player)roundController.getCharaByName(SystemConstant.P6_NAME); if (player.isDead()) { return(true); } else { return(false); } }
public bool checkStoryStart(Character chara, RoomInterface room, RoundController roundController) { Debug.Log("开始检查剧本开启条件"); for (int i = 0; i < triggerConditions.Count; i++) { if (!triggerConditions[i].getConditionStatus(chara, room, roundController)) { Debug.Log("不满足条件"); return(false); } } Debug.Log("满足条件"); return(true); }
public bool getConditionStatus(Character chara, RoomInterface room, RoundController roundController) { Kate kete = (Kate)roundController.getCharaByName(SystemConstant.P4_NAME); BenMonster monster = (BenMonster)roundController.getCharaByName(SystemConstant.MONSTER1_NAME); if (monster.isDead() && (kete.isDead() || kete.getAbilityInfo()[3] >= 7)) { return(true); } else { return(false); } }
/** * void OnCollisionEnter2D(Collision2D coll) * { * Debug.Log(coll.gameObject.name); * doClick(); * * } * void OnMouseDown() * * { * * if (!SystemUtil.IsTouchedUI()) * { * * doClick(); * * } * * * }**/ public override void doClick() { // 载入上楼图片... RoomInterface upStairBackRoom = roomContraller.findRoomByRoomType(RoomConstant.ROOM_TYPE_UPSTAIR); Character chara = roundController.getCurrentRoundChar(); roomContraller.findRoomByXYZ(chara.getCurrentRoom()).removeChara(chara); this.roomContraller.setCharaInMiniMap(chara.getCurrentRoom(), this.roundController.getCurrentRoundChar(), false); upStairBackRoom.setChara(chara); chara.setCurrentRoom(upStairBackRoom.getXYZ()); camCtrl.setTargetPos(upStairBackRoom.getXYZ(), RoomConstant.ROOM_Y_GROUND, true); this.roomContraller.setCharaInMiniMap(upStairBackRoom.getXYZ(), this.roundController.getCurrentRoundChar(), true); // 载入上楼图片结束。。。 }
public bool checkStatus(Character chara, RoomInterface room, RoundController roundController) { bool winc = true; for (int i = 0; i < winConditions.Count; i++) { if (!winConditions[i].getConditionStatus(chara, room, roundController)) { winc = false; break; } } Debug.Log("检查好人胜利条件:" + winc); this.winResult = winc; return(winc); }
private void setRoomEvents(RoomInterface room) { //判定房间是处于什么位置 楼上 地面 楼下, 不能出现 有冲突的事件, 比如楼下不能出现掉落事件 if (room.getXYZ()[2] == roomConstant.ROOM_TYPE_GROUND) { // if () { // room.setEvent(getRandomEvent()); // } } else if (room.getXYZ()[2] == roomConstant.ROOM_TYPE_UP) { } else { } }
void roomEvent_RoomEvent(RoomInterface.ControllEventType type, string Name, object obj) { if (RoomEvent != null) { Delegate[] DelObjs = RoomEvent.GetInvocationList(); foreach (Delegate delObj in DelObjs) { List<object> objList = new List<object>(); objList.Add(delObj); objList.Add(type); objList.Add(Name); objList.Add(obj); System.Threading.ThreadPool.QueueUserWorkItem(ThreadSendEvent, objList); } } }
public bool excuteFallRoomEvent(EventInterface eventI, Character chara) { this.eventI = eventI; if (this.eventI != null) { if (chara.isPlayer()) { fallRoomExecuted = false; this.chara = chara; phase = 1; messageUI.getResult().setDone(false); showMessageUi(eventI.getEventBeginInfo(), eventI.getSelectItem()); } else { result = eventI.excute(chara, messageUI.getResult().getResult(), 0); if (result.getResultCode() == EventConstant.FALL_DOWN__EVENT_GOOD) { } else if (result.getResultCode() == EventConstant.FALL_DOWN__EVENT_NORMAL) { roomContraller.findRoomByXYZ(chara.getCurrentRoom()).removeChara(chara); this.roomContraller.setCharaInMiniMap(chara.getCurrentRoom(), chara, false); RoomInterface ri = roomContraller.getRandomDownRoom(); ri.setChara(chara); chara.setCurrentRoom(ri.getXYZ()); this.roomContraller.setCharaInMiniMap(ri.getXYZ(), chara, true); // camCtrl.setTargetPos(upStairRoom.getXYZ(), RoomConstant.ROOM_Y_DOWN, true); } else { RollDiceParam param = new RollDiceParam(this.eventI.getBadDiceNum()); rollVaue = uiManager.showRollDiceImmediately(param); chara.getAbilityInfo()[0] = chara.getAbilityInfo()[0] - rollVaue; roomContraller.findRoomByXYZ(chara.getCurrentRoom()).removeChara(chara); this.roomContraller.setCharaInMiniMap(chara.getCurrentRoom(), chara, false); RoomInterface ri = roomContraller.getRandomDownRoom(); ri.setChara(chara); chara.setCurrentRoom(ri.getXYZ()); this.roomContraller.setCharaInMiniMap(ri.getXYZ(), chara, true); } } } return(true); }
// TODO: Replace this with logic to destroy previous previous on enter. Also handle next next. //public void OnDoorClosed() //{ // Debug.Log("OnDoorClosed"); // Destroy(previousRoomObject); // previousRoomObject = null; // previousRoom = null; //} override protected void UpdateForNewRoom(RoomIteration enteredIteration, bool isUpperDoorway, Vector3 displacementPastDoor) { previousRoomObject = currentRoomObject; currentRoomObject = nextRoomObject; previousRoom = currentRoom; currentRoom = nextRoom; // Create next room. nextRoomObject = Instantiate(roomPrefab, Vector3.zero, Quaternion.identity); Quaternion nextRoomRotation = enteredIteration != RoomIteration.Epilog ? currentRoomObject.transform.rotation * Quaternion.Euler(rotationBetweenDoors) : currentRoomObject.transform.rotation; Vector3 nextRoomPosition = enteredIteration != RoomIteration.Epilog ? currentRoomObject.transform.position + translationBetweenDoors : currentRoomObject.transform.position; nextRoomObject.transform.rotation = nextRoomRotation; nextRoomObject.transform.position = nextRoomPosition; nextRoom = nextRoomObject.GetComponent <RoomInterface>(); }
void OnMouseDown() { if (showFlag) { Debug.Log("WoodDoor.cs OnMouseDown"); //检查玩家的行动力 bool opened = openDoor(roundController.getCurrentRoundChar()); //这里有bug,玩家应该是只能点击 所在房间的几个门,其余房间的门都是不能点击的. //生成门时,门启用,但加锁;玩家进入房间,门解锁可点击;玩家离开房间,门加锁不可点击 if (opened) { // 调用事件处理器处理事情 // bool result = eventController.excuteLeaveRoomEvent (getRoom (), roundController.getCurrentRoundChar ()); 暂时禁用 运行时有异常,对象未被实例化 //非正式测试用,只考虑行动力足够 bool result = true; if (result == true) { //离开门成功 int[] te = getNextRoomXYZ(); Debug.Log("点门移动!目标房间 " + te[0] + "," + te[1] + "," + te[2]); //进入下一个房间 RoomInterface nextRoom = roomContraller.findRoomByXYZ(getNextRoomXYZ()); //摄像机移动到下一个房间坐标 camCtrl.setTargetPos(getNextRoomXYZ()); //当前人物坐标移动到下一个房间 roundController.getCurrentRoundChar().setCurrentRoom(getNextRoomXYZ()); //触发进门事件 // eventController.excuteEnterRoomEvent (nextRoom, roundController.getCurrentRoundChar ()); 暂时禁用 运行时有异常 } else { //离开失败 Debug.Log("WoodDoor.cs OnMouseDown 离开房间失败"); } } } }
public bool excuteEnterRoomEvent(RoomInterface ri, Character chara) { eventI = ri.getRoomEvent(EventConstant.ENTER_EVENT); // Debug.LogError(this.eventI); if (eventI != null) { if (eventI.getSubEventType() == EventConstant.SANCHECK_EVENT) { return(excuteSanCheckEvent(eventI, chara)); } if (eventI.getSubEventType() == EventConstant.FALL_DOWN__EVENT) { return(excuteFallRoomEvent(eventI, chara)); } } Debug.Log(" no san check"); return(true); }
public GameObject genRoom(int[] xyz, int[] door) { //房间Prefab所在文件夹路径 string roomType = groundRoomType.Dequeue(); string url = "Prefabs/" + roomType; //仅用Resources.Load会永久修改原形Prefab。应该用Instatiate,操作修改原形的克隆体 GameObject room = Instantiate(Resources.Load(url)) as GameObject; if (room == null) { Debug.Log("cant find room Prefab !!!"); } else { RoomInterface ri = room.GetComponent(System.Type.GetType(roomType)) as RoomInterface; ri.setXYZ(xyz); //根据数据生成门 if (door [0] == 1) { int[] nextRoomXYZ = xyz; nextRoomXYZ[1] += 1; ri.northDoorEnable(); GameObject doorGo = ri.getNorthDoor(); doorGo.GetComponent <DoorInterface>().setRoom(ri); doorGo.GetComponent <DoorInterface>().setNextRoomXY(nextRoomXYZ); } if (door [1] == 1) { ri.southDoorEnable(); } if (door [2] == 1) { ri.eastDoorEnable(); } if (door [3] == 1) { ri.westDoorEnable(); } } return(room); }
public bool checkStoryEnd(Character chara, RoomInterface room, RoundController roundController) { if (chara.isBoss()) { if (badStoryScript.checkStatus(chara, room, roundController)) { return(true); } } else { if (goodStoryScript.checkStatus(chara, room, roundController)) { return(true); } } return(false); }
public void excuteLeaveRoomEvent(DoorInterface door, RoomInterface ri, Character chara) { //这个房间有没有离开事件 eventI = ri.getRoomEvent(EventConstant.LEAVE_EVENT); //不为空有事件 if (eventI != null) { Debug.Log("有离开事件"); leaveExecuted = false; this.ri = ri; this.chara = chara; this.door = door; phase = 1; messageUI.getResult().setDone(false); showMessageUi(eventI.getEventBeginInfo(), eventI.getSelectItem()); } else { //为空没有事件 Debug.Log("没有离开事件"); door.playerOpenDoorResult(true); } }
public override void Cobj_RoomCEvent(RoomInterface.ControllEventType type, string Name, object obj) { if (RoomEvent != null) { RoomEvent(type, Name, obj); } }
static void RoomClient_RoomEvent(RoomInterface.ControllEventType type, string Name, object obj) { Console.WriteLine("{0} , {1}", type, Name); if (type == RoomInterface.ControllEventType.ADAMStatusChange && ((byte[])obj)[1] == 1) Console.WriteLine("合法卡"); if (type == RoomInterface.ControllEventType.ADAMStatusChange && ((byte[])obj)[32] == 3) Console.WriteLine("門沒關"); //throw new NotImplementedException(); }
void RoomClient_RoomEvent(RoomInterface.ControllEventType type, string Name, object obj) { // byte[] data = new byte[25]; CardReaderEventReport rpt=null; switch (type) { case RoomInterface.ControllEventType.ErrorCard: rpt = MakeReaderEventReport((byte)CardReaderStatusEnum.號碼錯誤); break; case RoomInterface.ControllEventType.ADAMStatusChange: if (((byte[])obj)[32] == 5) rpt= MakeReaderEventReport( (byte)CardReaderStatusEnum.異常入侵); break; default: return; } //data[1]=(byte)((DateTime.Now.Year-2000)/10*16+(DateTime.Now.Year-2000)%10); // data[3]=(byte)((DateTime.Now.Month)/10*16+(DateTime.Now.Month)%10); // data[5] = (byte)((DateTime.Now.Day) / 10 * 16 + (DateTime.Now.Day) % 10); // data[9] = (byte)((DateTime.Now.Hour) / 10 * 16 + (DateTime.Now.Hour) % 10); // data[11] = (byte)((DateTime.Now.Minute) / 10 * 16 + (DateTime.Now.Minute) % 10); // data[13] = (byte)((DateTime.Now.Second) / 10 * 16 + (DateTime.Now.Second) % 10); // CardReaderEventReport rpt = new CardReaderEventReport(data); if (rpt != null && dictCardReaders.ContainsKey(Name)) { dictCardReaders[Name].InvokeStatusChange(rpt); } // throw new NotImplementedException(); }