示例#1
0
    // 네트 플레이어 만들기.
    public void             createNetPlayer(int account_global_index)
    {
        chrBehaviorLocal local_player = this.players[0].GetComponent <chrBehaviorLocal>();

        chrBehaviorNet net_player = null;

        int local_index = this.players.Count;

        AccountData account_data = AccountManager.get().getAccountData(account_global_index);

        string avator_name = "Player_" + account_data.avator_id;

        net_player = CharacterRoot.getInstance().createPlayerAsNet(avator_name).GetComponent <chrBehaviorNet>();

        net_player.control.local_index  = local_index;
        net_player.control.global_index = account_global_index;
        net_player.local_player         = local_player;

        net_player.position_in_formation = this.getInFormationOffset(account_global_index);

        SHOT_TYPE shot_type = GlobalParam.get().shot_type[account_global_index];

        net_player.changeBulletShooter(shot_type);

        net_player.transform.Translate(this.getLocalPlayer().control.getPosition() + net_player.position_in_formation);

        this.players.Add(net_player);
    }
示例#2
0
    // 소환수를 소환
    public void             summonBeast(string beast_name)
    {
        do
        {
            if (this.beast != null)
            {
                break;
            }

            if (beast_name == "")
            {
                break;
            }

            string avator_name   = "Beast_" + beast_name;
            string behavior_name = "chrBehaviorBeast_" + beast_name;

            chrController chr = CharacterRoot.getInstance().summonBeast(avator_name, behavior_name);

            if (chr == null)
            {
                break;
            }

            this.beast = chr.behavior;

            this.beast.control.cmdSetPositionAnon(this.getLocalPlayer().control.getPosition() + Vector3.back * 4.0f);

            this.summon_time = 0.0f;

            this.state = SUMMON_STATE.APPEAR;

            //Debug.Log("[CLIENT] Summon beast:" + beast_name);
        } while(false);
    }
示例#3
0
    public void OnReceiveUseItemPacket(int node, PacketId id, byte[] data)
    {
        ItemUsePacket packet  = new ItemUsePacket(data);
        ItemUseData   useData = packet.GetPacket();

        Debug.Log("Receive UseItemPacket:" + useData.userId + " -> " +
                  useData.targetId + " (" + useData.itemCategory + ")");

        chrController user = CharacterRoot.getInstance().findPlayer(useData.userId);

        AccountData account_data = AccountManager.get().getAccountData(GlobalParam.getInstance().global_account_id);

        if (user != null && account_data.avator_id != useData.userId)
        {
            Debug.Log("use item. favor:" + useData.itemFavor);

            Item.Favor favor = new Item.Favor();
            favor.category = (Item.CATEGORY)useData.itemCategory;
            this.useItem(-1, favor, useData.userId, useData.targetId, false);
        }
        else
        {
            Debug.Log("Receive packet is already done.");
        }
    }
示例#4
0
    // 적 캐릭터를 만든다.
    public chrController    createEnemy(string enemy_name)
    {
        chrController enemy = CharacterRoot.getInstance().createEnemy(enemy_name);

        this.enemies.Add(enemy);

        return(enemy);
    }
示例#5
0
    // 적 캐릭터 제네레이터를 만든다.
    public chrController    createEnemyLair()
    {
        chrController enemy = CharacterRoot.getInstance().createEnemy("EnemyLairMinato");

        this.enemies.Add(enemy);

        return(enemy);
    }
示例#6
0
    // 적 캐릭터를 만든다.
    public chrController    createEnemy(string chr_name, string controller_class_name, string behavior_class_name)
    {
        chrController enemy = CharacterRoot.getInstance().createEnemy(chr_name, controller_class_name, behavior_class_name);

        this.enemies.Add(enemy);

        return(enemy);
    }
示例#7
0
    // ================================================================ //
