Esempio n. 1
0
    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();
    }
Esempio n. 2
0
    public void             attack(bool is_local)
    {
        this.is_trigger_attack = true;

        if (is_local)
        {
            CharacterRoot.get().SendAttackData(PartyControl.get().getLocalPlayer().getAcountID(), 1);
        }
    }
    // 레벨 시작 시에 호출.
    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);
    }
Esempio n. 4
0
    // 진행 방향으로 돌아 EnemyBullet을 발사한다.
    public void     shootBullet()
    {
        GameObject go = GameObject.Instantiate(CharacterRoot.get().enemy_bullet_prefab) as GameObject;

        go.transform.position = this.transform.TransformPoint(new Vector3(0.0f, 0.25f, 1.0f));
        go.transform.rotation = Quaternion.AngleAxis(this.control.getDirection(), Vector3.up);

        EnemyBulletControl bullet = go.GetComponent <EnemyBulletControl>();

        bullet.owner = this.control;
    }
Esempio n. 5
0
    // 게임 시작 시에 한 번만 호출됩니다.
    public override void    start()
    {
        this.chr_dog = CharacterRoot.get().findCharacter <chrBehaviorNPC_Dog>("Dog");

        this.chr_dog.setItemWan(this);

        this.controll.setBillboard(true);
        this.controll.cmdSetVisible(false);

        this.step.set_next(STEP.READY);
    }
Esempio n. 6
0
    // 이벤트 시작.
    public override void            start()
    {
        this.player = PartyControl.get().getLocalPlayer();
        this.player.beginOuterControll();

        this.kabu_san = CharacterRoot.get().findCharacter <chrBehaviorKabu>("NPC_Kabu_San");

        CameraControl.get().beginOuterControll();

        this.step.set_next(STEP.START);
    }
Esempio n. 7
0
    void    Update()
    {
        // ---------------------------------------------------------------- //
        // 다음 상태로 이행할지 체크합니다.

        switch (this.step.do_transition())
        {
        case STEP.DISPATCH:
        {
            if (this.selection != SELECTION.NONE)
            {
                this.step.set_next(STEP.SELECTED);
            }
        }
        break;
        }

        // ---------------------------------------------------------------- //
        // 상태가 전환했을 때의 초기화.

        while (this.step.get_next() != STEP.NONE)
        {
            switch (this.step.do_initialize())
            {
            case STEP.DISPATCH:
            {
                this.selection = SELECTION.NONE;

                CharacterRoot.get().getGameInput().appendForbiddenArea(this.input_forbidden_area);
            }
            break;

            case STEP.CLOSE:
            {
                CharacterRoot.get().getGameInput().removeForbiddenArea(this.input_forbidden_area);
                this.step.set_next(STEP.IDLE);
            }
            break;
            }
        }

        // ---------------------------------------------------------------- //
        // 각 상태에서의 실행 처리.

        switch (this.step.do_execution(Time.deltaTime))
        {
        case STEP.IDLE:
        {
        }
        break;
        }
    }
Esempio n. 8
0
    // 보스 사망 정보 수신 함수.
    public void OnReceiveBossDeadPacket(int node, PacketId id, byte[] data)
    {
        BossDeadPacket packet = new BossDeadPacket(data);
        BossDead       dead   = packet.GetPacket();

        chrBehaviorEnemyBoss behavior = CharacterRoot.get().findCharacter <chrBehaviorEnemyBoss>(dead.bossId);

        if (behavior == null)
        {
            return;
        }

        behavior.dead();

        Debug.Log("Receive boss dead packet");
    }
Esempio n. 9
0
    protected void          create_debug_window()
    {
        var window = dbwin.root().createWindow("query");

        window.createButton("줍는다")
        .setOnPress(() =>
        {
            chrBehaviorLocal player = CharacterRoot.get().findCharacter <chrBehaviorLocal>(GameRoot.getInstance().account_name_local);

            player.controll.cmdItemQueryPick("Tarai");
        });

        window.createButton("버린다")
        .setOnPress(() =>
        {
            chrBehaviorLocal player = CharacterRoot.get().findCharacter <chrBehaviorLocal>(GameRoot.getInstance().account_name_local);

            player.controll.cmdItemQueryDrop();
        });

        window.createButton("말풍선")
        .setOnPress(() =>
        {
            //chrBehaviorLocal	player = CharacterRoot.get().findCharacter<chrBehaviorLocal>(GameRoot.getInstance().account_name_local);
            chrBehaviorNet player = CharacterRoot.get().findCharacter <chrBehaviorNet>("Daizuya");

            player.controll.cmdQueryTalk("멀리 있는 사람과 Talk한다", true);
        });

        window.createButton("이사 시작")
        .setOnPress(() =>
        {
            chrBehaviorLocal player = CharacterRoot.get().findCharacter <chrBehaviorLocal>(GameRoot.getInstance().account_name_local);
            //chrBehaviorNet		player = CharacterRoot.get().findCharacter<chrBehaviorNet>(GameRoot.getInstance().account_name_net);

            player.controll.cmdQueryHouseMoveStart("House1");
        });

        window.createButton("이사 끝")
        .setOnPress(() =>
        {
            chrBehaviorLocal player = CharacterRoot.get().findCharacter <chrBehaviorLocal>(GameRoot.getInstance().account_name_local);
            //chrBehaviorNet		player = CharacterRoot.get().findCharacter<chrBehaviorNet>(GameRoot.getInstance().account_name_net);

            player.controll.cmdQueryHouseMoveEnd();
        });
    }
