// 플로어 이동 이벤트가 시작되었을 때 호출된다. public void onBeginTransportEvent() { TransportEvent ev = EventRoot.get().getCurrentEvent <TransportEvent>(); this.door_position = ev.getDoor().getPosition(); this.is_in_event = true; }
// 醫낅즺 泥댄겕. public bool transition_check() { bool is_transit = false; if (this.player.step.get_time() >= use_motion_delay && this.player.control.getMotion() != "m004_use") { ItemWindow.get().clearItem(Item.SLOT_TYPE.MISC, this.slot_index); bool is_atari = (bool)this.item_favor.option0; if (is_atari) { // 異⑸룎 ?대깽?? EventIceAtari event_atari = EventRoot.get().startEvent <EventIceAtari>(); event_atari.setItemSlotAndFavor(this.slot_index, this.item_favor); this.player.step.set_next(STEP.MOVE); } else { this.player.step.set_next(STEP.MOVE); } // ?꾩씠?쒖쓣 ??젣?쒕떎. if (this.slot_index >= 0) { if (is_atari) { // 異⑸룎?덉쓣 ???꾩씠?쒖쓣 ??젣?섏? ?딅뒗?? // 異⑸룎 ????嫄몃줈 ?섎룎由곕떎. this.player.item_slot.miscs[this.slot_index].favor.option0 = false; } else { this.player.item_slot.miscs[this.slot_index].initialize(); this.slot_index = -1; } } is_transit = true; } return(is_transit); }
// 종료 체크. public bool transition_check() { bool is_transit = false; if (this.player.step.get_time() >= use_motion_delay && this.player.control.getMotion() != "m004_use") { ItemWindow.get().clearItem(Item.SLOT_TYPE.MISC, this.slot_index); bool is_atari = (bool)this.item_favor.option0; if (is_atari) { // 충돌 이벤트. EventIceAtari event_atari = EventRoot.get().startEvent <EventIceAtari>(); event_atari.setItemSlotAndFavor(this.slot_index, this.item_favor); this.player.step.set_next(STEP.MOVE); } else { this.player.step.set_next(STEP.MOVE); } // 아이템을 삭제한다. if (this.slot_index >= 0) { if (is_atari) { // 충돌했을 때 아이템을 삭제하지 않는다. // 충돌 안 한 걸로 되돌린다. this.player.item_slot.miscs[this.slot_index].favor.option0 = false; } else { this.player.item_slot.miscs[this.slot_index].initialize(); this.slot_index = -1; } } is_transit = true; } return(is_transit); }
// ================================================================ // protected void disconnect_event() { if (GlobalParam.get().is_in_my_home == false && GlobalParam.get().is_remote_in_my_home == false) { chrBehaviorPlayer player = this.net_player.behavior as chrBehaviorPlayer; if (player != null) { if (!player.isNowHouseMoving()) { HouseMoveStartEvent start_event = EventRoot.get().startEvent <HouseMoveStartEvent>(); start_event.setPrincipal(player); start_event.setHouse(CharacterRoot.get().findCharacter <chrBehaviorNPC_House>("House1")); } } } else if (GlobalParam.get().is_in_my_home&& GlobalParam.get().is_remote_in_my_home) { this.step.set_next(STEP.BYEBYE); } }
// ================================================================ // // 디버그 창을 만든다(플레이어 관련). protected void create_debug_window_player() { var window = dbwin.root().createWindow("player"); window.createButton("당했다") .setOnPress(() => { var player = PartyControl.getInstance().getLocalPlayer(); player.control.causeDamage(100.0f, -1); }); window.createButton("아이스 과식") .setOnPress(() => { var player = PartyControl.getInstance().getLocalPlayer(); if (!player.isNowJinJin()) { player.startJinJin(); } else { player.stopJinJin(); } }); window.createButton("크림 범벅 테스트") .setOnPress(() => { var player = PartyControl.getInstance().getLocalPlayer(); if (!player.isNowCreamy()) { player.startCreamy(); } else { player.stopCreamy(); } }); window.createButton("체력 회복 테스트") .setOnPress(() => { var player = PartyControl.getInstance().getLocalPlayer(); if (!player.isNowHealing()) { player.startHealing(); } else { player.stopHealing(); } }); window.createButton("아이스 당첨 테스트") .setOnPress(() => { window.close(); EventRoot.get().startEvent <EventIceAtari>(); }); window.createButton("무기 교체") .setOnPress(() => { var player = PartyControl.getInstance().getLocalPlayer(); SHOT_TYPE shot_type = player.getShotType(); shot_type = (SHOT_TYPE)(((int)shot_type + 1) % ((int)SHOT_TYPE.NUM)); player.changeBulletShooter(shot_type); }); }
void Update() { // ---------------------------------------------------------------- // // 다음 상태로 전환할지 체크합니다. switch (this.step.do_transition()) { case STEP.WAIT_ENTER: { if (this.player != null) { this.step.set_next(STEP.ENTERED); } } break; case STEP.ENTERED: { if (YesNoAskDialog.get().isSelected()) { if (YesNoAskDialog.get().getSelection() == YesNoAskDialog.SELECTION.YES) { LeaveEvent leave_event = EventRoot.get().startEvent <LeaveEvent>(); if (leave_event != null) { leave_event.setPrincipal(this.player); leave_event.setIsLocalPlayer(true); // 정원 이동 요청 발행. if (GameRoot.get().net_player) { GameRoot.get().NotifyFieldMoving(); GlobalParam.get().request_move_home = false; } else { GlobalParam.get().request_move_home = true; } } this.step.set_next(STEP.IDLE); } else { this.step.set_next(STEP.WAIT_LEAVE); } } else if (this.player == null) { this.step.set_next(STEP.LEAVE); } } break; case STEP.WAIT_LEAVE: { if (this.player == null) { this.step.set_next(STEP.LEAVE); } } break; } // ---------------------------------------------------------------- // // 상태가 전환되면 초기화. while (this.step.get_next() != STEP.NONE) { switch (this.step.do_initialize()) { case STEP.WAIT_ENTER: case STEP.IDLE: { this.player = null; YesNoAskDialog.get().close(); } break; case STEP.ENTERED: { if (GlobalParam.get().is_in_my_home) { YesNoAskDialog.get().setText("친구 정원에 놀러갈까요?"); YesNoAskDialog.get().setButtonText("간다", "안 간다"); } else { YesNoAskDialog.get().setText("집에 돌아갈까요?"); YesNoAskDialog.get().setButtonText("돌아간다", "더 논다"); } YesNoAskDialog.get().dispatch(); } break; case STEP.WAIT_LEAVE: { YesNoAskDialog.get().close(); } break; case STEP.LEAVE: { YesNoAskDialog.get().close(); this.step.set_next(STEP.WAIT_ENTER); } break; } } // ---------------------------------------------------------------- // // 각 상태에서의 실행 처리. switch (this.step.do_execution(Time.deltaTime)) { case STEP.WAIT_ENTER: { } break; } }
// 매 프레임 호출. public override void execute() { // ---------------------------------------------------------------- // // 다음 상태로 전환할지 체크. switch (this.step.do_transition()) { case STEP.IN_ACTION: { var player = PartyControl.get().getLocalPlayer(); if (player.step.get_current() == chrBehaviorLocal.STEP.WAIT_RESTART) { // 체력이 0이 되면 재시작. player.start(); player.control.cmdSetPositionAnon(this.restart_point.position); player.control.cmdSetDirectionAnon(this.restart_point.direction); if (this.restart_point.door != null) { this.restart_point.door.beginWaitLeave(); } this.step.set_next(STEP.RESTART); } else { // 방 이동 이벤트 시작?. var ev = EventRoot.get().getCurrentEvent <TransportEvent>(); if (ev != null) { DoorControl door = ev.getDoor(); if (door.type == DoorControl.TYPE.FLOOR) { // 플로어 이동 도어일 때 . this.is_floor_door_event = true; ev.setEndAtHoleIn(true); } else { // 방 이동 도어일 때. this.restart_point.door = door.connect_to; this.is_floor_door_event = false; } this.step.set_next(STEP.TRANSPORT); } } } break; // 방 이동 이벤트 중. case STEP.TRANSPORT: { // 방 이동 이벤트가 끝나면 일반 모드로. var ev = EventRoot.get().getCurrentEvent <TransportEvent>(); wait_counter += Time.deltaTime; if (ev == null) { if (this.is_floor_door_event) { this.step.set_next(STEP.WAIT_FINISH); } else { this.step.set_next(STEP.READY); wait_counter = 0.0f; } } else { if (ev.step.get_current() == TransportEvent.STEP.READY) { this.step.set_next(STEP.READY); wait_counter = 0.0f; } } } break; // 'レディ!' 표시. // 쓰러졌을 때 재시작. case STEP.READY: case STEP.RESTART: { if (this.is_first_ready) { if (this.step.get_time() > 1.0f) { this.step.set_next(STEP.IN_ACTION); this.is_first_ready = false; } } else { var ev = EventRoot.get().getCurrentEvent <TransportEvent>(); if (ev == null) { this.step.set_next(STEP.IN_ACTION); } } } break; case STEP.WAIT_FINISH: { // 약긴 대기. wait_counter += Time.deltaTime; if (wait_counter > 3.0f) { this.step.set_next(STEP.FINISH); } } break; } // ---------------------------------------------------------------- // // 상태 전환 시 초기화. while (this.step.get_next() != STEP.NONE) { switch (this.step.do_initialize()) { case STEP.IN_ACTION: { Navi.get().dispatchPlayerMarker(); LevelControl.get().endStillEnemies(null, 0.0f); } break; // 방 이동 이벤트 중. case STEP.TRANSPORT: { var current_room = PartyControl.get().getCurrentRoom(); var next_room = PartyControl.get().getNextRoom(); // 다음 방에 적을 만든다. // 방 이동 이벤트 조료 시에 갑자기 적이 나타나지 않게. // 일짜김치 만들어 둔다. LevelControl.get().createRoomEnemies(next_room); LevelControl.get().beginStillEnemies(next_room); LevelControl.get().beginStillEnemies(current_room); } break; // 'レディ!표시. case STEP.READY: { var current_room = PartyControl.get().getCurrentRoom(); var next_room = PartyControl.get().getNextRoom(); if (this.is_first_ready) { LevelControl.get().createRoomEnemies(current_room); LevelControl.get().beginStillEnemies(current_room); LevelControl.get().onEnterRoom(current_room); } else { LevelControl.get().onLeaveRoom(current_room); LevelControl.get().onEnterRoom(next_room); } // 'レディ!' 표시 Navi.get().dispatchYell(YELL_WORD.READY); // 전에 있던 방의 적을 삭제.. if (next_room != current_room) { LevelControl.get().deleteRoomEnemies(current_room); } ItemWindow.get().onRoomChanged(next_room); this.restart_point.position = PartyControl.get().getLocalPlayer().control.getPosition(); this.restart_point.direction = PartyControl.get().getLocalPlayer().control.getDirection(); } break; // 쓰러진 후 재시작. case STEP.RESTART: { // 'レディ!' 표시. Navi.get().dispatchYell(YELL_WORD.READY); this.restart_point.position = PartyControl.get().getLocalPlayer().control.getPosition(); this.restart_point.direction = PartyControl.get().getLocalPlayer().control.getDirection(); } break; case STEP.FINISH: { GameRoot.get().setNextScene("BossScene"); } break; } } // ---------------------------------------------------------------- // // 각 상태에서의 실행 처리. switch (this.step.do_execution(Time.deltaTime)) { case STEP.IN_ACTION: { } break; } // ---------------------------------------------------------------- // }
// ================================================================ // // 조정을 마친 쿼리 실행. protected void execute_queries() { foreach (QueryBase query in this.controll.queries) { if (!query.isDone()) { continue; } switch (query.getType()) { case "item.pick": { QueryItemPick query_pick = query as QueryItemPick; if (query.isSuccess()) { // 아이템을 가지고 있으면 버린다. if (this.controll.item_carrier.isCarrying()) { Debug.Log("Pick:" + query_pick.target + " Carry:" + this.controll.item_carrier.item.id); if (query_pick.target != this.controll.item_carrier.item.id) { // 상대방 플레이어에게 드롭한 사실을 알려줘야만 하므로 쿼리를 만든다. // 동기화할 필요는 없으므로 드롭은 바로 실행한다. Debug.Log("behavior:cmdItemQueryDrop"); QueryItemDrop query_drop = this.controll.cmdItemQueryDrop(); query_drop.is_drop_done = true; this.controll.cmdItemDrop(this.controll.account_name); } } this.controll.cmdItemPick(query_pick,this.controll.account_name,query_pick.target); if (!query_pick.is_anon) { SoundManager.get().playSE(Sound.ID.TFT_SE01); } } query.set_expired(true); } break; case "item.drop": { if (query.isSuccess()) { if ((query as QueryItemDrop).is_drop_done) { // 이미 드롭 완료. Debug.Log("[CLIENT CHAR] Item already dropped."); } else { Debug.Log("[CLIENT CHAR] Item dropped."); this.controll.cmdItemDrop(this.controll.account_name); } } query.set_expired(true); } break; case "house-move.start": { do { if (!query.isSuccess()) { break; } QueryHouseMoveStart query_start = query as QueryHouseMoveStart; chrBehaviorNPC_House house = CharacterRoot.get().findCharacter <chrBehaviorNPC_House>(query_start.target); if (house == null) { break; } var start_event = EventRoot.get().startEvent <HouseMoveStartEvent>(); start_event.setPrincipal(this); start_event.setHouse(house); } while(false); query.set_expired(true); } break; case "house-move.end": { do { if (!query.isSuccess()) { break; } chrBehaviorNPC_House house = this.step_house_move.house; var end_event = EventRoot.get().startEvent <HouseMoveEndEvent>(); end_event.setPrincipal(this); end_event.setHouse(house); } while(false); query.set_expired(true); } break; case "talk": { if (query.isSuccess()) { QueryTalk query_talk = query as QueryTalk; this.controll.cmdDispBalloon(query_talk.words); } query.set_expired(true); } break; } break; } }
// 매 프레임 호출. public override void execute() { // ---------------------------------------------------------------- // // 다음 상태로 전환할지 체크. switch (this.step.do_transition()) { // 무아저씨 등장 데모. case STEP.DEMO0: { if (EventRoot.get().getCurrentEvent() == null) { this.step.set_next(STEP.SELECT_WEAPON); } } break; // 무기 아아템을 선택할 때까지. case STEP.SELECT_WEAPON: { // 무기 아이템을 선택했으면 다음으로 . if (this.player.getShotType() != SHOT_TYPE.EMPTY) { // 선택되지 않은 무기 아이템 삭제. List <ItemController> shot_items = ItemManager.get().findItems(x => x.name.StartsWith("shot")); foreach (var item in shot_items) { ItemManager.get().deleteItem(item.name); } this.select_done_players[this.player.getGlobalIndex()] = true; // 무기 아이템의 스포트 라이트를 지우고 열쇠 위치에 스포트 라이트. this.spotlight_items[0].setPosition(WeaponSelectLevelSequence.getKeyStayPosition().Y(4.0f)); this.spotlight_items[1].SetActive(false); this.step.set_next(STEP.PICKUP_KEY); } } break; // 열쇠를 주을 때까지. case STEP.PICKUP_KEY: { if (ItemManager.get().findItem(this.key_instance_name) == null) { this.spotlight_items[0].SetActive(false); this.step.set_next(STEP.ENTER_DOOR); } } break; // 문으로 들어갈 때까지. case STEP.ENTER_DOOR: { TransportEvent ev = EventRoot.get().getCurrentEvent <TransportEvent>(); if (ev != null) { ev.setEndAtHoleIn(true); this.step.set_next(STEP.TRANSPORT); } } break; // 플로어 이동 이벤트. case STEP.TRANSPORT: { TransportEvent ev = EventRoot.get().getCurrentEvent <TransportEvent>(); if (ev == null) { // 초기 장비의 동기화 대기 쿼리를 발행 . var query = new QuerySelectFinish(this.player.control.getAccountID()); // 쿼리의 타임아웃을 연장. query.timeout = 20.0f; QueryManager.get().registerQuery(query); // 선택한 무기를 게임 서버에 알림. if (this.m_network != null) { CharEquipment equip = new CharEquipment(); equip.globalId = GlobalParam.get().global_account_id; equip.shotType = (int)this.player.getShotType(); Debug.Log("[CLIENT] Send equip AccountID:" + equip.globalId + " ShotType:" + equip.shotType); EquipmentPacket packet = new EquipmentPacket(equip); int serverNode = this.m_network.GetServerNode(); this.m_network.SendReliable <CharEquipment>(serverNode, packet); } else { query.set_done(true); query.set_success(true); } this.step.set_next(STEP.WAIT_FRIEND); } } break; // 다른 플레이어 기다림. case STEP.WAIT_FRIEND: { // 던전으로 이동하는 신호 기다림. if (this.select_scene_finish) { // 만약을 위해 선택 완료가 되지 않은 아이콘을 강제로 선택 완료로 표시. // 해버린다. foreach (var icon in this.selecting_icons) { if (icon.step.get_current() == SelectingIcon.STEP.HAI) { continue; } icon.beginHai(); } this.step.set_next_delay(STEP.FINISH, 2.0f); } } break; } // ---------------------------------------------------------------- // // 상태 전환 시 초기화 while (this.step.get_next() != STEP.NONE) { switch (this.step.do_initialize()) { // 무아저씨 등장 데모. case STEP.DEMO0: { EventRoot.get().startEvent <EventWeaponSelect>(); } break; // 열쇠 줍기. case STEP.PICKUP_KEY: { // 플로어 열쇠가 외위에서 떨어진다. this.create_floor_key(); } break; // 문에 들어갈 때까지. case STEP.ENTER_DOOR: { this.spotlight_key.SetActive(true); } break; // 플로어 이동 이벤트. case STEP.TRANSPORT: { this.kabusan.onBeginTransportEvent(); } break; // 다른 플레이어 기다림. case STEP.WAIT_FRIEND: { // 다른 플레이어의 상황을 나타내는 아이콘을 표시. foreach (var icon in this.selecting_icons) { icon.setVisible(true); } } break; case STEP.FINISH: { GameRoot.get().setNextScene("GameScene"); } break; } } // ---------------------------------------------------------------- // // 각 상태에서의 실행 처리. switch (this.step.do_execution(Time.deltaTime)) { // 다른 플레이어 기다림. case STEP.WAIT_FRIEND: { foreach (var icon in this.selecting_icons) { if (icon.step.get_current() == SelectingIcon.STEP.UUN) { continue; } if (this.select_done_players[icon.player_index]) { icon.beginHai(); } } } break; } // ---------------------------------------------------------------- // this.spotlight_player.setPosition(this.player.control.getPosition().Y(4.0f)); this.spotlight_kabusan.setPosition(this.kabusan.control.getPosition().Y(8.0f)); this.update_queries(); }
void Update() { this.scene_timer += Time.deltaTime; this.disp_timer -= Time.deltaTime; // ---------------------------------------------------------------- // // 다음 상태로 이동할지 체크합니다. switch (this.step.do_transition()) { case STEP.GAME: { } break; } // ---------------------------------------------------------------- // // 상태가 전환될 때 초기화. while (this.step.get_next() != STEP.NONE) { switch (this.step.do_initialize()) { case STEP.CHARACTER_CHANGE: { GlobalParam.get().account_name = this.account_name_net; GlobalParam.get().skip_enter_event = true; Application.LoadLevel("GameScene 1"); } break; case STEP.GAME: { this.account_name_local = GlobalParam.get().account_name; this.account_name_net = GameRoot.getPartnerAcountName(this.account_name_local); if (this.owner == this.account_name_local) { this.is_host = true; } else { // 다른 플레이어의 마을에 갔을 때. this.is_host = false; } // 플레이어를 만듭니다. this.local_player = CharacterRoot.get().createPlayerAsLocal(this.account_name_local); this.local_player.cmdSetPosition(Vector3.zero); if (GlobalParam.get().is_in_my_home == GlobalParam.get().is_remote_in_my_home) { this.net_player = CharacterRoot.get().createPlayerAsNet(this.account_name_net); this.net_player.cmdSetPosition(Vector3.left * 1.0f); } // 레벨 데이터(level_data.txt)를 읽고 NPC/아이템을 배치합니다. MapCreator.get().loadLevel(this.account_name_local, this.account_name_net, !this.is_host); SoundManager.get().playBGM(Sound.ID.TFT_BGM01); // if (!GlobalParam.get().skip_enter_event) { EnterEvent enter_event = EventRoot.get().startEvent <EnterEvent>(); if (enter_event != null) { enter_event.setPrincipal(this.local_player.behavior as chrBehaviorPlayer); enter_event.setIsLocalPlayer(true); } } foreach (ItemManager.ItemState istate in GlobalParam.get().item_table.Values) { if (istate.state == ItemController.State.Picked) { // 이미 아이템을 획득했다면 가져갈 수 있게 합니다. ItemManager.get().finishGrowingItem(istate.item_id); chrController controll = CharacterRoot.getInstance().findPlayer(istate.owner); if (controll != null) { QueryItemPick query = controll.cmdItemQueryPick(istate.item_id, false, true); if (query != null) { query.is_anon = true; query.set_done(true); query.set_success(true); } } } } } break; // 다른 플레이어가 찾아왔습니다. case STEP.WELCOME: { if (this.net_player == null) { EnterEvent enter_event = EventRoot.get().startEvent <EnterEvent>(); if (enter_event != null) { this.net_player = CharacterRoot.getInstance().createPlayerAsNet(this.account_name_net); this.net_player.cmdSetPosition(Vector3.left); enter_event.setPrincipal(this.net_player.behavior as chrBehaviorPlayer); enter_event.setIsLocalPlayer(false); } } } break; // 다른 플레이어가 돌아갑니다. case STEP.BYEBYE: { if (this.net_player != null) { LeaveEvent leave_event = EventRoot.get().startEvent <LeaveEvent>(); if (leave_event != null) { leave_event.setPrincipal(this.net_player.behavior as chrBehaviorPlayer); leave_event.setIsLocalPlayer(false); } } } break; case STEP.VISIT: { GlobalParam.get().is_in_my_home = false; Application.LoadLevel("GameScene 1"); } break; case STEP.GO_HOME: { // 자기 마을로 돌아옵니다. GlobalParam.get().is_in_my_home = true; Application.LoadLevel("GameScene 1"); } break; case STEP.TO_TITLE: { Application.LoadLevel("TitleScene"); } break; } } // ---------------------------------------------------------------- // // 각 상태에서의 실행 처리. switch (this.step.do_execution(Time.deltaTime)) { case STEP.GAME: { } break; } // ---------------------------------------------------------------- // // 통신에 의한 이벤트 처리. // Network 클래스의 컴포넌트 획득. GameObject go = GameObject.Find("Network"); Network network = go.GetComponent <Network>(); if (network != null) { if (network.IsCommunicating() == true) { if (request_connet_event) { // 접속 이벤트를 발동합니다. GlobalParam.get().is_connected = true; request_connet_event = false; } else if (GlobalParam.get().is_connected == false) { // 접속했습니다. Debug.Log("Guest connected."); request_connet_event = true; disp_timer = 5.0f; } } } // 접속 종료 이벤트를 발동합니다. if (request_disconnet_event) { GlobalParam.get().is_disconnected = true; request_disconnet_event = false; // 접속 종료 시 이벤트. disconnect_event(); } // ---------------------------------------------------------------- // if (Input.GetKeyDown(KeyCode.Z)) { dbwin.console().print("로그 테스트 " + this.log_test_count); this.log_test_count++; } }
// ================================================================ // protected void create_debug_window() { var window = dbwin.root().createWindow("game"); window.createButton("캐릭터를 변경합니다") .setOnPress(() => { this.step.set_next(STEP.CHARACTER_CHANGE); }); if (GlobalParam.get().is_in_my_home) { window.createButton("놀러갑니다!") .setOnPress(() => { LeaveEvent leave_event = EventRoot.get().startEvent <LeaveEvent>(); leave_event.setPrincipal(this.local_player.behavior as chrBehaviorPlayer); leave_event.setIsLocalPlayer(true); }); } else { window.createButton("집으로 돌아갑니다~") .setOnPress(() => { LeaveEvent leave_event = EventRoot.get().startEvent <LeaveEvent>(); leave_event.setPrincipal(this.local_player.behavior as chrBehaviorPlayer); leave_event.setIsLocalPlayer(true); }); } window.createButton("누군가 왔다!") .setOnPress(() => { this.step.set_next(STEP.WELCOME); }); window.createButton("바이바~이") .setOnPress(() => { this.step.set_next(STEP.BYEBYE); }); window.createButton("출발 이벤트 테스트") .setOnPress(() => { LeaveEvent leave_event = EventRoot.get().startEvent <LeaveEvent>(); leave_event.setPrincipal(this.local_player.behavior as chrBehaviorPlayer); leave_event.setIsLocalPlayer(true); leave_event.setIsMapChange(false); window.close(); }); window.createButton("도착 이벤트 테스트") .setOnPress(() => { EnterEvent enter_event = EventRoot.get().startEvent <EnterEvent>(); enter_event.setPrincipal(this.local_player.behavior as chrBehaviorPlayer); window.close(); }); window.createButton("이사 시작 이벤트 테스트") .setOnPress(() => { HouseMoveStartEvent start_event = EventRoot.get().startEvent <HouseMoveStartEvent>(); start_event.setPrincipal(this.local_player.behavior as chrBehaviorPlayer); start_event.setHouse(CharacterRoot.get().findCharacter <chrBehaviorNPC_House>("House1")); window.close(); }); window.createButton("이사 종료 이벤트 테스트") .setOnPress(() => { HouseMoveEndEvent end_event = EventRoot.get().startEvent <HouseMoveEndEvent>(); end_event.setPrincipal(this.local_player.behavior as chrBehaviorPlayer); end_event.setHouse(CharacterRoot.get().findCharacter <chrBehaviorNPC_House>("House1")); window.close(); }); }
void Update() { // ---------------------------------------------------------------- // // 다음 상태로 전환할지 체크한다. switch (this.step.do_transition()) { case STEP.WAIT_ENTER: { if (this.is_unlocked) { if (this.keyItemName == null) { if (this.entered_players.Count >= PartyControl.get().getPlayerCount()) { this.step.set_next(STEP.EVENT_IN_ACTION); PartyControl.get().clearDoorState(this.keyItemName); } } else { if (this.entered_players.Count > 0 && PartyControl.get().isDoorOpen(this.keyItemName)) { this.step.set_next(STEP.EVENT_IN_ACTION); PartyControl.get().clearDoorState(this.keyItemName); } } } } break; case STEP.EVENT_IN_ACTION: { } break; case STEP.WAIT_LEAVE: { if (this.entered_players.Count == 0) { this.step.set_next(STEP.WAIT_ENTER); } } break; } // ---------------------------------------------------------------- // // 상태 전환 시 초기화. while (this.step.get_next() != STEP.NONE) { switch (this.step.do_initialize()) { case STEP.SLEEP: { if (this.moji_effect != null) { this.moji_effect.gameObject.destroy(); this.moji_effect = null; } } break; case STEP.WAIT_ENTER: { if (this.is_unlocked) { if (this.moji_effect == null) { this.moji_effect = EffectRoot.get().createDoorMojisEffect(this.transform.position); } } } break; case STEP.WAIT_LEAVE: { if (this.moji_effect != null) { this.moji_effect.gameObject.destroy(); this.moji_effect = null; } } break; case STEP.EVENT_IN_ACTION: { TransportEvent transport_event = EventRoot.get().startEvent <TransportEvent>(); if (transport_event != null) { transport_event.setDoor(this); } else { Debug.LogWarning("Can't begin Transport Event"); } // 다음 방을 설정해 둔다. if (this.connect_to != null) { PartyControl.get().setNextRoom(this.connect_to.room); } } break; } } // ---------------------------------------------------------------- // // 각 상태에서의 실행 처리. switch (this.step.do_execution(Time.deltaTime)) { case STEP.WAIT_ENTER: { } break; } // ---------------------------------------------------------------- // }