#if false
    // 적 캐릭터를 만든다.
    public chrController    createEnemy()
    {
        // 일시적으로 항구 버전の적 캐릭터를 생성하도록 변경.
//		chrController	enemy = CharacterRoot.getInstance().createEnemy("Enemy1");
        chrController enemy = CharacterRoot.getInstance().createEnemy("EnemyMinato");

        this.enemies.Add(enemy);

        return(enemy);
    }
示例#8
0
    // 進行方向へ向けて EnemyBullet を発射する
    public void PerformFire()
    {
        GameObject go = GameObject.Instantiate(CharacterRoot.getInstance().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.getDirection(), Vector3.up);

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

        bullet.owner = this;

        // 弾丸の発射待ち
        this.refireDelayTimer = refireDelayTime;
    }
示例#9
0
    // 캐릭터를 만듭니다.
    protected void          create_character(string[] words, string local_account, string net_account, bool create_npc)
    {
        string chr_name = words[0];

        chr_name = chr_name.Remove(0, "ChrModel_".Length);

        chrController chr = null;
        Vector3       pos;
        float         direction;

        if (chr_name == local_account)
        {
            chr = CharacterRoot.getInstance().createPlayerAsLocal(chr_name);
        }
        else if (chr_name == net_account)
        {
            if (create_npc)
            {
                chr = CharacterRoot.getInstance().createPlayerAsNet(chr_name);
            }
        }
        else
        {
            chr = CharacterRoot.getInstance().createNPC(chr_name);
        }

        if (chr != null)
        {
            pos.x = float.Parse(words[1]);
            pos.y = 0.0f;
            pos.z = float.Parse(words[2]);

            if (words.Length >= 4)
            {
                direction = float.Parse(words[3]);
            }
            else
            {
                direction = 0.0f;
            }

            chr.cmdSetPosition(pos);
            chr.cmdSetDirection(direction);
        }
    }
示例#10
0
    // ================================================================ //

    // 로컬 플레이어 만들기.
    public void             createLocalPlayer(int account_global_index)
    {
        if (this.players.Count == 0)
        {
            AccountData account_data = AccountManager.get().getAccountData(account_global_index);

            string avator_name = "Player_" + account_data.avator_id;

            chrBehaviorLocal local_player = CharacterRoot.getInstance().createPlayerAsLocal(avator_name).GetComponent <chrBehaviorLocal>();

            local_player.control.local_index  = 0;
            local_player.control.global_index = account_global_index;

            local_player.position_in_formation = this.getInFormationOffset(account_global_index);

            SHOT_TYPE shot_type = GlobalParam.get().shot_type[account_global_index];
            local_player.changeBulletShooter(shot_type);

            this.players.Add(local_player);
        }
    }