Esempio n. 10
0
    public void     OnReceiveCharacterPacket(PacketId id, byte[] data)
    {
        CharacterDataPacket packet   = new CharacterDataPacket(data);
        CharacterData       charData = packet.GetPacket();

        if (GlobalParam.get().is_in_my_home != GlobalParam.get().is_remote_in_my_home)
        {
            return;
        }

        chrBehaviorNet remote = CharacterRoot.get().findCharacter <chrBehaviorNet>(charData.characterId);

        if (remote != null)
        {
            remote.CalcCoordinates(charData.index, charData.coordinates);
        }
    }
Esempio n. 11
0
    // 쿼리 이사를 마쳐도 되는가?.
    public QueryHouseMoveEnd        cmdQueryHouseMoveEnd(bool local = true)
    {
        QueryHouseMoveEnd query = null;

        do
        {
            query = CharacterRoot.get().queryHouseMoveEnd(local);

            if (query == null)
            {
                break;
            }

            this.queries.Add(query);
        } while(false);

        return(query);
    }
Esempio n. 12
0
    // 쿼리 이사를 시작해도 되는가?.
    public QueryHouseMoveStart      cmdQueryHouseMoveStart(string house_name, bool local = true)
    {
        QueryHouseMoveStart query = null;

        do
        {
            query = CharacterRoot.get().queryHouseMoveStart(house_name, local);

            if (query == null)
            {
                break;
            }

            this.queries.Add(query);
        } while(false);

        return(query);
    }
Esempio n. 13
0
    // 쿼리 대화(말풍선).
    public QueryTalk        cmdQueryTalk(string words, bool local = false)
    {
        QueryTalk query = null;

        do
        {
            query = CharacterRoot.get().queryTalk(words, local);

            if (query == null)
            {
                break;
            }

            this.queries.Add(query);
        } while(false);

        return(query);
    }
Esempio n. 14
0
    // ---------------------------------------------------------------- //
    // 10 프레임에 1회, 좌표를 네트워크에 전송한다.
    private void sendCharacterCoordinates()
    {
        if (m_network == null)
        {
            return;
        }

        if (this.step != STEP.MOVE)
        {
            return;
        }

        m_send_count = (m_send_count + 1) % SplineData.SEND_INTERVAL;

        if (m_send_count != 0)
        {
            return;
        }

        // 통신용 좌표 송신.
        Vector3        target = this.control.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);

            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;
        }
    }
Esempio n. 15
0
    public void     OnReceiveMovingPacket(PacketId id, byte[] data)
    {
        Debug.Log("OnReceiveMovingPacket");

        MovingPacket packet = new MovingPacket(data);
        MovingData   moving = packet.GetPacket();

        Debug.Log("[CharId]" + moving.characterId);
        Debug.Log("[HouseName]" + moving.houseId);
        Debug.Log("[Moving]" + moving.moving);

        chrController remote =
            CharacterRoot.get().findCharacter(moving.characterId);

        // 이사 쿼리 발행.
        if (remote != null)
        {
            if (moving.moving)
            {
                Debug.Log("cmdQueryHouseMoveStart");
                QueryHouseMoveStart query = remote.cmdQueryHouseMoveStart(moving.houseId, false);
                if (query != null)
                {
                    query.set_done(true);
                    query.set_success(true);
                }
            }
            else
            {
                Debug.Log("cmdQueryHouseMoveEnd");
                QueryHouseMoveEnd query = remote.cmdQueryHouseMoveEnd(false);
                if (query != null)
                {
                    query.set_done(true);
                    query.set_success(true);
                }
            }
        }

        // 이사 정보 보존.
        GlobalParam.get().remote_moving = moving;
    }
Esempio n. 16
0
    // ================================================================ //

    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);
        }
    }
