public override void execute() { this.door = null; // 파워업 타이머 // (캔디를 획득했을 때). if (this.shot_boost_timer > 0.0f) { this.shot_boost_timer -= Time.deltaTime; if (this.shot_boost_timer <= 0.0f) { // 타임아웃으로 효과 끝남. this.shot_boost_timer = 0.0f; ItemWindow.get().clearItem(Item.SLOT_TYPE.CANDY, 0); this.item_slot.candy.initialize(); } } this.melee_attack.execute(); if (this.ice_timer >= 0.0f) { this.ice_timer -= Time.deltaTime; } this.executeJinJin(); this.skin_color_control.execute(); this.execute_queries(); }
// 醫낅즺 泥댄겕. 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); }
public override void initializeMap(GameRoot game_root) { MapCreator map_creator = MapCreator.get(); PartyControl party_control = PartyControl.get(); map_creator.setRoomNum(1, 1); // Floor 루트 생성. map_creator.floor_root_go = new GameObject("Floor"); // 무기 선택 플로어에서는 방의 블록을 3 x 4로 변경. map_creator.setRoomGridNum(3, 4); // 방 만들기. RoomController room = map_creator.createRoomFloor(new Map.RoomIndex(0, 0)); // 더미 방 만들기. RoomController vacancy = map_creator.createVacancy(new Map.RoomIndex(0, -1)); // 방 구분 벽 만들기. map_creator.createRoomWall(); // 외벽 만들기. GameObject outer_walls = map_creator.createOuterWalls(); // 플로어 이동 도어를 하나만 만든다. map_creator.createFloorDoor(new Map.RoomIndex(0, 0), new Map.BlockIndex(1, 3), Map.EWSN.NORTH); // ---------------------------------------------------------------- // Renderer[] renderers = outer_walls.GetComponentsInChildren <Renderer>(); foreach (var render in renderers) { render.material.shader = this.map_shader; } // renderers = vacancy.GetComponentsInChildren <Renderer>(); foreach (var render in renderers) { render.material.shader = this.map_shader; } renderers = room.GetComponentsInChildren <Renderer>(); foreach (var render in renderers) { render.material.shader = this.map_shader; } // ---------------------------------------------------------------- // // 무 아저씨. chrController kabusan = CharacterRoot.get().createNPC("NPC_Kabu_San"); kabusan.cmdSetPositionAnon(chrBehaviorKabu.getStayPosition()); kabusan.cmdSetDirectionAnon(chrBehaviorKabu.getStayDirection()); // ---------------------------------------------------------------- // // 로컬 플레이어. party_control.createLocalPlayer(GlobalParam.getInstance().global_account_id); chrBehaviorLocal player = PartyControl.get().getLocalPlayer(); player.control.cmdSetPositionAnon(new Vector3(0.0f, 0.0f, -9.0f)); player.changeBulletShooter(SHOT_TYPE.EMPTY); // ---------------------------------------------------------------- // // 아이템 생성. this.generateItems(game_root); party_control.setCurrentRoom(room); ItemWindow.get().setActive(false); }
// 매 프레임 호출. 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; } // ---------------------------------------------------------------- // }
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() { base.execute(); this.resolve_collision(); this.update_item_queries(); // ---------------------------------------------------------------- // // ?ㅼ쓬 ?곹깭濡??꾪솚?좎? 泥댄겕?쒕떎. switch (this.step.do_transition()) { // ?됱긽 ?? case STEP.MOVE: { if (this.control.vital.getHitPoint() <= 0.0f) { this.step.set_next(STEP.BATAN_Q); } } break; // 洹쇱젒 怨듦꺽. case STEP.MELEE_ATTACK: { if (!this.melee_attack.isAttacking()) { this.step.set_next(STEP.MOVE); } } break; // ?꾩씠???ъ슜. case STEP.USE_ITEM: { if (this.step_use_item.transition_check()) { this.ice_timer = ICE_DIGEST_TIME; } } break; // ?誘몄?瑜?諛쏆븘 ?좊씪媛??以? case STEP.BLOW_OUT: { // ?쇱젙 嫄곕━瑜??섏븘媛嫄곕굹 ??꾩븘?껋쑝濡?醫낅즺. float distance = MathUtility.calcDistanceXZ(this.control.getPosition(), this.step_blow_out.center); if (distance >= this.step_blow_out.radius || this.step.get_time() > BLOW_OUT_TIME) { this.control.cmdSetAcceptDamage(true); this.step.set_next(STEP.MOVE); } } break; // 泥대젰0. case STEP.BATAN_Q: { if (this.control.getMotion() == "") { this.control.cmdSetMotion("m007_out_lp", 1); this.step.set_next_delay(STEP.WAIT_RESTART, 1.0f); } } break; } // ---------------------------------------------------------------- // // ?곹깭 ?꾪솚 ??珥덇린?? while (this.step.get_next() != STEP.NONE) { switch (this.step.do_initialize()) { // ?됱긽 ?? case STEP.MOVE: { this.GetComponent <Rigidbody>().WakeUp(); this.move_target = this.transform.position; this.heading_target = this.transform.TransformPoint(Vector3.forward); } break; // 洹쇱젒 怨듦꺽. case STEP.MELEE_ATTACK: { this.melee_attack.setTarget(this.melee_target); this.melee_attack.attack(true); this.melee_target = null; } break; // ?꾩씠???ъ슜. case STEP.USE_ITEM: { int slot_index = this.step_use_item.slot_index; if (this.ice_timer > 0.0f) { // ?꾩씠?ㅻ? 吏㏃? 媛꾧꺽?쇰줈 ?곗냽 ?ъ슜???? // 癒몃━媛 吏?덉??덊빐???뚮났?섏? ?딅뒗?? // ?꾩씠?쒖쓣 ??젣?쒕떎. ItemWindow.get().clearItem(Item.SLOT_TYPE.MISC, slot_index); this.item_slot.miscs[slot_index].initialize(); this.startJinJin(); this.step.set_next(STEP.MOVE); SoundManager.getInstance().playSE(Sound.ID.DDG_SE_SYS06); } else { this.item_slot.miscs[slot_index].is_using = true; this.control.cmdSetAcceptDamage(false); this.step_use_item.initialize(); } } break; // ?誘몄?瑜?諛쏆븘 ?좊씪媛??以? case STEP.BLOW_OUT: { this.GetComponent <Rigidbody>().Sleep(); this.control.cmdSetAcceptDamage(false); } break; // 泥대젰 0 case STEP.BATAN_Q: { this.GetComponent <Rigidbody>().Sleep(); this.control.cmdSetAcceptDamage(false); this.control.cmdSetMotion("m006_out", 1); } break; // 由ъ뒪????湲? case STEP.WAIT_RESTART: { this.step_batan_q.tears_effect.destroy(); } break; // ?몃? ?쒖뼱. case STEP.OUTER_CONTROL: { this.GetComponent <Rigidbody>().Sleep(); } break; } } // ---------------------------------------------------------------- // // 媛??곹깭?먯꽌???ㅽ뻾 泥섎━. // 洹쇱젒 怨듦꺽. // ?쇰떒 false濡??대몢怨??대룞 ?낅젰???덉쓣 ?뚮쭔. // true濡??쒕떎. this.melee_attack.setHasInput(false); GameInput gi = GameInput.getInstance(); switch (this.step.do_execution(Time.deltaTime)) { // ?됱긽 ?? case STEP.MOVE: { this.exec_step_move(); // ?룔깾?껁깉. if (this.is_shot_enable) { this.bullet_shooter.execute(gi.shot.current); if (gi.shot.current) { CharacterRoot.get().SendAttackData(PartyControl.get().getLocalPlayer().getAcountID(), 0); } } // 泥대젰 ?뚮났 吏곹썑(?덉씤蹂댁슦而щ윭 以???臾댁쟻. if (this.skin_color_control.isNowHealing()) { this.control.cmdSetAcceptDamage(false); } else { this.control.cmdSetAcceptDamage(true); } } break; // ?꾩씠???ъ슜. case STEP.USE_ITEM: { this.step_use_item.execute(); } break; // ?誘몄?瑜?諛쏆븘 ?좊씪媛??以? case STEP.BLOW_OUT: { this.exec_step_blow_out(); } break; // 泥대젰0. case STEP.BATAN_Q: { if (this.step.is_acrossing_time(4.0f)) { this.step_batan_q.tears_effect = EffectRoot.get().createTearsEffect(this.control.getPosition()); this.step_batan_q.tears_effect.setParent(this.gameObject); this.step_batan_q.tears_effect.setLocalPosition(Vector3.up); } } break; } // ---------------------------------------------------------------- // if (gi.serif_text.trigger_on) { this.control.cmdQueryTalk(gi.serif_text.text, true); } // ---------------------------------------------------------------- // // 10 ?꾨젅?꾩뿉 ??踰?醫뚰몴瑜??ㅽ듃?뚰겕??蹂대궦?? { do { if (this.step.get_current() == STEP.OUTER_CONTROL) { break; } m_send_count = (m_send_count + 1) % SplineData.SEND_INTERVAL; if (m_send_count != 0 && m_culling.Count < PLOT_NUM) { break; } // ?듭떊??醫뚰몴 ?≪떊. Vector3 target = this.control.getPosition(); CharacterCoord coord = new CharacterCoord(target.x, target.z); Vector3 diff = m_prev - target; if (diff.sqrMagnitude > 0.0001f) { m_culling.Add(coord); AccountData account_data = AccountManager.get().getAccountData(GlobalParam.getInstance().global_account_id); CharacterRoot.get().SendCharacterCoord(account_data.avator_id, m_plotIndex, m_culling); ++m_plotIndex; if (m_culling.Count >= PLOT_NUM) { m_culling.RemoveAt(0); } m_prev = target; } } while(false); } }
void Update() { bool is_on_invalid_area = false; // ---------------------------------------------------------------- // // 마우스 좌표(GUI와의 판정용). // Vector2 mouse_position_gui = new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y); // 디버그 창이 클릭됐을 때. // (이동하지 않게). // if (dbwin.root().isOcuppyRect(mouse_position_gui)) { is_on_invalid_area = true; } Vector3 mouse_position = Input.mousePosition; // 화면의 좌우와 아래로 삐져나왔을 때의 대책. mouse_position.x = Mathf.Clamp(mouse_position.x, 0.0f, Screen.width); mouse_position.y = Mathf.Clamp(mouse_position.y, 0.0f, Screen.height); Ray ray = Camera.main.ScreenPointToRay(mouse_position); // ---------------------------------------------------------------- // this.pointing.trigger_on = Input.GetMouseButtonDown(0); this.pointing.current = Input.GetMouseButton(0); this.pointing.trigger_off = Input.GetMouseButtonUp(0); this.shot.trigger_on = Input.GetMouseButtonDown(1); this.shot.current = Input.GetMouseButton(1); // ---------------------------------------------------------------- // do { if (!this.pointing.current) { break; } if (this.pointing.trigger_on) { // 텍스트 입력 영역이 클릭됐을 때. // (이동하지 않게). if (this.text_field_pos.Contains(mouse_position_gui)) { this.pointing.pointee = POINTEE.NONE; break; } if (ItemWindow.get().isPositionInWindow(mouse_position_gui)) { ItemWindow.get().clickWindow(mouse_position_gui); this.pointing.pointee = POINTEE.NONE; break; } // 디버그 창이 클릭됐을 때. // (이동하지 않게). if (is_on_invalid_area) { this.pointing.pointee = POINTEE.NONE; break; } } // 마우스 커서 위치에 있는 Terrain 좌표를 구한다. // 레이어 마스크. int layer_mask = 0; layer_mask += 1 << LayerMask.NameToLayer("Terrain"); layer_mask += 1 << LayerMask.NameToLayer("Default"); layer_mask += 1 << LayerMask.NameToLayer("Player"); RaycastHit hit; if (!Physics.Raycast(ray, out hit, float.PositiveInfinity, layer_mask)) { break; } this.pointing.position_3d = hit.point; string layer_name = LayerMask.LayerToName(hit.transform.gameObject.layer).ToString(); // 포인팅 된 것은 클릭한 순간만 갱신. // 드래그로 아이템을 주울 수 없게. if (this.pointing.trigger_on) { switch (layer_name) { case "Terrain": { this.pointing.pointee = POINTEE.TERRAIN; } break; case "Default": case "Player": { switch (hit.transform.gameObject.tag) { case "Item": { this.pointing.pointee = POINTEE.ITEM; this.pointing.pointee_name = hit.transform.gameObject.name; } break; case "Player": case "Chatactor": { this.pointing.pointee = POINTEE.CHARACTOR; this.pointing.pointee_name = hit.transform.gameObject.name; } break; } } break; default: { this.pointing.pointee = POINTEE.NONE; } break; } } } while(false); // ---------------------------------------------------------------- // // 쏘기 - 우클릭 . do { if (!this.shot.current) { break; } if (this.shot.trigger_on) { // 디버그 창이 클릭됐을 때. // (이동하지 않게). if (is_on_invalid_area) { this.shot.pointee = POINTEE.NONE; break; } } // chrController player = CharacterRoot.getInstance().getPlayer(); Plane plane = new Plane(Vector3.up, player.transform.position); float depth; if (plane.Raycast(ray, out depth)) { Vector3 xp = ray.origin + ray.direction * depth; if (this.shot.trigger_on) { this.shot.pointee = POINTEE.TERRAIN; } this.shot.position_3d = xp; } } while(false); }
public override void execute() { CameraModule camera_module = CameraControl.get().getModule(); float ougi_pos_y0 = -3.2f; float ougi_pos_y1 = 0.0f; // ---------------------------------------------------------------- // // 다음 상태로 이동할지 체크. switch (this.step.do_transition()) { case STEP.START: { } break; // "!" 말풍선. case STEP.BIKKURI: { if (this.step.get_time() > 1.0f) { this.sprite_bikkuri.setVisible(false); this.step.set_next(STEP.TURN_AND_RISE); } } break; // 빙글 돌아 모션 재생. case STEP.TURN_AND_RISE: { if (this.step.get_time() > 2.0f) { this.step.set_next(STEP.STICK_THROW); } } break; // 아이스 스틱을 던진다. case STEP.STICK_THROW: { if (this.player.control.getMotionCurrentTime() > 0.3f) { this.step.set_next(STEP.STICK_FLYING); } } break; // 아이스 스틱이 날라온다. case STEP.STICK_FLYING: { if (!this.ice_fcurve.isMoving()) { ItemWindow.get().setItem(Item.SLOT_TYPE.MISC, this.slot_index, this.item_favor); this.player.item_slot.miscs[this.slot_index].is_using = false; this.step.set_next(STEP.END); } } break; case STEP.END: { this.step.set_next(STEP.IDLE); } break; } // ---------------------------------------------------------------- // // 상태 전환 시 초기화. while (this.step.get_next() != STEP.NONE) { switch (this.step.do_initialize()) { case STEP.START: { Vector3 player_position = this.player.control.getPosition(); // -------------------------------------------------------- // // 카메라. CameraControl.get().beginOuterControll(); camera_module.pushPosture(); this.cam_posture0 = camera_module.getPosture(); this.cam_posture1.position = player_position + new Vector3(0.0f, 5.3f, -3.5f); this.cam_posture1.intererst = player_position + Vector3.forward * 2.0f; this.cam_posture1.up = Vector3.up; this.camera_fcurve.setSlopeAngle(70.0f, 5.0f); this.camera_fcurve.setDuration(0.5f); this.camera_fcurve.start(); // 플레이어. this.player.beginOuterControll(); this.player.GetComponent <Rigidbody>().Sleep(); // 피라미 적 캐릭터의 움직임을 멈춘다. LevelControl.get().beginStillEnemies(); // this.step.set_next_delay(STEP.BIKKURI, 1.0f); } break; // "!" 말풍선. case STEP.BIKKURI: { this.bikkuri_spring.k = 750.0f; this.bikkuri_spring.reduce = 0.77f; this.bikkuri_spring.start(-2.75f); this.sprite_bikkuri.setVisible(true); } break; // 빙글 돌아 모션 재생. case STEP.TURN_AND_RISE: { // 뒤의 부채. this.ougi_position = this.player.control.getPosition() + Vector3.forward * 1.0f; this.ougi_position.y = ougi_pos_y0; this.ougi = EffectRoot.get().createAtariOugi(this.ougi_position); this.ougi_fcurve.setSlopeAngle(70.0f, 5.0f); this.ougi_fcurve.setDuration(0.5f); this.ougi_fcurve.start(); // 플레이어. if (this.player_weapon != null) { this.player_weapon.SetActive(false); } this.player.control.cmdSetMotion("m004_use", 1); // 아이스바 모델. this.ice_bar.SetActive(true); // 종을 울림. SoundManager.getInstance().playSE(Sound.ID.DDG_JINGLE04); // 플레이어 가까이 있는 적을 지운다. this.hide_enemies = LevelControl.get().getRoomEnemiesInRange(null, this.player.getPosition(), 2.0f); foreach (var enemy in this.hide_enemies) { enemy.damage_effect.startFadeOut(0.1f); } } break; // 아이스 스틱을 던진다. case STEP.STICK_THROW: { // 플레이어. this.player.control.cmdSetMotion("m003_attack", 1); } break; // 아이스 스틱이 날라온다. case STEP.STICK_FLYING: { this.cam_posture1 = camera_module.getPosture(); this.camera_fcurve.setSlopeAngle(10.0f, 5.0f); this.camera_fcurve.setDuration(1.0f); this.camera_fcurve.start(); // 당첨 말풍선. this.atari_fcurve.setSlopeAngle(50.0f, 30.0f); this.atari_fcurve.setDuration(0.5f); this.atari_fcurve.start(); // 뒤 부채. this.ougi_fcurve.setSlopeAngle(70.0f, 5.0f); this.ougi_fcurve.setDuration(1.0f); this.ougi_fcurve.start(); // 아이스. this.ice_fcurve.setSlopeAngle(60.0f, 20.0f); this.ice_fcurve.setDuration(1.0f); this.ice_fcurve.start(); this.sprite_ice_bar.setVisible(true); // 플레이어가 가진 아이스바(당첨). this.ice_bar.gameObject.destroy(); } break; case STEP.END: { GameObject.Destroy(this.ice_bar); if (this.player_weapon != null) { this.player_weapon.SetActive(true); } this.player.GetComponent <Rigidbody>().WakeUp(); this.player.endOuterControll(); this.sprite_bikkuri.destroy(); this.sprite_atari.destroy(); this.sprite_ice_bar.destroy(); this.ougi.destroy(); camera_module.popPosture(); CameraControl.get().endOuterControll(); // 피래미 적 캐릭터의 움직임을 재개한다. LevelControl.get().endStillEnemies(null, 2.0f); foreach (var enemy in this.hide_enemies) { enemy.damage_effect.startFadeIn(0.5f); } } break; } } // ---------------------------------------------------------------- // // 각 상태에서의 실행 처리. switch (this.step.do_execution(Time.deltaTime)) { // "!" 말풍선. case STEP.BIKKURI: { this.bikkuri_spring.execute(Time.deltaTime); Vector2 position = new Vector2(0.0f, 80.0f); position += Vector2.up * 8.0f * this.bikkuri_spring.position; this.sprite_bikkuri.setPosition(position); } break; // 빙글 돌아 모션 재생. case STEP.TURN_AND_RISE: { // -------------------------------------------------------- // // 카메라. this.camera_fcurve.execute(Time.deltaTime); if (this.camera_fcurve.isMoving()) { CameraModule.Posture posture = CameraModule.lerp(this.cam_posture0, this.cam_posture1, this.camera_fcurve.getValue()); camera_module.setPosture(posture); } else { float dolly = camera_module.getDistance(); camera_module.dolly(dolly * (1.0f - 0.05f * Time.deltaTime)); } // -------------------------------------------------------- // // 플레이어. this.player.control.cmdSmoothHeadingTo(CameraControl.get().transform.position); if (this.player.control.getMotionCurrentTime() > 0.5f) { this.player.control.getAnimationPlayer().Stop(); } // -------------------------------------------------------- // // 뒤의 부채. this.ougi_fcurve.execute(Time.deltaTime); this.ougi_position.y = Mathf.Lerp(ougi_pos_y0, ougi_pos_y1, this.ougi_fcurve.getValue()); this.ougi.transform.position = this.ougi_position; // -------------------------------------------------------- // // 플레이어가 가지고 있는 아이스바(당첨). // 카메라 방향으로 향한다. Vector3 dir = CameraControl.get().gameObject.getPosition() - this.ice_bar.getPosition(); this.ice_bar.setRotation(Quaternion.LookRotation(-dir.Y(0.0f), Quaternion.AngleAxis(20.0f, Vector3.forward) * Vector3.up)); // 줌 if (this.step.is_acrossing_time(0.3f)) { this.ice_zoom_fcurve.setSlopeAngle(70.0f, 5.0f); this.ice_zoom_fcurve.setDuration(0.3f); this.ice_zoom_fcurve.start(); } this.ice_zoom_fcurve.execute(Time.deltaTime); this.ice_bar.setLocalScale(Vector3.one * Mathf.Lerp(0.2f, 0.8f, this.ice_zoom_fcurve.getValue())); // -------------------------------------------------------- // // 당첨 말풍선. if (this.step.is_acrossing_time(0.3f)) { this.spring.k = 750.0f; this.spring.reduce = 0.87f; this.spring.start(-0.75f); this.sprite_atari.setVisible(true); } this.spring.execute(Time.deltaTime); float scale = this.spring.position + 1.0f; this.sprite_atari.setScale(new Vector2(scale, scale)); } break; // 아이스 스틱을 던진다. case STEP.STICK_THROW: { // -------------------------------------------------------- // // カメラ. float dolly = camera_module.getDistance(); camera_module.dolly(dolly * (1.0f - 0.05f * Time.deltaTime)); // -------------------------------------------------------- // // Vector3 dir = CameraControl.get().gameObject.getPosition() - this.player.gameObject.getPosition(); dir = Quaternion.AngleAxis(-90.0f, Vector3.up) * dir.Y(0.0f); this.player.control.cmdSmoothHeadingTo(this.player.gameObject.getPosition() + dir); } break; // 아이스 스틱이 날아온다. case STEP.STICK_FLYING: { // -------------------------------------------------------- // // 카메라. this.camera_fcurve.execute(Time.deltaTime); CameraModule.Posture posture = CameraModule.lerp(this.cam_posture1, this.cam_posture0, this.camera_fcurve.getValue()); camera_module.setPosture(posture); // -------------------------------------------------------- // // 당첨 말풍선. this.atari_fcurve.execute(Time.deltaTime); this.sprite_atari.setScale(Vector2.one * Mathf.Lerp(1.0f, 0.0f, this.atari_fcurve.getValue())); // -------------------------------------------------------- // // 뒤 풍선. this.ougi_fcurve.execute(Time.deltaTime); this.ougi_position.y = Mathf.Lerp(ougi_pos_y1, ougi_pos_y0, this.ougi_fcurve.getValue()); this.ougi.transform.position = this.ougi_position; // -------------------------------------------------------- // // 이쪽으로 날아오는 아이스 스틱. this.ice_fcurve.execute(Time.deltaTime); this.tracer.proceedToDistance(this.ice_fcurve.getValue() * this.tracer.curve.calcTotalDistance()); Vector2 on_curve_position = this.tracer.cv.position.xz() * 480.0f / 2.0f; // 커브의 종단점이 아이템 윈도의 아이콘 위치가 되도록 보정한다. do { if (this.slot_index < 0) { break; } if (this.ice_fcurve.getValue() <= 0.5f) { break; } float blend_rate = Mathf.InverseLerp(0.5f, 1.0f, this.ice_fcurve.getValue()); Vector2 icon_position = ItemWindow.get().getIconPosition(Item.SLOT_TYPE.MISC, this.slot_index); Vector2 curve_end = this.tracer.curve.cvs.back().position.xz() * 480.0f / 2.0f; on_curve_position += (icon_position - curve_end) * blend_rate; } while(false); this.sprite_ice_bar.setPosition(on_curve_position); this.sprite_ice_bar.setAngle(this.step.get_time() * 360.0f * 5.0f); this.sprite_ice_bar.getMaterial().SetFloat("_BlendRate", this.ice_fcurve.getValue()); } break; } }
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() { base.execute(); this.resolve_collision(); this.update_item_queries(); // ---------------------------------------------------------------- // // 다음 상태로 전환할지 체크한다. switch (this.step.do_transition()) { // 평상 시. case STEP.MOVE: { if (this.control.vital.getHitPoint() <= 0.0f) { this.step.set_next(STEP.BATAN_Q); } } break; // 근접 공격. case STEP.MELEE_ATTACK: { if (!this.melee_attack.isAttacking()) { this.step.set_next(STEP.MOVE); } } break; // 아이템 사용. case STEP.USE_ITEM: { if (this.step_use_item.transition_check()) { this.ice_timer = ICE_DIGEST_TIME; } } break; // 대미지를 받아 날라가는 중. case STEP.BLOW_OUT: { // 일정 거리를 나아가거나 타임아웃으로 종료. float distance = MathUtility.calcDistanceXZ(this.control.getPosition(), this.step_blow_out.center); if (distance >= this.step_blow_out.radius || this.step.get_time() > BLOW_OUT_TIME) { this.control.cmdSetAcceptDamage(true); this.step.set_next(STEP.MOVE); } } break; // 체력0. case STEP.BATAN_Q: { if (this.control.getMotion() == "") { this.control.cmdSetMotion("m007_out_lp", 1); this.step.set_next_delay(STEP.WAIT_RESTART, 1.0f); } } break; } // ---------------------------------------------------------------- // // 상태 전환 시 초기화. while (this.step.get_next() != STEP.NONE) { switch (this.step.do_initialize()) { // 평상 시. case STEP.MOVE: { this.rigidbody.WakeUp(); this.move_target = this.transform.position; this.heading_target = this.transform.TransformPoint(Vector3.forward); } break; // 근접 공격. case STEP.MELEE_ATTACK: { this.melee_attack.setTarget(this.melee_target); this.melee_attack.attack(true); this.melee_target = null; } break; // 아이템 사용. case STEP.USE_ITEM: { int slot_index = this.step_use_item.slot_index; if (this.ice_timer > 0.0f) { // 아이스를 짧은 간격으로 연속 사용할 때 // 머리가 지끈지끈해서 회복되지 않는다. // 아이템을 삭제한다. ItemWindow.get().clearItem(Item.SLOT_TYPE.MISC, slot_index); this.item_slot.miscs[slot_index].initialize(); this.startJinJin(); this.step.set_next(STEP.MOVE); SoundManager.getInstance().playSE(Sound.ID.DDG_SE_SYS06); } else { this.item_slot.miscs[slot_index].is_using = true; this.control.cmdSetAcceptDamage(false); this.step_use_item.initialize(); } } break; // 대미지를 받아 날라가는 중. case STEP.BLOW_OUT: { this.rigidbody.Sleep(); this.control.cmdSetAcceptDamage(false); } break; // 체력 0 case STEP.BATAN_Q: { this.rigidbody.Sleep(); this.control.cmdSetAcceptDamage(false); this.control.cmdSetMotion("m006_out", 1); } break; // 리스타트 대기. case STEP.WAIT_RESTART: { this.step_batan_q.tears_effect.destroy(); } break; // 외부 제어. case STEP.OUTER_CONTROL: { this.rigidbody.Sleep(); } break; } } // ---------------------------------------------------------------- // // 각 상태에서의 실행 처리. // 근접 공격. // 일단 false로 해두고 이동 입력이 있을 때만. // true로 한다. this.melee_attack.setHasInput(false); GameInput gi = GameInput.getInstance(); switch (this.step.do_execution(Time.deltaTime)) { // 평상 시. case STEP.MOVE: { this.exec_step_move(); // ショット. if (this.is_shot_enable) { this.bullet_shooter.execute(gi.shot.current); if (gi.shot.current) { CharacterRoot.get().SendAttackData(PartyControl.get().getLocalPlayer().getAcountID(), 0); } } // 체력 회복 직후(레인보우컬러 중)는 무적. if (this.skin_color_control.isNowHealing()) { this.control.cmdSetAcceptDamage(false); } else { this.control.cmdSetAcceptDamage(true); } } break; // 아이템 사용. case STEP.USE_ITEM: { this.step_use_item.execute(); } break; // 대미지를 받아 날라가는 중. case STEP.BLOW_OUT: { this.exec_step_blow_out(); } break; // 체력0. case STEP.BATAN_Q: { if (this.step.is_acrossing_time(4.0f)) { this.step_batan_q.tears_effect = EffectRoot.get().createTearsEffect(this.control.getPosition()); this.step_batan_q.tears_effect.setParent(this.gameObject); this.step_batan_q.tears_effect.setLocalPosition(Vector3.up); } } break; } // ---------------------------------------------------------------- // if (gi.serif_text.trigger_on) { this.control.cmdQueryTalk(gi.serif_text.text, true); } // ---------------------------------------------------------------- // // 10 프레임에 한 번 좌표를 네트워크에 보낸다. { do { if (this.step.get_current() == STEP.OUTER_CONTROL) { break; } m_send_count = (m_send_count + 1) % SplineData.SEND_INTERVAL; if (m_send_count != 0 && m_culling.Count < PLOT_NUM) { break; } // 통신용 좌표 송신. Vector3 target = this.control.getPosition(); CharacterCoord coord = new CharacterCoord(target.x, target.z); Vector3 diff = m_prev - target; if (diff.sqrMagnitude > 0.0001f) { m_culling.Add(coord); AccountData account_data = AccountManager.get().getAccountData(GlobalParam.getInstance().global_account_id); CharacterRoot.get().SendCharacterCoord(account_data.avator_id, m_plotIndex, m_culling); ++m_plotIndex; if (m_culling.Count >= PLOT_NUM) { m_culling.RemoveAt(0); } m_prev = target; } } while(false); } }