示例#11
0
    // 쿼리-이사 시작해도 되는가?.
    public QueryHouseMoveStart      queryHouseMoveStart(string house_name, bool local = true)
    {
        QueryHouseMoveStart query = null;

        do
        {
            chrBehaviorNPC_House house = CharacterRoot.getInstance().findCharacter <chrBehaviorNPC_House>(house_name);

            if (house == null)
            {
                break;
            }

            query = new QueryHouseMoveStart(house_name);

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

        // 이사 시작 요청을 보냅니다.
        GameObject netObj = GameObject.Find("Network");

        if (netObj && local)
        {
            // Network 클래스의 컴포넌트 획득합니다.
            Network network = netObj.GetComponent <Network>();
            // 이사 시작 요청을 보냅니다.
            MovingData moving = new MovingData();
            moving.characterId = GameRoot.getInstance().account_name_local;
            moving.houseId     = house_name;
            moving.moving      = true;
            MovingPacket packet = new MovingPacket(moving);
            network.SendReliable <MovingData>(packet);

            // 이사 정보 보존.
            GlobalParam.get().local_moving = moving;
        }

        return(query);
    }
示例#12
0
    // 아이템 사용.
    public void             useItem(int slot_index, Item.Favor item_favor, string user_name, string target_name, bool is_local)
    {
        do
        {
            chrController user = CharacterRoot.getInstance().findPlayer(user_name);

            if (user == null)
            {
                break;
            }

            chrController target = CharacterRoot.getInstance().findPlayer(target_name);

            if (target == null)
            {
                break;
            }

            //

            if (user_name == PartyControl.get().getLocalPlayer().getAcountID())
            {
                user.onUseItemSelf(slot_index, item_favor);
            }
            else
            {
                target.onUseItemByFriend(item_favor, user);
            }

            // 아이템 사용을 알림.
            if (is_local)
            {
                SendItemUseData(item_favor, user_name, target_name);
            }
        } while(false);
    }
示例#13
0
    // ================================================================ //

    // 아이템 정보 패킷 취득 함수.
    public void OnReceiveItemPacket(int node, PacketId id, byte[] data)
    {
        ItemPacket packet = new ItemPacket(data);
        ItemData   item   = packet.GetPacket();

        // 서버 상태와 동기화.
        ItemState istate = new ItemState();

        istate.item_id = item.itemId;
        ItemController.State state = (ItemController.State)item.state;
        istate.state = (state == ItemController.State.Dropped)? ItemController.State.None : state;
        istate.owner = item.ownerId;
        if (GlobalParam.getInstance().item_table.ContainsKey(istate.item_id))
        {
            GlobalParam.getInstance().item_table.Remove(istate.item_id);
        }
        GlobalParam.getInstance().item_table.Add(istate.item_id, istate);

        string log = "[CLIENT] Receive itempacket [" +
                     "itemId:" + item.itemId +
                     " state:" + state.ToString() +
                     " ownerId:" + item.ownerId + "]";

        Debug.Log(log);
        dbwin.console().print(log);

        if (state == ItemController.State.Picked)
        {
            Debug.Log("Receive item pick.");
            dbwin.console().print("Receive item pick.");

            // 응답이 있는  쿼리를 탐색.
            QueryItemPick query_pick = QueryManager.get().findQuery <QueryItemPick>(x => x.target == item.itemId);

            bool remote_pick = true;

            if (query_pick != null)
            {
                string account_name = PartyControl.get().getLocalPlayer().getAcountID();
                if (item.ownerId == account_name)
                {
                    Debug.Log("Receive item pick local:" + item.ownerId);
                    dbwin.console().print("Receive item pick local:" + item.ownerId);

                    item_query_done(query_pick, true);
                    remote_pick = false;
                }
                else
                {
                    Debug.Log("Receive item pick remote:" + item.ownerId);
                    dbwin.console().print("Receive item pick remote:" + item.ownerId);

                    item_query_done(query_pick, false);
                }
            }

            if (remote_pick == true)
            {
                Debug.Log("Remote pick item:" + item.ownerId);
                dbwin.console().print("Remote pick item:" + item.ownerId);

                // 리모트 캐릭터가 가지게 한다.
                chrController remote = CharacterRoot.getInstance().findPlayer(item.ownerId);
                if (remote)
                {
                    // 아이템 획득 쿼리 발행.
                    QueryItemPick query = remote.cmdItemQueryPick(item.itemId, false, true);
                    if (query != null)
                    {
                        item_query_done(query, true);
                    }
                }
            }

            // 아이템 획득 상태 변경.
            this.setItemState(item.itemId, ItemController.State.Picked, item.ownerId);
        }
        else if (state == ItemController.State.Dropped)
        {
            Debug.Log("Receive item drop.");

            // 응답이 있는 쿼리를 검색.
            QueryItemDrop query_drop = QueryManager.get().findQuery <QueryItemDrop>(x => x.target == item.itemId);


            bool remote_drop = true;

            if (query_drop != null)
            {
                // 요청에 대한 응답이 있다.
                string account_name = AccountManager.get().getAccountData(GlobalParam.get().global_account_id).avator_id;
                if (item.ownerId == account_name)
                {
                    // 자신이 획득.
                    Debug.Log("Receive item drop local:" + item.ownerId);
                    item_query_done(query_drop, true);
                    remote_drop = false;
                }
                else
                {
                    // 상대가 획득.
                    Debug.Log("Receive item pick remote:" + item.ownerId);
                    item_query_done(query_drop, false);
                }
            }

            if (remote_drop == true)
            {
                // 리모트 캐릭터가 획득.
                chrController remote = CharacterRoot.getInstance().findPlayer(item.ownerId);
                if (remote)
                {
                    // 아이템획득 쿼리 발행.
                    Debug.Log("QuetyitemDrop:cmdItemQueryDrop");
                    remote.cmdItemDrop(item.itemId, false);
                }
            }
        }
        else
        {
            Debug.Log("Receive item error.");
        }
    }
示例#14
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);
        }

        // ---------------------------------------------------------------- //
    }