Esempio n. 17
0
    public void     OnReceiveChatMessage(PacketId id, byte[] data)
    {
        Debug.Log("OnReceiveChatMessage");

        ChatPacket  packet = new ChatPacket(data);
        ChatMessage chat   = packet.GetPacket();

        Debug.Log("{CharId]" + chat.characterId);
        Debug.Log("[CharMsg]" + chat.message);

        chrController remote =
            CharacterRoot.get().findCharacter(chat.characterId);

        // 채팅 메시지 표시 쿼리 발행.
        if (remote != null)
        {
            QueryTalk talk = remote.cmdQueryTalk(chat.message);
            if (talk != null)
            {
                talk.set_done(true);
                talk.set_success(true);
            }
        }
    }
Esempio n. 18
0
    // ================================================================ //

    // 대미지.
    // attacker_gidx ...	대미지를 준 플레이어의 global_index
    //						적이 플레이어에게 대미지를 주었을 때는 -1
    public void             causeDamage(float damage, int attacker_gidx, bool is_local = true)
    {
        if (!this.is_accept_damage && is_local)
        {
            return;
        }

        //string log = "[CLIENT][" + ((is_local)? "Local" : "Remote") + "]causeDamage called:" + damage + "[" + attacker_gidx + "]";
        //Debug.Log(log);

        if (!is_local && attacker_gidx == GlobalParam.get().global_account_id)
        {
            // 자신이 공격한 정보일 때는 이미 반영되었으므로 아무것도 하지 않는다.
            return;
        }

        this.trigger_damage = true;

        this.vital.causeDamage(damage);

        this.behavior.onDamaged();

        if (is_local)
        {
            //Debug.Log("[CLIENT][Local]Send damage data:" + this.name + "[" + damage + "]");

            if (this.name.StartsWith("Player"))
            {
                CharacterRoot.get().NotifyHitPoint(this.behavior.name, this.vital.hit_point);
            }
            else
            {
                CharacterRoot.get().NotifyDamage(this.behavior.name, GlobalParam.get().global_account_id, damage);
            }
        }
    }
Esempio n. 19
0
    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);
        }
    }
Esempio n. 20
0
    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);
    }
Esempio n. 21
0
 public static CharacterRoot     getInstance()
 {
     return(CharacterRoot.get());
 }
Esempio n. 22
0
    private float rest_timer = 0.0f;                            // 타이머.

    // ================================================================ //
    // MonoBehaviour에서 상속.

    void    Awake()
    {
        this.bullet_prefab = CharacterRoot.get().player_bullet_negi_prefab;
    }
