void OnTriggerEnter(Collider other) { do { var player = other.gameObject.GetComponent <chrBehaviorLocal>(); if (player == null) { break; } // 이사 중엔 맵 이동을 할 수 없습니다. if (player.isNowHouseMoving()) { break; } // 통신 상대와 접속할 때까지 이동할 수 없습니다. if (GameRoot.get().isConnected() == false) { break; } this.player = player; } while(false); }
public override void initializeMap(GameRoot game_root) { MapCreator map_creator = MapCreator.get(); PartyControl party_control = PartyControl.get(); map_creator.setRoomNum(1, 1); map_creator.floor_root_go = new GameObject("Floor"); // 방 만들기. RoomController room = map_creator.createRoomFloor(new Map.RoomIndex(0, 0)); // 더미 방 만들기. map_creator.createVacancy(new Map.RoomIndex(0, -1)); // 방을 구분하는 벽을 만든다. map_creator.createRoomWall(); // 외벽을 만든다. map_creator.createOuterWalls(); GameRoot.get().createLocalPlayer(); GameRoot.get().createNetPlayers(); // 플레이어 위치 설정. chrBehaviorLocal local_player = PartyControl.get().getLocalPlayer(); Vector3 playerStartPosition = Vector3.zero; local_player.transform.position = playerStartPosition + PartyControl.get().getPositionOffset(local_player.control.global_index); for (int i = 0; i < PartyControl.get().getFriendCount(); i++) { chrBehaviorPlayer friend = PartyControl.get().getFriend(i); friend.control.cmdSetPositionAnon(playerStartPosition + PartyControl.get().getPositionOffset(friend.control.global_index)); } party_control.setCurrentRoom(room); // ボスの作成. chrControllerEnemyBase enemy; if (UsesHumanControlForBoss) { enemy = CharacterRoot.get().createEnemy("Boss1", "chrControllerEnemyBoss", "chrBehaviorEnemyBoss_Human") as chrControllerEnemyBase; } else { enemy = CharacterRoot.get().createEnemy("Boss1", "chrControllerEnemyBoss", "chrBehaviorEnemyBoss") as chrControllerEnemyBase; } enemy.cmdSetPosition(new Vector3(0.0f, 0.0f, 20.0f)); // 스테이터스 창. Navi.get().createStatusWindows(); }
// ---------------------------------------------------------------- // // 肄쒕━?꾩쓽 ?섎? 遺?? private void resolve_collision() { foreach (var result in this.control.collision_results) { if (result.object1 == null) { continue; } //GameObject self = result.object0; GameObject other = result.object1; switch (other.tag) { case "Item": { do { // 耳?댄겕 臾댄븳?쒓났 ?댁쇅(?됱냼 寃뚯엫 以??먮뒗 由щえ?몃뒗. // ?꾩씠?쒖? 二쇱슱 ???녿떎. if (!GameRoot.get().isNowCakeBiking()) { break; } ItemController item = other.GetComponent <ItemController>(); QueryItemPick query = this.control.cmdItemQueryPick(item.name, true, true); } while(false); } break; } } }
// 룸 안에 적을 만든다. public T createRoomEnemy <T>(RoomController room, string name) where T : chrBehaviorEnemy { chrController chr = null; T enemy = null; do { string[] tokens = name.Split('.'); string enemy_kind = name; if (tokens.Length > 1) { enemy_kind = tokens[0]; } // 룸 안에 적을 만들 만들 수 있다(적의 수 제한 체크)?. if (!this.canCreateRoomEnemy(room)) { break; } if ((chr = EnemyRoot.get().createEnemy(enemy_kind)) == null) { break; } if ((enemy = chr.behavior as T) == null) { break; } enemy.setRoom(room); Room level_room = this.rooms[room.getIndex().x, room.getIndex().z]; if (GameRoot.get().isHost() && tokens.Length == 1) { enemy.name += "." + level_room.enemy_index.ToString("D3"); } else { enemy.name = name; } level_room.enemies.Add(chr); dbwin.console().print("**EnemyName" + enemy.name); //Debug.Log("**EnemyName" + enemy.name); var as_lair = chr.behavior as chrBehaviorEnemy_Lair; if (as_lair != null) { level_room.lairs.Add(as_lair); } level_room.enemy_index++; } while(false); return(enemy); }
// ---------------------------------------------------------------- // // 콜리전의 의미 부여. private void resolve_collision() { foreach (var result in this.control.collision_results) { if (result.object1 == null) { continue; } //GameObject self = result.object0; GameObject other = result.object1; switch (other.tag) { case "Item": { do { // 케이크 무한제공 이외(평소 게임 중)에는 리모트는. // 아이템은 주울 수 없다. if (!GameRoot.get().isNowCakeBiking()) { break; } ItemController item = other.GetComponent <ItemController>(); QueryItemPick query = this.control.cmdItemQueryPick(item.name, true, true); } while(false); } break; } } }
// 적을 펑하고 스폰한다(Action, 호스트용)). public void create_enemy_internal() { // 등록된 적 중에서 랜덤하게 선택. if (this.spawn_enemies.Count == 0) { this.spawn_enemies.Add(new SpawnEnemy()); } float sum = 0.0f; foreach (var se in this.spawn_enemies) { sum += se.frequency; } SpawnEnemy spawn_enemy = this.spawn_enemies[0]; float rand = Random.Range(0.0f, sum); foreach (var se in this.spawn_enemies) { rand -= se.frequency; if (rand <= 0.0f) { spawn_enemy = se; break; } } // dbwin.console().print("Spawn LairName:" + this.name); dbwin.console().print("Create enemy:" + spawn_enemy.enemy_name); //Debug.Log("Spawn LairName:" + this.name); //Debug.Log("Create enemy:" + spawn_enemy.enemy_name); chrBehaviorEnemy enemy = LevelControl.get().createCurrentRoomEnemy <chrBehaviorEnemy>(spawn_enemy.enemy_name); if (enemy != null) { enemy.setBehaveKind(spawn_enemy.behave_kind, spawn_enemy.behave_desc); enemy.beginSpawn(this.transform.position + Vector3.up * 3.0f, this.transform.forward); if (GameRoot.get().isHost()) { // 이 문자열을 함께 게스트에 송신한다. string pedigree = enemy.name + "." + spawn_enemy.behave_kind; // 원격 송신. EnemyRoot.get().RequestSpawnEnemy(this.name, pedigree); //Debug.Log(pedigree); } } }
// ---------------------------------------------------------------- // // 다른 플레이어의 상황을 나타내는 아이콘을 생성한다. protected void create_selecting_icons() { this.selecting_icons = new List <SelectingIcon>(); for (int i = 0; i < NetConfig.PLAYER_MAX; i++) { if (!GameRoot.get().isConnected(i)) { continue; } this.selecting_icons.Add(Navi.get().createSelectingIcon(i)); } switch (this.selecting_icons.Count) { case 1: { this.selecting_icons[0].setPosition(new Vector3(0.0f, 0.0f, 0.0f)); } break; case 2: { this.selecting_icons[0].setPosition(new Vector3(-75.0f, 0.0f, 0.0f)); this.selecting_icons[0].setFlip(true); this.selecting_icons[1].setPosition(new Vector3(75.0f, 0.0f, 0.0f)); } break; case 3: { this.selecting_icons[0].setPosition(new Vector3(-75.0f, 0.0f, 0.0f)); this.selecting_icons[0].setFlip(true); this.selecting_icons[1].setPosition(new Vector3(75.0f, 50.0f, 0.0f)); this.selecting_icons[2].setPosition(new Vector3(150.0f, -50.0f, 0.0f)); } break; case 4: { this.selecting_icons[0].setPosition(new Vector3(-75.0f, 50.0f, 0.0f)); this.selecting_icons[0].setFlip(true); this.selecting_icons[1].setPosition(new Vector3(-150.0f, -50.0f, 0.0f)); this.selecting_icons[1].setFlip(true); this.selecting_icons[2].setPosition(new Vector3(75.0f, 50.0f, 0.0f)); this.selecting_icons[3].setPosition(new Vector3(150.0f, -50.0f, 0.0f)); } break; } foreach (var icon in this.selecting_icons) { icon.setVisible(false); } }
// 레벨 시작 시에 호출. public override void start() { this.player = PartyControl.get().getLocalPlayer(); this.kabusan = CharacterRoot.get().findCharacter <chrBehaviorKabu>("NPC_Kabu_San"); // 스포트 라이트. this.spotlight_player = this.spotlight_prefab.instantiate(); this.spotlight_kabusan = this.spotlight_kabusan_prefab.instantiate(); this.spotlight_items = new GameObject[2]; for (int i = 0; i < 2; i++) { this.spotlight_items[i] = this.spotlight_prefab.instantiate(); } this.spotlight_items[0].setPosition(WeaponSelectMapInitializer.getNegiItemPosition().Y(4.0f)); this.spotlight_items[1].setPosition(WeaponSelectMapInitializer.getYuzuItemPosition().Y(4.0f)); this.spotlight_key = this.spotlight_key_prefab.instantiate(); this.spotlight_key.SetActive(false); // 플래그 - 각 플레이어의 선택이 끝났는가?. this.select_done_players = new bool[NetConfig.PLAYER_MAX]; for (int i = 0; i < this.select_done_players.Length; i++) { if (GameRoot.get().isConnected(i)) { this.select_done_players[i] = false; } else { // 참가하지 않은 플레이어는 '선택완료'로 해 둔다. this.select_done_players[i] = true; } } // 다른 플레이어의 상황을 나타내는 아이콘 생성하다. this.create_selecting_icons(); // Network 클래스의 컴포넌트를 획득. GameObject obj = GameObject.Find("Network"); if (obj != null) { this.m_network = obj.GetComponent <Network>(); if (this.m_network != null) { m_network.RegisterReceiveNotification(PacketId.GameSyncInfo, OnReceiveSyncPacket); } } this.step.set_next(STEP.DEMO0); }
// 쿼리를 등록한다. public void registerQuery(QueryBase query) { // 케이크 무한 제공 중엔 통신하지 않아도 케이크를 주울 수 있게. if (GameRoot.get().isNowCakeBiking()) { if (query is QueryItemPick) { query.set_done(true); query.set_success(true); } } this.queries.Add(query); }
// ================================================================ // // 鍮꾪뿤?대퉬?댁슜 而ㅻ㎤?? // 荑쇰━ 怨? // ?⑥뼱???덈뒗 ?꾩씠?쒖쓣 二쇱썙???섎뒗媛?. public QueryItemPick queryPickItem(string owner_id, string item_id, bool is_local, bool forece_pickup) { ItemController item = null; QueryItemPick query = null; bool needMediation = is_local; do { item = this.find_item(item_id); if (item == null) { needMediation = false; break; } // ?깆옣 以묒씤 寃껋? 二쇱슱 ???녿떎. if (!item.isPickable() && !forece_pickup) { needMediation = false; break; } // ?대? ?꾧뎔媛 媛吏怨??덈뒗 寃껋? 二쇱슱 ???녿떎. if (item.picker != "") { needMediation = false; break; } query = new QueryItemPick(owner_id, item_id); QueryManager.get().registerQuery(query); // ?띾뱷 以??곹깭濡?蹂寃쏀븳?? this.setItemState(item_id, ItemController.State.PickingUp, owner_id); } while(false); if (GameRoot.get().isNowCakeBiking() == false) { if (needMediation) { // ?꾩씠???띾뱷 臾몄쓽瑜??쒕떎. SendItemStateChanged(item_id, ItemController.State.PickingUp, owner_id); } } return(query); }
// ================================================================ // // 비헤이비어용 커맨드. // 쿼리 계. // 떨어져 있는 아이템을 주워도 되는가?. public QueryItemPick queryPickItem(string owner_id, string item_id, bool is_local, bool forece_pickup) { ItemController item = null; QueryItemPick query = null; bool needMediation = is_local; do { item = this.find_item(item_id); if (item == null) { needMediation = false; break; } // 성장 중인 것은 주울 수 없다. if (!item.isPickable() && !forece_pickup) { needMediation = false; break; } // 이미 누군가 가지고 있는 것은 주울 수 없다. if (item.picker != "") { needMediation = false; break; } query = new QueryItemPick(owner_id, item_id); QueryManager.get().registerQuery(query); // 획득 중 상태로 변경한다. this.setItemState(item_id, ItemController.State.PickingUp, owner_id); } while(false); if (GameRoot.get().isNowCakeBiking() == false) { if (needMediation) { // 아이템 획득 문의를 한다. SendItemStateChanged(item_id, ItemController.State.PickingUp, owner_id); } } return(query); }
// 레벨 시작 시에 호출. public override void start() { // 각 플레이어가 케이크를 획득한 수.. this.cake_counts = new int[NetConfig.PLAYER_MAX]; for (int i = 0; i < this.cake_counts.Length; i++) { if (GameRoot.get().isConnected(i)) { this.cake_counts[i] = -1; } else { this.cake_counts[i] = 0; } } chrBehaviorLocal local_player = PartyControl.get().getLocalPlayer(); this.cake_counts[local_player.getGlobalIndex()] = local_player.getCakeCount(); QueryCakeCount query_cake = new QueryCakeCount(local_player.getAcountID(), local_player.getCakeCount()); query_cake.timeout = 20.0f; QueryManager.get().registerQuery(query_cake); // Network 클래스의 컴포넌트 획득. GameObject obj = GameObject.Find("Network"); if (obj != null) { this.m_network = obj.GetComponent <Network>(); if (this.m_network != null) { this.m_network.RegisterReceiveNotification(PacketId.PrizeResult, OnReceivePrizeResultPacket); } } // 케이크 데이터 송신. sendPrizeData(); this.step.set_next(STEP.WAIT_FRIEND); }
// 대미지양 통지 정보 수신 함수. public void OnReceiveDamageDataPacket(int node, PacketId id, byte[] data) { DamageDataPacket packet = new DamageDataPacket(data); DamageData damage = packet.GetPacket(); //string log = "ReceiveDamageDataPacket:" + damage.target + "(" + damage.attacker + ") Damage:" + damage.damage; //Debug.Log(log); if (m_network == null || GameRoot.get().isHost() == false) { // 호스트에 가는 통지 패킷이기에 다른 단말은 무시한다. return; } DamageNotifyPacket sendPacket = new DamageNotifyPacket(damage); m_network.SendReliableToAll <DamageData>(sendPacket); }
// ================================================================ // // MonoBehaviour에서 상속. void Start() { // Network 클래스 컴포넌트 획득. GameObject obj = GameObject.Find("Network"); if (obj != null) { m_network = obj.GetComponent <Network>(); if (m_network != null) { m_network.RegisterReceiveNotification(PacketId.MonsterData, OnReceiveMonsterDataPacket); m_network.RegisterReceiveNotification(PacketId.BossDirectAttack, OnReceiveDirectAttackPacket); m_network.RegisterReceiveNotification(PacketId.BossRangeAttack, OnReceiveRangeAttackPacket); m_network.RegisterReceiveNotification(PacketId.BossQuickAttack, OnReceiveQuickAttackPacket); m_network.RegisterReceiveNotification(PacketId.BossDead, OnReceiveBossDeadPacket); } } m_isHost = GameRoot.get().isHost(); }
protected void on_trigger_common(Collider other) { switch (other.gameObject.tag) { case "Item": { if (GameRoot.get().isNowCakeBiking()) { CollisionResult result = new CollisionResult(); result.object0 = this.gameObject; result.object1 = other.gameObject; result.is_trigger = true; this.control.collision_results.Add(result); } else { // 耳?댄겕 臾댄븳?쒓났 ?댁쇅(蹂댄넻 寃뚯엫 以????뚮뒗 由щえ?몃뒗. // ?꾩씠?쒖쓣 二쇱슱 ???녿떎. } } break; case "Door": { CollisionResult result = new CollisionResult(); result.object0 = this.gameObject; result.object1 = other.gameObject; result.is_trigger = true; CollisionManager.getInstance().results.Add(result); } break; } }
protected void on_trigger_common(Collider other) { switch (other.gameObject.tag) { case "Item": { if (GameRoot.get().isNowCakeBiking()) { CollisionResult result = new CollisionResult(); result.object0 = this.gameObject; result.object1 = other.gameObject; result.is_trigger = true; this.control.collision_results.Add(result); } else { // 케이크 무한제공 이외(보통 게임 중)일 때는 리모트는. // 아이템을 주울 수 없다. } } break; case "Door": { CollisionResult result = new CollisionResult(); result.object0 = this.gameObject; result.object1 = other.gameObject; result.is_trigger = true; CollisionManager.getInstance().results.Add(result); } break; } }
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; } // ---------------------------------------------------------------- // }
// 매 프레임 호출. public override void execute() { // ---------------------------------------------------------------- // // 다음 상태로 전환할지 체크. switch (this.step.do_transition()) { case STEP.VS_BOSS: { if (this.child.isFinished()) { GameObject.Destroy(this.child); this.child = null; this.step.set_next(STEP.CAKE_BIKING); } } break; case STEP.CAKE_BIKING: { if (this.child.isFinished()) { GameObject.Destroy(this.child); this.child = null; this.step.set_next(STEP.RESULT); } } break; case STEP.RESULT: { if (this.child.isFinished()) { GameObject.Destroy(this.child); this.child = null; this.step.set_next(STEP.FINISH); } } break; } // ---------------------------------------------------------------- // // 상태 전환 시 초기화. while (this.step.get_next() != STEP.NONE) { switch (this.step.do_initialize()) { case STEP.VS_BOSS: { this.child = this.gameObject.AddComponent <BossLevelSequenceBoss>(); this.child.parent = this; this.child.createDebugWindow(this.window); this.child.start(); Navi.get().dispatchPlayerMarker(); } break; case STEP.CAKE_BIKING: { this.child = this.gameObject.AddComponent <BossLevelSequenceCake>(); this.child.parent = this; this.child.createDebugWindow(this.window); this.child.start(); } break; case STEP.RESULT: { this.child = this.gameObject.AddComponent <BossLevelSequenceResult>(); this.child.parent = this; this.child.createDebugWindow(this.window); this.child.start(); } break; case STEP.FINISH: { // Network 클래스의 컴포넌트 획득. GameObject obj = GameObject.Find("Network"); Network network = null; if (obj != null) { network = obj.GetComponent <Network>(); } if (network != null) { if (GameRoot.get().isHost()) { network.StopGameServer(); } network.StopServer(); network.Disconnect(); GameObject.Destroy(network); } GameRoot.get().setNextScene("TitleScene"); } break; } } // ---------------------------------------------------------------- // // 각 상태에서의 실행 처리. switch (this.step.do_execution(Time.deltaTime)) { case STEP.VS_BOSS: { this.child.execute(); } break; case STEP.CAKE_BIKING: { this.child.execute(); } break; case STEP.RESULT: { this.child.execute(); } break; } // ---------------------------------------------------------------- // }
public override void execute() { CameraControl camera = CameraControl.get(); // ---------------------------------------------------------------- // // 다음 상태로 이행할지 체크합니다.. switch (this.step.do_transition()) { // 이벤트 시작. case STEP.START: { this.step.set_next(STEP.OPEN_DOOR); //camera.module.parallelMoveTo(this.get_locator_position("cam_loc_0")); // 맵에 연관되지 않은 아이템은 가지고 돌아감. bool isPickingup = false; string current_map = MapCreator.get().getCurrentMapName(); ItemController itemYuzu = ItemManager.get().findItem("Yuzu"); if (itemYuzu != null && itemYuzu.isActive()) { if (current_map != itemYuzu.getProduction()) { // 가지고 돌아기는 아이템이 있었다. this.player.controll.cmdItemQueryPick(itemYuzu.name, true, true); isPickingup = true; } } ItemController itemNegi = ItemManager.get().findItem("Negi"); if (itemNegi != null && itemNegi.isActive()) { if (current_map != itemNegi.getProduction()) { // 가지고 돌아가는 아이템이 있었다. this.player.controll.cmdItemQueryPick(itemNegi.name, true, true); isPickingup = true; } } if (this.player.controll.item_carrier.isCarrying() && isPickingup == false) { ItemController item = this.player.controll.item_carrier.getItem(); if (item.isExportable() == false) { // 가지고 나갈 수 없는 것은 두고 갑니다. QueryItemDrop query_drop = this.player.controll.cmdItemQueryDrop(); query_drop.is_drop_done = true; this.player.controll.cmdItemDrop(this.player.controll.account_name); } } } break; // 배추가 옆으로 움직이고 & 대야가 등장. case STEP.OPEN_DOOR: { if (this.hakusai_fcurve.isDone() && this.tarai_fcurve.isDone()) { this.step.set_next(STEP.RIDE_TARAI_0); } } break; // 대야를 탑니다(기슭까지 걷는다). case STEP.RIDE_TARAI_0: { if (!this.player_move.isMoving()) { this.step.set_next(STEP.RIDE_TARAI_1); } } break; // 대야를 탑니다(대야를 향해 점프). case STEP.RIDE_TARAI_1: { if (!this.player_jump.isMoving()) { this.step.set_next(STEP.CLOSE_DOOR); } } break; // 배추가 돌아오고 & 대야가 밖을 향해 이동. case STEP.CLOSE_DOOR: { if (this.hakusai_fcurve.isDone() && this.tarai_fcurve.isDone()) { this.step.set_next(STEP.END); } } break; case STEP.END: { camera.module.popPosture(); this.step.set_next(STEP.IDLE); } break; } // ---------------------------------------------------------------- // // 상태가 전환할 때의 초기화. while (this.step.get_next() != STEP.NONE) { dbwin.console().print(this.step.ToString()); switch (this.step.do_initialize()) { // 이벤트 시작. case STEP.START: { camera.module.pushPosture(); this.player.beginOuterControll(); this.tarai_fune.transform.position = this.tarai_enter_spline.curve.cvs.front().position; } break; // 배추가 옆으로 움직이고 & 대야가 등장. case STEP.OPEN_DOOR: { this.hakusai_set.setControl(true); this.hakusai_fcurve.setSlopeAngle(10.0f, 10.0f); this.hakusai_fcurve.setDuration(4.0f); this.hakusai_fcurve.start(); this.hakusai_tracer.restart(); this.tarai_fcurve.setSlopeAngle(60.0f, 10.0f); this.tarai_fcurve.setDuration(2.0f); this.tarai_fcurve.setDelay(2.0f); this.tarai_fcurve.start(); } break; // 대야를 탑니다(기슭까지 걷는다). case STEP.RIDE_TARAI_0: { this.player_move.position.start = this.player.controll.getPosition(); this.player_move.position.goal = this.get_locator_position("chr_loc_0"); this.player_move.startConstantVelocity(chrBehaviorLocal.MOVE_SPEED); } break; // 대야를 탑니다(대야를 향해서 점프). case STEP.RIDE_TARAI_1: { Vector3 start = this.player.controll.getPosition(); Vector3 goal = this.tarai_enter_spline.curve.cvs.back().position; this.player_jump.start(start, goal, 1.0f); } break; // 배추가 돌아오고 & 대야가 밖을 향해 이동. case STEP.CLOSE_DOOR: { this.hakusai_fcurve.setSlopeAngle(10.0f, 10.0f); this.hakusai_fcurve.setDuration(4.0f); this.hakusai_fcurve.start(); this.hakusai_tracer.restart(); this.hakusai_tracer.setCurrentByDistance(this.hakusai_tracer.curve.calcTotalDistance()); this.tarai_tracer.attach(this.tarai_leave_spline.curve); this.tarai_tracer.restart(); this.tarai_fcurve.reset(); this.tarai_fcurve.setSlopeAngle(20.0f, 60.0f); this.tarai_fcurve.setDuration(2.0f); this.tarai_fcurve.start(); } break; case STEP.END: { // 이벤트 종료. this.hakusai_set.reset(); this.hakusai_set.setControl(false); if (this.is_local_player) { if (this.is_map_change) { GlobalParam.get().skip_enter_event = false; GlobalParam.get().fadein_start = false; if (GlobalParam.get().is_in_my_home) { GameRoot.get().step.set_next(GameRoot.STEP.VISIT); } else { GameRoot.get().step.set_next(GameRoot.STEP.GO_HOME); } // 정원 이동을 알림. if (GlobalParam.get().request_move_home) { Debug.Log("NotifyFieldMoving Leave END."); GameRoot.get().NotifyFieldMoving(); } } else { GlobalParam.get().is_in_my_home = !GlobalParam.get().is_in_my_home; this.player.controll.cmdSetPosition(this.initial_player_position); this.player.endOuterControll(); } } else { // 아이템을 비활성화하고 나서 드롭하지 않으면 재생합니다. ItemBehaviorFruit fruit = this.player.controll.getCarriedItem <ItemBehaviorFruit>(); if (fruit != null) { fruit.activeItem(false); } // 맵 이동이 없을 때 아이템을 가지고 돌아온 경우 아이템의 게임 오브젝트를. // 폐기하지 않게 하고자 아이템을 버립니다. this.player.controll.cmdItemDrop(this.player.name); CharacterRoot.get().deletaCharacter(this.player.controll); } this.player = null; } break; } } // ---------------------------------------------------------------- // // 각 상태에서의 실행 처리. switch (this.step.do_execution(Time.deltaTime)) { // 배추가 옆으로 움직이고 & 대야가 등장. case STEP.OPEN_DOOR: { this.hakusai_fcurve.execute(Time.deltaTime); this.hakusai_tracer.proceedToDistance(this.hakusai_tracer.curve.calcTotalDistance() * this.hakusai_fcurve.getValue()); this.hakusai_set.setPosition(this.hakusai_tracer.getCurrent().position); this.tarai_fcurve.execute(Time.deltaTime); this.tarai_tracer.proceedToDistance(this.tarai_tracer.curve.calcTotalDistance() * this.tarai_fcurve.getValue()); this.tarai_fune.setPosition(this.tarai_tracer.getCurrent().position); if (this.tarai_fcurve.isTriggerDone()) { this.ripple_effect.is_created = false; } } break; // 대야를 탑니다(기슭까지 걷는다). case STEP.RIDE_TARAI_0: { this.player_move.execute(Time.deltaTime); this.player.controll.cmdSetPosition(this.player_move.position.current); this.player.controll.cmdSmoothHeadingTo(this.player_move.position.goal); this.player.playWalkMotion(); } break; // 대야를 탑니다(대야를 향해서 점프). case STEP.RIDE_TARAI_1: { this.player_jump.execute(Time.deltaTime); this.player.controll.cmdSetPosition(this.player_jump.position); this.player.controll.cmdSmoothHeadingTo(this.player_jump.goal); this.player.stopWalkMotion(); if (this.player_jump.is_trigger_bounce && this.player_jump.bounce_count == 1) { this.ripple_effect.is_created = false; } } break; // 배추가 돌아오고 & 대야가 밖을 향해 이동. case STEP.CLOSE_DOOR: { this.hakusai_fcurve.execute(Time.deltaTime); this.hakusai_tracer.proceedToDistance(this.hakusai_tracer.curve.calcTotalDistance() * (1.0f - this.hakusai_fcurve.getValue())); this.hakusai_set.setPosition(this.hakusai_tracer.cv.position); this.tarai_fcurve.execute(Time.deltaTime); this.tarai_tracer.proceedToDistance(this.tarai_tracer.curve.calcTotalDistance() * this.tarai_fcurve.getValue()); SimpleSpline.ControlVertex cv = this.tarai_tracer.getCurrent(); this.tarai_fune.setPosition(cv.position); this.player.controll.cmdSetPosition(cv.position); this.player.controll.cmdSmoothHeadingTo(cv.position + cv.tangent.Y(0.0f)); this.player.stopWalkMotion(); } break; } // 대야 뒤에 나오는 물결. if (!this.ripple_effect.is_created || Vector3.Distance(this.ripple_effect.last_position, this.tarai_fune.getPosition()) > 2.0f) { this.ripple_effect.is_created = true; this.ripple_effect.last_position = this.tarai_fune.transform.position; EffectRoot.get().createRipple(this.ripple_effect.last_position); } // ---------------------------------------------------------------- // }
public override void execute() { // 아이템과 캐릭터를 클릭했을 때 // // 클릭한 아이템과 캐릭터의 컬리전에 부딪혔으면 // 멈춘다. // if (this.move_target_item != "") { if (this.move_target_item == this.collision) { this.move_target = this.controll.getPosition(); } } // ---------------------------------------------------------------- // // 조정이 끝난 쿼리 실행. base.execute_queries(); // ---------------------------------------------------------------- // // 다음 상태로 이동할지 체크한다. switch (this.step.do_transition()) { case STEP.MOVE: { } break; case STEP.WAIT_QUERY: { if (this.controll.queries.Count <= 0) { this.step.set_next(STEP.MOVE); } } break; } // ---------------------------------------------------------------- // // 상태 전환 시 초기화. while (this.step.get_next() != STEP.NONE) { switch (this.step.do_initialize()) { case STEP.OUTER_CONTROL: { this.rigidbody.Sleep(); } break; case STEP.MOVE: { this.move_target = this.transform.position; } break; case STEP.HOUSE_MOVE: { this.initialize_step_house_move(); } break; } } // ---------------------------------------------------------------- // // 각 상태에서의 실행 결과. switch (this.step.do_execution(Time.deltaTime)) { case STEP.MOVE: { this.exec_step_move(); } break; case STEP.HOUSE_MOVE: { this.execute_step_house_move(); } break; } this.collision = ""; // ---------------------------------------------------------------- // GameInput gi = this.controll.game_input; if (gi.serif_text.trigger_on) { // 어미(장비 아이템 특전). ItemFavor item_favor = this.controll.getItemFavor(); gi.serif_text.text += item_favor.term_word; this.controll.cmdQueryTalk(gi.serif_text.text, true); } // ---------------------------------------------------------------- // // 10 프레임에 1회, 좌표를 네트워크로 전송한다(테스트). { do { if (GameRoot.get().net_player == null) { break; } if (this.step.get_current() == STEP.OUTER_CONTROL) { break; } m_send_count = (m_send_count + 1) % SplineData.SEND_INTERVAL; if (m_send_count != 0) { break; } // 통신용 좌표 송신. Vector3 target = this.controll.getPosition() + Vector3.left; CharacterCoord coord = new CharacterCoord(target.x, target.z); Vector3 diff = m_prev - target; if (diff.sqrMagnitude > 0.0001f) { m_culling.Add(coord); //Debug.Log("SendCharacterCoord[index:" + m_plotIndex + "]"); CharacterRoot.get().SendCharacterCoord(controll.account_name, m_plotIndex, m_culling); ++m_plotIndex; if (m_culling.Count >= PLOT_NUM) { m_culling.RemoveAt(0); } m_prev = target; } } while(false); } }
private void resolve_pick_item_query(QueryItemPick query) { do { if (!query.isSuccess()) { break; } // 아이템 효능만 복사하고 삭제한다. ItemController item = this.control.cmdItemPick(query, query.target); if (item == null) { break; } // 효과. EffectRoot.get().createItemGetEffect(this.control.getPosition()); SoundManager.get().playSE(Sound.ID.DDG_SE_SYS02); switch (item.behavior.item_favor.category) { case Item.CATEGORY.CANDY: { // 아이템 창에 아이콘 표시. this.item_slot.candy.favor = item.behavior.item_favor.clone(); ItemWindow.get().setItem(Item.SLOT_TYPE.CANDY, 0, this.item_slot.candy.favor); // 샷의 일정시간 파워업 this.startShotBoost(); } break; case Item.CATEGORY.SODA_ICE: case Item.CATEGORY.ETC: { // 빈 슬롯에 아이템 설정. int slot_index = this.item_slot.getEmptyMiscSlot(); if (slot_index >= 0) { this.item_slot.miscs[slot_index].item_id = query.target; this.item_slot.miscs[slot_index].favor = item.behavior.item_favor.clone(); // 아이템 창에 아이콘 표시. ItemWindow.get().setItem(Item.SLOT_TYPE.MISC, slot_index, this.item_slot.miscs[slot_index].favor); } } break; case Item.CATEGORY.FOOD: { // 체력 회복. if (GameRoot.get().isNowCakeBiking()) { this.control.vital.healFullInternal(); } else { this.control.vital.healFull(); // 레인보우 칼러 효과. this.skin_color_control.startHealing(); } // 체력 회복을 알림. CharacterRoot.get().NotifyHitPoint(this.getAcountID(), this.control.vital.getHitPoint()); // 아이템 폐기를 알림. this.control.cmdItemDrop(query.target); // 케이크를 먹은 수(케이크 무한제공용). this.cake_count++; } break; // 방 열쇠. case Item.CATEGORY.KEY: { PartyControl.get().getLocalPlayer().control.consumeKey(item); Item.KEY_COLOR key_color = Item.Key.getColorFromInstanceName(item.name); // 아이템 창에 아이콘 표시. if (key_color != Item.KEY_COLOR.NONE) { ItemWindow.get().setItem(Item.SLOT_TYPE.KEY, (int)key_color, item.behavior.item_favor); } } break; // 플로어 이동 문 열쇠. case Item.CATEGORY.FLOOR_KEY: { MapCreator.getInstance().UnlockBossDoor(); // 아이템 창에 아이콘 표시. ItemWindow.get().setItem(Item.SLOT_TYPE.FLOOR_KEY, 0, item.behavior.item_favor); } break; case Item.CATEGORY.WEAPON: { // 샷 변경(대파 발칸 / 유자 폭탄). SHOT_TYPE shot_type = Item.Weapon.getShotType(item.name); if (shot_type != SHOT_TYPE.NONE) { this.changeBulletShooter(shot_type); } } break; } item.vanish(); } while(false); query.set_expired(true); }
// 매 프레임 호출. 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(); }
// ---------------------------------------------------------------- // // 레벨 데이터를 로드하여 캐릭터/아이템을 배치합니다. public void loadLevel(string local_account, string net_account, bool create_npc) { this.level_texts = this.level_data.text; string[] lines = this.level_texts.Split('\n'); foreach (var line in lines) { if (line == "") { continue; } string[] words = line.Split(); if (words.Length < 3) { continue; } string name = words[0]; if (name.StartsWith("ChrModel_")) { // 캐릭터. this.create_character(words, local_account, net_account, create_npc); } if (name.StartsWith("ItemModel_")) { bool active = true; ItemManager.ItemState istate = ItemManager.get().FindItemState(name); // 맵에 관련이 없는 아이템의 생성 제어. if (current_map_name == "Field" && name == "ItemModel_Yuzu") { if (istate.state != ItemController.State.Picked) { // 아무도 소유하지 않고 맵에 연결되지 않은 아이템이므로 생성하지 않습니다. // continue; active = false; } else { if (istate.owner == net_account && GameRoot.get().net_player == null) { // 소유하고 있는 원격 캐릭터가 이 필드에는 없습니다. // continue; active = false; } } } else if (current_map_name == "Field_v2" && name == "ItemModel_Negi") { if (istate.state != ItemController.State.Picked) { // 아무도 소유하지 않고 맵에 연결된 아이템이 아니므로 생성하지 않습니다. //continue; active = false; } else { if (istate.owner == net_account && GameRoot.get().net_player == null) { // 소유하고 있는 리모트 캐릭터가 이 필드에는 없습니다. //continue; active = false; } } } // 맵에 연결된 아이템을 취득했을때의 제어. if (current_map_name == "Field" && name == "ItemModel_Negi" || current_map_name == "Field_v2" && name == "ItemModel_Yuzu") { // 맵에 연결된 아이템이라도 가지고 나갔을 땐 생성하지 생성하지 않습니다. if (istate.state == ItemController.State.Picked && istate.owner == net_account && GlobalParam.get().is_in_my_home != GlobalParam.get().is_remote_in_my_home) { // 다른 사람이 소유하고 있고 다른 맵에 있을 때에 생성하지 않습니다. //continue; active = false; } } // 아이템. string item_name = this.create_item(words, local_account, active); ItemController new_item = ItemManager.get().findItem(item_name); if (new_item != null) { bool is_exportable = false; string production = ""; switch (new_item.name) { case "Negi": { is_exportable = true; production = "Field"; } break; case "Yuzu": { is_exportable = true; production = "Field_v2"; } break; } new_item.setExportable(is_exportable); new_item.setProduction(production); } } } }
public int RandomSeedForDebugMax = 1000; //< UseRandomSeedForDebug가 유효한 때 사용하는 랜덤 레인지. public override void initializeMap(GameRoot game_root) { MapCreator mapCreator = MapCreator.getInstance(); Vector3 playerStartPosition; int seed = 0; if (UseRandomSeedForDebug) { TimeSpan ts = new TimeSpan(DateTime.Now.Ticks); double seconds = ts.TotalSeconds; seed = (int)((long)seconds - (long)(seconds / 1000.0) * 1000); //seed = Random.Range(RandomSeedForDebugMin, RandomSeedForDebugMax); } else { seed = GlobalParam.get().seed; } // 맵 자동 생성. Debug.Log("Use random seed:" + seed); mapCreator.generateLevel(seed); GameRoot.get().createLocalPlayer(); GameRoot.get().createNetPlayers(); chrBehaviorLocal local_player = PartyControl.get().getLocalPlayer(); // 아이템을 만든다. mapCreator.generateItems(local_player.getAcountID()); mapCreator.createFloorDoor(); // 플레이어의 위치 설정. playerStartPosition = mapCreator.getPlayerStartPosition(); local_player.transform.position = playerStartPosition + PartyControl.get().getPositionOffset(local_player.control.global_index); for (int i = 0; i < PartyControl.get().getFriendCount(); i++) { chrBehaviorPlayer friend = PartyControl.get().getFriend(i); friend.control.cmdSetPositionAnon(playerStartPosition + PartyControl.get().getPositionOffset(friend.control.global_index)); } PartyControl.get().setCurrentRoom(mapCreator.getRoomFromPosition(playerStartPosition)); // 스테이터스 윈도우. Navi.get().createStatusWindows(); // // #if false string local_player_id = PartyControl.get().getLocalPlayer().getAcountID(); ItemManager.get().createItem("candy00", local_player_id); ItemManager.get().setPositionToItem("candy00", playerStartPosition + new Vector3(0.0f, 0.0f, 4.0f)); ItemManager.get().createItem("ice00", local_player_id); ItemManager.get().setPositionToItem("ice00", playerStartPosition + new Vector3(7.0f, 0.0f, 0.0f)); ItemManager.get().createItem("key00", local_player_id); ItemManager.get().setPositionToItem("key00", playerStartPosition + new Vector3(10.0f, 0.0f, 0.0f)); ItemManager.get().createItem("key01", local_player_id); ItemManager.get().setPositionToItem("key01", playerStartPosition + new Vector3(10.0f, 0.0f, 0.0f)); ItemManager.get().createItem("key02", local_player_id); ItemManager.get().setPositionToItem("key02", playerStartPosition + new Vector3(10.0f, 0.0f, 0.0f)); ItemManager.get().createItem("key03", local_player_id); ItemManager.get().setPositionToItem("key03", playerStartPosition + new Vector3(10.0f, 0.0f, 0.0f)); #endif }
// ================================================================ // protected void create_debug_window() { var window = dbwin.root().createWindow("party"); window.createButton("다음 사람") .setOnPress(() => { GlobalParam.getInstance().global_account_id = (GlobalParam.getInstance().global_account_id + 1) % 4; GlobalParam.getInstance().fadein_start = false; GameRoot.get().restartGameScane(); }); window.createButton("도와줘요~") .setOnPress(() => { int friend_count = PartyControl.get().getFriendCount(); if (friend_count < 3) { int friend_global_index = (GlobalParam.getInstance().global_account_id + friend_count + 1) % 4; this.createFakeNetPlayer(friend_global_index); } }); window.createButton("바이바~이") .setOnPress(() => { int friend_count = PartyControl.get().getFriendCount(); if (friend_count >= 1) { chrBehaviorPlayer player = this.getFriend(0); int friend_global_index = player.control.global_index; this.deleteNetPlayer(friend_global_index); } }); window.createButton("집합!") .setOnPress(() => { int friend_count = this.getFriendCount(); for (int i = 0; i < friend_count; i++) { chrBehaviorFakeNet friend = this.getFriend(i) as chrBehaviorFakeNet; if (friend == null) { continue; } friend.in_formation = true; } }); window.createButton("해산!") .setOnPress(() => { int friend_count = this.getFriendCount(); for (int i = 0; i < friend_count; i++) { chrBehaviorFakeNet friend = this.getFriend(i) as chrBehaviorFakeNet; if (friend == null) { continue; } friend.in_formation = false; } }); window.createButton("아저씨개!") .setOnPress(() => { notifySummonBeast(Character.BEAST_TYPE.DOG); //this.request_summon_beast = Character.BEAST_TYPE.DOG; }); window.createButton("아줌마냥!") .setOnPress(() => { notifySummonBeast(Character.BEAST_TYPE.NEKO); //this.request_summon_beast = Character.BEAST_TYPE.NEKO; }); window.createButton("소환해제") .setOnPress(() => { unsummonBeast(); }); }
void Update() { RoomController room_control = PartyControl.get().getCurrentRoom(); do { if (room_control == null) { break; } Room level_room = this.rooms[room_control.getIndex().x, room_control.getIndex().z]; if (GameRoot.get().isHost()) { // 로컬은 직접 만든다. //if(Input.GetMouseButtonDown(1)) { if (this.spawn_timer > 5.0f) { chrBehaviorEnemy_Lair lair = null; for (int i = 0; i < level_room.lairs.Count; i++) { level_room.spawner = (level_room.spawner + 1) % level_room.lairs.Count; lair = level_room.lairs[level_room.spawner]; if (lair != null) { break; } } if (lair != null) { dbwin.console().print("LairName:" + lair.name); lair.spawnEnemy(); } this.spawn_timer = 0.0f; } this.spawn_timer += Time.deltaTime; } else { // 리모트는 호스트의 지시로 만든다. foreach (var lair in level_room.lairs) { if (lair == null) { continue; } // 조정이 끝난 쿼리를 찾는다. List <QueryBase> queries = QueryManager.get().findDoneQuery(lair.name); List <QueryBase> spawn_queries = queries.FindAll(x => (x as QuerySpawn) != null); foreach (var query in spawn_queries) { QuerySpawn query_spawn = query as QuerySpawn; // 용무를 마쳤으므로 삭제한다. query_spawn.set_expired(true); if (!query_spawn.isSuccess()) { continue; } dbwin.console().print("LairName:" + lair.name); dbwin.console().print("EnemyName:" + query_spawn.monster_id); //Debug.Log("LairName:" + lair.name); //Debug.Log("EnemyName:" + query_spawn.monster_id); lair.spawnEnemyFromPedigree(query_spawn.monster_id); } } } } while(false); }
private void resolve_pick_item_query(QueryItemPick query) { do { if (!query.isSuccess()) { break; } // ?꾩씠???⑤뒫留?蹂듭궗?섍퀬 ??젣?쒕떎. ItemController item = this.control.cmdItemPick(query, query.target); if (item == null) { break; } // ?④낵. EffectRoot.get().createItemGetEffect(this.control.getPosition()); SoundManager.get().playSE(Sound.ID.DDG_SE_SYS02); switch (item.behavior.item_favor.category) { case Item.CATEGORY.CANDY: { // ?꾩씠??李쎌뿉 ?꾩씠肄??쒖떆. this.item_slot.candy.favor = item.behavior.item_favor.clone(); ItemWindow.get().setItem(Item.SLOT_TYPE.CANDY, 0, this.item_slot.candy.favor); // ?룹쓽 ?쇱젙?쒓컙 ?뚯썙?? this.startShotBoost(); } break; case Item.CATEGORY.SODA_ICE: case Item.CATEGORY.ETC: { // 鍮??щ’???꾩씠???ㅼ젙. int slot_index = this.item_slot.getEmptyMiscSlot(); if (slot_index >= 0) { this.item_slot.miscs[slot_index].item_id = query.target; this.item_slot.miscs[slot_index].favor = item.behavior.item_favor.clone(); // ?꾩씠??李쎌뿉 ?꾩씠肄??쒖떆. ItemWindow.get().setItem(Item.SLOT_TYPE.MISC, slot_index, this.item_slot.miscs[slot_index].favor); } } break; case Item.CATEGORY.FOOD: { // 泥대젰 ?뚮났. if (GameRoot.get().isNowCakeBiking()) { this.control.vital.healFullInternal(); } else { this.control.vital.healFull(); // ?덉씤蹂댁슦 移쇰윭 ?④낵. this.skin_color_control.startHealing(); } // 泥대젰 ?뚮났???뚮┝. CharacterRoot.get().NotifyHitPoint(this.getAcountID(), this.control.vital.getHitPoint()); // ?꾩씠???먭린瑜??뚮┝. this.control.cmdItemDrop(query.target); // 耳?댄겕瑜?癒뱀? ??耳?댄겕 臾댄븳?쒓났??. this.cake_count++; } break; // 諛??댁뇿. case Item.CATEGORY.KEY: { PartyControl.get().getLocalPlayer().control.consumeKey(item); Item.KEY_COLOR key_color = Item.Key.getColorFromInstanceName(item.name); // ?꾩씠??李쎌뿉 ?꾩씠肄??쒖떆. if (key_color != Item.KEY_COLOR.NONE) { ItemWindow.get().setItem(Item.SLOT_TYPE.KEY, (int)key_color, item.behavior.item_favor); } } break; // ?뚮줈???대룞 臾??댁뇿. case Item.CATEGORY.FLOOR_KEY: { MapCreator.getInstance().UnlockBossDoor(); // ?꾩씠??李쎌뿉 ?꾩씠肄??쒖떆. ItemWindow.get().setItem(Item.SLOT_TYPE.FLOOR_KEY, 0, item.behavior.item_favor); } break; case Item.CATEGORY.WEAPON: { // ??蹂寃????諛쒖뭏 / ?좎옄 ??깂). SHOT_TYPE shot_type = Item.Weapon.getShotType(item.name); if (shot_type != SHOT_TYPE.NONE) { this.changeBulletShooter(shot_type); } } break; } item.vanish(); } while(false); query.set_expired(true); }