示例#15
0
 public static CharacterRoot     get()
 {
     return(CharacterRoot.getInstance());
 }
示例#16
0
    // 아이템 정보 패킷 획득 함수.
    public void OnReceiveItemPacket(PacketId id, byte[] data)
    {
        ItemPacket packet = new ItemPacket(data);
        ItemData   item   = packet.GetPacket();

        // 서버의 상태와 동기화합니다.
        ItemState istate = new ItemState();

        istate.item_id = item.itemId;
        ItemController.State state = (ItemController.State)item.state;
        istate.state = (state == ItemController.State.Dropped)? ItemController.State.None : state;
        istate.owner = item.ownerId;
        if (GlobalParam.get().item_table.ContainsKey(item.itemId))
        {
            GlobalParam.get().item_table.Remove(istate.item_id);
        }
        GlobalParam.get().item_table.Add(istate.item_id, istate);

        string log = "[CLIENT] Receive itempacket. " +
                     "itemId:" + item.itemId +
                     " state:" + state.ToString() +
                     " ownerId:" + item.ownerId;

        Debug.Log(log);

        if (state == ItemController.State.Picked)
        {
            Debug.Log("Receive item pick.");

            // 응답이 있는 쿼리를 검색.
            QueryItemPick query_pick = null;
            foreach (var query in this.queries)
            {
                QueryItemPick pick = query as QueryItemPick;
                if (pick != null && pick.target == item.itemId)
                {
                    query_pick = pick;
                    break;
                }
            }

            bool remote_pick = true;

            if (query_pick != null)
            {
                if (item.ownerId == GlobalParam.get().account_name)
                {
                    Debug.Log("Receive item pick local:" + item.ownerId);
                    item_query_done(query_pick, true);
                    remote_pick = false;
                }
                else
                {
                    Debug.Log("Receive item pick remote:" + item.ownerId);
                    item_query_done(query_pick, false);
                }
            }

            if (remote_pick == true)
            {
                // 리모트 캐릭터가 취득하게 합니다.
                chrController remote = CharacterRoot.getInstance().findPlayer(item.ownerId);
                if (remote)
                {
                    // 아이템 획득 쿼리 발행.
                    QueryItemPick query = remote.cmdItemQueryPick(item.itemId, false, true);
                    if (query != null)
                    {
                        item_query_done(query, true);
                    }
                }
            }
        }
        else if (state == ItemController.State.Dropped)
        {
            Debug.Log("Receive item drop.");

            // 응답이 있는 쿼리를 검색.
            QueryItemDrop query_drop = null;
            foreach (var query in this.queries)
            {
                QueryItemDrop drop = query as QueryItemDrop;
                if (drop != null && drop.target == item.itemId)
                {
                    query_drop = drop;
                    break;
                }
            }

            bool remote_drop = true;

            if (query_drop != null)
            {
                // 요청에 대한 응답이 있을 때.
                if (item.ownerId == GlobalParam.get().account_name)
                {
                    // 자신이 획득.
                    Debug.Log("Receive item drop local:" + item.ownerId);
                    item_query_done(query_drop, true);
                    remote_drop = false;
                }
                else
                {
                    // 상대가 획득.
                    Debug.Log("Receive item pick remote:" + item.ownerId);
                    item_query_done(query_drop, false);
                }
            }

            if (remote_drop == true)
            {
                // 리모트 캐릭터가 회득하게 합니다.
                chrController remote = CharacterRoot.getInstance().findPlayer(item.ownerId);
                if (remote)
                {
                    // 아이템 획득 쿼리 발행.
                    Debug.Log("QuetyitemDrop:cmdItemQueryDrop");
                    QueryItemDrop query = remote.cmdItemQueryDrop(false);
                    if (query != null)
                    {
                        query.is_drop_done = true;
                        item_query_done(query, true);
                    }
                }
            }
        }
        else
        {
            Debug.Log("Receive item error.");
        }
    }