Esempio n. 23
0
    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"));

            Debug.Log("Name:" + this.player.controll.account_name);

            foreach (ItemManager.ItemState istate in GlobalParam.get().item_table.Values)
            {
                Debug.Log("Item:" + istate.item_id + " Own:" + istate.owner + " State:" + istate.state);

                if (istate.owner == this.player.controll.account_name &&
                    istate.state == ItemController.State.Picked)
                {
                    // 이미 아이템을 획득했다면 가지고 갈 수 있게 합니다.
                    ItemManager.get().activeItme(istate.item_id, true);
                    ItemManager.get().finishGrowingItem(istate.item_id);
                    QueryItemPick query = this.player.controll.cmdItemQueryPick(istate.item_id, false, true);
                    if (query != null)
                    {
                        query.is_anon = true;
                        query.set_done(true);
                        query.set_success(true);
                    }
                    ItemManager.get().setVisible(istate.item_id, true);
                }
            }

            // 리모트에서 이사 중은 로컬도 이사합니다.
            do
            {
                MovingData moving = GlobalParam.get().remote_moving;
                if (!moving.moving)
                {
                    break;
                }

                chrController remote = CharacterRoot.get().findCharacter(moving.characterId);
                if (remote == null)
                {
                    break;
                }

                chrBehaviorNet remote_player = remote.behavior as chrBehaviorNet;
                if (remote_player == null)
                {
                    break;
                }

                chrBehaviorNPC_House house = CharacterRoot.getInstance().findCharacter <chrBehaviorNPC_House>(moving.houseId);
                if (house == null)
                {
                    break;
                }

                Debug.Log("House move event call:" + moving.characterId + ":" + moving.houseId);

                remote_player.beginHouseMove(house);

                // '이사중~' 말풍선 표시.
                house.startHouseMove();
            } while(false);
        }
        break;

        // 배추가 옆으로 움직이고 & 대야를 타고 플레이어가 등장.
        case STEP.OPEN_DOOR:
        {
            if (this.hakusai_fcurve.isDone() && this.tarai_fcurve.isDone())
            {
                this.step.set_next(STEP.GET_OFF_TARAI_0);
            }
        }
        break;

        // 대야에서 내립니다(기슭으로 점프).
        case STEP.GET_OFF_TARAI_0:
        {
            if (!this.player_jump.isMoving())
            {
                this.step.set_next(STEP.GET_OFF_TARAI_1);
            }
        }
        break;

        // 대야에서 내립니다(조금 걷기).
        case STEP.GET_OFF_TARAI_1:
        {
            if (!this.player_move.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.player.controll.cmdSetPosition(this.tarai_leave_spline.curve.cvs.back().position);

                this.tarai_fune.transform.position = this.tarai_leave_spline.curve.cvs.back().position;

                if (!this.is_local_player)
                {
                    SoundManager.get().playSE(Sound.ID.SMN_JINGLE01);
                }
            }
            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, 5.0f);
                this.tarai_fcurve.setDuration(3.5f);
                this.tarai_fcurve.setDelay(0.5f);
                this.tarai_fcurve.start();
            }
            break;

            // 대야에서 내립니다(기슭으로 점프).
            case STEP.GET_OFF_TARAI_0:
            {
                Vector3 start = this.player.controll.getPosition();
                Vector3 goal  = this.get_locator_position("chr_loc_0");

                this.player_jump.start(start, goal, 1.0f);
            }
            break;

            // 대야에서 내립니다(조금 걷기).
            case STEP.GET_OFF_TARAI_1:
            {
                this.player_move.position.start = this.player.controll.getPosition();
                this.player_move.position.goal  = this.get_locator_position("chr_loc_1");
                this.player_move.startConstantVelocity(chrBehaviorLocal.MOVE_SPEED);
            }
            break;

            // 배추가 돌아오고 & 대야가 밖으로 이동.
            case STEP.CLOSE_DOOR:
            {
                this.hakusai_fcurve.setSlopeAngle(10.0f, 10.0f);
                this.hakusai_fcurve.setDuration(4.0f);
                this.hakusai_fcurve.setDelay(1.0f);
                this.hakusai_fcurve.start();
                this.hakusai_tracer.restart();
                this.hakusai_tracer.setCurrentByDistance(this.hakusai_tracer.curve.calcTotalDistance());

                this.tarai_tracer.attach(this.tarai_enter_spline.curve);
                this.tarai_tracer.restart();
                this.tarai_fcurve.reset();
                this.tarai_fcurve.setSlopeAngle(10.0f, 60.0f);
                this.tarai_fcurve.setDuration(2.5f);
                this.tarai_fcurve.start();

                this.ripple_effect.is_created = false;
            }
            break;

            case STEP.END:
            {
                // 이벤트 종료.
                this.hakusai_set.reset();
                this.hakusai_set.setControl(false);

                this.player.endOuterControll();

                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.cv.position);

            this.tarai_fcurve.execute(Time.deltaTime);
            this.tarai_tracer.proceedToDistance(this.tarai_tracer.curve.calcTotalDistance() * (1.0f - 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));

            if (this.tarai_fcurve.isTriggerDone())
            {
                this.ripple_effect.is_created = false;
            }
        }
        break;

        // 대야에서 내립니다(기슭을 향해 점프).
        case STEP.GET_OFF_TARAI_0:
        {
            this.player_jump.execute(Time.deltaTime);
            this.player.controll.cmdSetPosition(this.player_jump.position);
            this.player.controll.cmdSmoothHeadingTo(this.player_jump.goal);
        }
        break;

        // 대야에서 내립니다(조금 걷는다).
        case STEP.GET_OFF_TARAI_1:
        {
            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.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.getCurrent().position);

            this.tarai_fcurve.execute(Time.deltaTime);
            this.tarai_tracer.proceedToDistance(this.tarai_tracer.curve.calcTotalDistance() * (1.0f - this.tarai_fcurve.getValue()));
            this.tarai_fune.transform.position = this.tarai_tracer.getCurrent().position;
            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);
        }

        // ---------------------------------------------------------------- //
    }
Esempio n. 24
0
    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);
    }
Esempio n. 25
0
    // 쿼리  대화(말풍선).
    public QueryTalk        cmdQueryTalk(string words, bool local = false)
    {
        QueryTalk query = CharacterRoot.get().queryTalk(this.getAccountID(), words, local);

        return(query);
    }
Esempio n. 26
0
    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++;
        }
    }
Esempio n. 27
0
    // ================================================================ //

    // 조정을 마친 쿼리 실행.
    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;
        }
    }
Esempio n. 28
0
    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);
        }
    }
Esempio n. 29
0
    // ================================================================ //

    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();
        });
    }
Esempio n. 30
0
    // 레벨 시작 시에 호출.
    public override void            start()
    {
        this.boss = CharacterRoot.get().findCharacter <chrBehaviorEnemyBoss>("Boss1");

        this.step.set_next(STEP.IN_ACTION);
    }