示例#17
0
    public void             execute()
    {
        // ---------------------------------------------------------------- //
        // 다음 상태로 전환할지 체크.


        switch (this.step.do_transition())
        {
        // 대미지  하얗게 플래시.
        case STEP.DAMAGE:
        {
            if (this.step.get_time() >= DAMAGE_FLUSH_TIME)
            {
                this.step.set_next(STEP.IDLE);
            }
        }
        break;

        // 페이드가 끝나고 삭제 대기 중.
        case STEP.VANISH:
        {
            if (this.step.get_time() >= VANISH_TIME)
            {
                this.step.set_next(STEP.VACANT);
            }
        }
        break;

        // 페이드인.
        case STEP.FADE_IN:
        {
            if (this.step.get_time() >= this.fade_duration)
            {
                this.step.set_next(STEP.IDLE);
            }
        }
        break;
        }

        // ---------------------------------------------------------------- //
        // 상태 전환 시 초기화.

        while (this.step.get_next() != STEP.NONE)
        {
            switch (this.step.do_initialize())
            {
            case STEP.IDLE:
            {
                // 머티리얼을 원래대로 되돌린다.
                for (int i = 0; i < this.renders.Length; i++)
                {
                    this.renders[i].material = this.org_materials[i];
                }
            }
            break;

            // 대미지 하얗게 플래시.
            case STEP.DAMAGE:
            {
                for (int i = 0; i < renders.Length; i++)
                {
                    this.renders[i].material = CharacterRoot.getInstance().damage_material;
                }
            }
            break;

            // 당했다.
            case STEP.VANISH:
            {
                // 페이드 아웃용 머티리얼로 교체.
                for (int i = 0; i < renders.Length; i++)
                {
                    this.renders[i].material = CharacterRoot.getInstance().vanish_material;
                }
            }
            break;

            case STEP.FADE_IN:
            case STEP.FADE_OUT:
            {
                // 페이드용 머티리얼로 교체.
                for (int i = 0; i < renders.Length; i++)
                {
                    // 텍스처를 원래 머티리얼로부터 복사한다.
                    Texture texture = this.renders[i].material.GetTexture(0);

                    this.renders[i].material = CharacterRoot.getInstance().vanish_material;

                    this.renders[i].material.SetTexture(0, texture);
                }
            }
            break;
            }
        }

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

        switch (this.step.do_execution(Time.deltaTime))
        {
        // 당했다.
        case STEP.VANISH:
        {
            float rate = this.step.get_time() / VANISH_TIME;

            rate = Mathf.Pow(rate, 1.0f / 2.0f);

            float alpha = Mathf.Max(0.0f, 1.0f - rate);

            for (int i = 0; i < this.renders.Length; i++)
            {
                this.renders[i].material.color = new Color(1.0f, 1.0f, 1.0f, alpha);
            }
        }
        break;

        // 페이드 아웃.
        case STEP.FADE_IN:
        case STEP.FADE_OUT:
        {
            float rate = this.step.get_time() / this.fade_duration;

            rate = Mathf.Pow(rate, 1.0f / 2.0f);

            float alpha;

            if (this.step.get_current() == STEP.FADE_IN)
            {
                alpha = Mathf.Min(rate, 1.0f);
            }
            else
            {
                alpha = Mathf.Max(0.0f, 1.0f - rate);
            }

            for (int i = 0; i < this.renders.Length; i++)
            {
                Color color = this.renders[i].material.color;

                color.a = alpha;

                this.renders[i].material.color = color;
            }
        }
        break;
        }

        // ---------------------------------------------------------------- //
    }
示例#18
0
    // ================================================================ //

    // ?꾩씠???뺣낫 ?⑦궥 痍⑤뱷 ?⑥닔.
    public void OnReceiveItemPacket(int node, PacketId id, byte[] data)
    {
        ItemPacket packet = new ItemPacket(data);
        ItemData   item   = packet.GetPacket();

        // ?쒕쾭 ?곹깭?€ ?숆린??
        ItemState istate = new ItemState();

        istate.item_id = item.itemId;
        ItemController.State state = (ItemController.State)item.state;
        istate.state = (state == ItemController.State.Dropped)? ItemController.State.None : state;
        istate.owner = item.ownerId;
        if (GlobalParam.getInstance().item_table.ContainsKey(istate.item_id))
        {
            GlobalParam.getInstance().item_table.Remove(istate.item_id);
        }
        GlobalParam.getInstance().item_table.Add(istate.item_id, istate);

        string log = "[CLIENT] Receive itempacket [" +
                     "itemId:" + item.itemId +
                     " state:" + state.ToString() +
                     " ownerId:" + item.ownerId + "]";

        Debug.Log(log);
        dbwin.console().print(log);

        if (state == ItemController.State.Picked)
        {
            Debug.Log("Receive item pick.");
            dbwin.console().print("Receive item pick.");

            // ?묐떟???덈뒗  荑쇰━瑜??먯깋.
            QueryItemPick query_pick = QueryManager.get().findQuery <QueryItemPick>(x => x.target == item.itemId);

            bool remote_pick = true;

            if (query_pick != null)
            {
                string account_name = PartyControl.get().getLocalPlayer().getAcountID();
                if (item.ownerId == account_name)
                {
                    Debug.Log("Receive item pick local:" + item.ownerId);
                    dbwin.console().print("Receive item pick local:" + item.ownerId);

                    item_query_done(query_pick, true);
                    remote_pick = false;
                }
                else
                {
                    Debug.Log("Receive item pick remote:" + item.ownerId);
                    dbwin.console().print("Receive item pick remote:" + item.ownerId);

                    item_query_done(query_pick, false);
                }
            }

            if (remote_pick == true)
            {
                Debug.Log("Remote pick item:" + item.ownerId);
                dbwin.console().print("Remote pick item:" + item.ownerId);

                // 由щえ??罹먮┃?곌? 媛€吏€寃??쒕떎.
                chrController remote = CharacterRoot.getInstance().findPlayer(item.ownerId);
                if (remote)
                {
                    // ?꾩씠???띾뱷 荑쇰━ 諛쒗뻾.
                    QueryItemPick query = remote.cmdItemQueryPick(item.itemId, false, true);
                    if (query != null)
                    {
                        item_query_done(query, true);
                    }
                }
            }

            // ?꾩씠???띾뱷 ?곹깭 蹂€寃?
            this.setItemState(item.itemId, ItemController.State.Picked, item.ownerId);
        }
        else if (state == ItemController.State.Dropped)
        {
            Debug.Log("Receive item drop.");

            // ?묐떟???덈뒗 荑쇰━瑜?寃€??
            QueryItemDrop query_drop = QueryManager.get().findQuery <QueryItemDrop>(x => x.target == item.itemId);


            bool remote_drop = true;

            if (query_drop != null)
            {
                // ?붿껌???€???묐떟???덈떎.
                string account_name = AccountManager.get().getAccountData(GlobalParam.get().global_account_id).avator_id;
                if (item.ownerId == account_name)
                {
                    // ?먯떊???띾뱷.
                    Debug.Log("Receive item drop local:" + item.ownerId);
                    item_query_done(query_drop, true);
                    remote_drop = false;
                }
                else
                {
                    // ?곷?媛€ ?띾뱷.
                    Debug.Log("Receive item pick remote:" + item.ownerId);
                    item_query_done(query_drop, false);
                }
            }

            if (remote_drop == true)
            {
                // 由щえ??罹먮┃?곌? ?띾뱷.
                chrController remote = CharacterRoot.getInstance().findPlayer(item.ownerId);
                if (remote)
                {
                    // ?꾩씠?쒗쉷??荑쇰━ 諛쒗뻾.
                    Debug.Log("QuetyitemDrop:cmdItemQueryDrop");
                    remote.cmdItemDrop(item.itemId, false);
                }
            }
        }
        else
        {
            Debug.Log("Receive item error.");
        }
    }
示例#19
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++;
        }
    }
示例#20
0
    public override void    execute()
    {
        // ---------------------------------------------------------------- //
        // ステップ内の経過時間を進める.

        this.step_timer += Time.deltaTime;

        // ---------------------------------------------------------------- //

        if (this.trigger_damage)
        {
            this.control.damage_effect.startDamage();

            this.life -= 1.0f;

            if (this.life <= 0.0f)
            {
                this.next_step = STEP.VANISH;
            }
        }

        // ---------------------------------------------------------------- //
        // 次の状態に移るかどうかを、チェックする.

        if (this.next_step == STEP.NONE)
        {
            switch (this.step)
            {
            case STEP.MOVE:
            {
                if (this.step_timer > 1.0f)
                {
                    this.next_step = STEP.REST;
                }
            }
            break;

            case STEP.REST:
            {
                if (this.step_timer > 3.0f)
                {
                    this.next_step = STEP.MOVE;
                }
            }
            break;

            case STEP.VANISH:
            {
                if (this.control.damage_effect.isDone())
                {
                    EnemyRoot.getInstance().deleteEnemy(this.control);
                }
            }
            break;
            }
        }

        // ---------------------------------------------------------------- //
        // 状態が遷移したときの初期化.

        while (this.next_step != STEP.NONE)
        {
            this.step      = this.next_step;
            this.next_step = STEP.NONE;

            switch (this.step)
            {
            case STEP.MOVE:
            {
            }
            break;

            case STEP.VANISH:
            {
                // アニメーションとめる.
                Animation[] animations = this.gameObject.GetComponentsInChildren <Animation>();

                foreach (var animation in animations)
                {
                    animation.Stop();
                }

                this.control.damage_effect.startVanish();
            }
            break;
            }

            this.step_timer = 0.0f;
        }

        // ---------------------------------------------------------------- //
        // 各状態での実行処理.

        switch (this.step)
        {
        case STEP.MOVE:
        {
            chrController player = CharacterRoot.getInstance().getPlayer();

            if (player != null)
            {
                var dir = Quaternion.LookRotation(player.transform.position - this.transform.position);

                this.move_dir = dir.eulerAngles.y;
            }
            else
            {
                float turn = Random.Range(-90.0f, 90.0f);

                this.move_dir = this.control.getDirection() + turn;
            }

            this.exec_step_move();
        }
        break;

        case STEP.VANISH:
        {
        }
        break;
        }

        // ---------------------------------------------------------------- //

        this.trigger_damage = false;
    }
示例#21
0
    // ================================================================ //

    // STEP.MOVE 실행.
    // 이동.
    protected void  exec_step_move()
    {
        // ---------------------------------------------------------------- //
        // 이동(위치좌표 보간).

        Vector3 position = this.controll.getPosition();

        Vector3 dist = (this.move_target - position).Y(0.0f);

        float speed           = MOVE_SPEED;
        float speed_per_frame = speed * Time.deltaTime;

        if (dist.magnitude < speed_per_frame)
        {
            // 목표위치가 아주 가까울 때는 현재위치=목표위치로 한다.
            position = this.move_target;

            // 스톱 모션을 재생한다.
            this.stopWalkMotion();
        }
        else
        {
            // 목표위치가 멀 때는 이동 속도만큼 이동한다 .

            dist *= (speed_per_frame) / dist.magnitude;

            position += dist;

            // 걷기 모션을 재생한다.
            this.playWalkMotion();
        }

        position.y = this.controll.getPosition().y;

        this.controll.cmdSetPosition(position);

        if (this.step.get_current() == STEP.HOUSE_MOVE)
        {
        }
        else
        {
            // 방향 보간.
            this.controll.cmdSmoothHeadingTo(this.move_target);
        }

        // ---------------------------------------------------------------- //

        GameInput gi = this.controll.game_input;

        // 드래그하는 동안 이동 목표위치를 갱신한다.
        if (gi.pointing.current)
        {
            if (gi.pointing.pointee != GameInput.POINTEE.NONE)
            {
                this.move_target = gi.pointing.position_3d;
            }
        }

        if (gi.pointing.trigger_on)
        {
            if (gi.pointing.pointee == GameInput.POINTEE.ITEM)
            {
                if (this.controll.item_carrier.isCarrying())
                {
                    // 픽업 중인 아이템을 클릭했을 때는 일단 아무것도 하지 않는다.
                    if (gi.pointing.pointee_name == this.controll.item_carrier.item.name)
                    {
                        this.move_target    = this.controll.getPosition();
                        gi.pointing.pointee = GameInput.POINTEE.NONE;
                    }
                }
            }

            // 아이템/캐릭터가 클릭되었다.
            if (gi.pointing.pointee == GameInput.POINTEE.ITEM || gi.pointing.pointee == GameInput.POINTEE.CHARACTER)
            {
                Vector3 item_pos;
                Vector3 item_size;

                if (gi.pointing.pointee == GameInput.POINTEE.ITEM)
                {
                    this.controll.item_man.getItemPosition(out item_pos, gi.pointing.pointee_name);
                    this.controll.item_man.getItemSize(out item_size, gi.pointing.pointee_name);
                }
                else
                {
                    chrController chr = CharacterRoot.getInstance().findCharacter(gi.pointing.pointee_name);

                    item_pos = chr.transform.position;

                    if (chr.GetComponent <BoxCollider>() != null)
                    {
                        item_size = chr.GetComponent <BoxCollider>().size;
                    }
                    else
                    {
                        item_size = chr.collider.bounds.size;
                    }
                }

                dist   = item_pos - this.transform.position;
                dist.y = 0.0f;

                item_size.y = 0.0f;

                float distance_to_pick = (this.gameObject.collider.bounds.size.x + item_size.magnitude) / 2.0f;

                if (this.step.get_current() == STEP.HOUSE_MOVE)
                {
                    // 이사 중에 집이 클릭되면 이사 끝.
                    if (gi.pointing.pointee_name == this.name)
                    {
                        this.controll.cmdQueryHouseMoveEnd();
                        this.step.set_next(STEP.WAIT_QUERY);
                    }
                }
                else
                {
                    if (dist.magnitude < distance_to_pick)
                    {
                        // 가까울 때.

                        if (gi.pointing.pointee == GameInput.POINTEE.ITEM)
                        {
                            // 아이템이면 픽업한다.
                            this.controll.cmdItemQueryPick(gi.pointing.pointee_name);
                            this.step.set_next(STEP.WAIT_QUERY);
                        }
                        else if (gi.pointing.pointee == GameInput.POINTEE.CHARACTER)
                        {
                            // 캐릭터.

                            // 집일 때는 이사.
                            if (gi.pointing.pointee_name.ToLower().StartsWith("house"))
                            {
                                if (this.isEnableHouseMove())
                                {
                                    this.controll.cmdQueryHouseMoveStart(gi.pointing.pointee_name);
                                    this.step.set_next(STEP.WAIT_QUERY);
                                }
                            }
                        }

                        // 아이템을 픽업한 직후에 이동을 시작하지 않도록、
                        // 이동 목표 위치를 클릭해 둔다.
                        gi.pointing.pointee = GameInput.POINTEE.NONE;
                        this.move_target    = this.controll.getPosition();
                    }
                    else
                    {
                        // 멀 때는 그곳까지 이동.
                        this.move_target      = gi.pointing.position_3d;
                        this.move_target_item = gi.pointing.pointee_name;
                    }
                }
            }
        }
    }
示例#22
0
    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);
    }