Exemple #1
0
    // 떨어져 있는 아이템 줍기.
    public ItemController   pickItem(QueryItemPick query, string owner_id, string item_id)
    {
        // 프로그램의 버그를 막고자 쿼리가 없으면.
        // 줍지 못하게 했다.

        ItemController item = null;

        do
        {
            // 일단 쿼리의 결과도 체크.
            if (!query.isSuccess())
            {
                break;
            }

            item = this.find_item(item_id);

            if (item == null)
            {
                break;
            }

            item.picker = owner_id;
            item.startPicked();

            if (item_id.StartsWith("key"))
            {
                PartyControl.get().pickKey(item_id, owner_id);
            }
        } while(false);

        return(item);
    }
Exemple #2
0
    // ================================================================ //
    // 비헤이비어용 커맨드.
    // 쿼리 계.

    // 쿼리 대화(말풍선).
    public QueryTalk        queryTalk(string account_id, string words, bool is_local)
    {
        QueryTalk query = null;

        do
        {
            query = new QueryTalk(account_id, words);

            if (query == null)
            {
                break;
            }

            QueryManager.get().registerQuery(query);


            if (m_network != null && is_local)
            {
                // 말풍선 요청을 보낸다.
                ChatMessage chat = new ChatMessage();

                chat.characterId = PartyControl.get().getLocalPlayer().getAcountID();
                chat.message     = words;

                ChatPacket packet = new ChatPacket(chat);

                int serverNode = m_network.GetServerNode();
                m_network.SendReliable <ChatMessage>(serverNode, packet);
            }
        } while(false);


        return(query);
    }
Exemple #3
0
    public void OnReceivePrizeResultPacket(int node, PacketId id, byte[] data)
    {
        PrizeResultPacket packet = new PrizeResultPacket(data);
        PrizeResultData   result = packet.GetPacket();

        Debug.Log("[CLIENT] ReceivePrizeResultPacket");

        for (int i = 0; i < result.cakeDataNum; ++i)
        {
            this.cake_counts[i] = result.cakeNum[i];

            Debug.Log("[CLIENT] Cake num[" + i + "]:" + result.cakeNum[i]);
        }

        chrBehaviorLocal local_player = PartyControl.get().getLocalPlayer();

        QueryCakeCount query = QueryManager.get().findQuery <QueryCakeCount>(x => x.account_id == local_player.getAcountID());

        if (query != null)
        {
            Debug.Log("[CLIENT]QueryCakeCount done");
            query.set_done(true);
            query.set_success(true);
        }
    }
Exemple #4
0
    // 게임 시작 시에 한 번만 호출된다.
    public override void    start()
    {
        this.player = PartyControl.get().getLocalPlayer();

        this.camera_control = CameraControl.get();

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

        this.control.rigidbody.isKinematic = true;
        this.control.rigidbody.Sleep();

        this.control.setVisible(false);

        this.hover.gravity     = Physics.gravity.y * 0.1f;
        this.hover.accel_scale = 2.0f;

        this.hover.zero_level     = 3.0f;
        this.hover.hard_limit.max = 100.0f;

        this.radius = 5.0f;

        //

        this.step.set_next(STEP.IDLE);
    }
Exemple #5
0
    // 제네레이터를 찾는다.
    protected chrBehaviorEnemy_Lair         find_lair(string lair_name)
    {
        chrBehaviorEnemy_Lair lair = null;

        do
        {
            RoomController room_control = PartyControl.get().getCurrentRoom();

            Room room = this.rooms[room_control.getIndex().x, room_control.getIndex().z];

            var lairs = room.enemies.FindAll(x => ((x.behavior as chrBehaviorEnemy_Lair) != null));

            if (lairs.Count == 0)
            {
                break;
            }

            var lair_control = lairs.Find(x => (x.name == lair_name));

            if (lair_control == null)
            {
                break;
            }

            lair = lair_control.behavior as chrBehaviorEnemy_Lair;
        } while(false);

        return(lair);
    }
Exemple #6
0
    // ?⑥뼱???덈뒗 ?꾩씠??以띻린.
    public ItemController   pickItem(QueryItemPick query, string owner_id, string item_id)
    {
        // ?꾨줈洹몃옩??踰꾧렇瑜?留됯퀬??荑쇰━媛€ ?놁쑝硫?
        // 以띿? 紐삵븯寃??덈떎.

        ItemController item = null;

        do
        {
            // ?쇰떒 荑쇰━??寃곌낵??泥댄겕.
            if (!query.isSuccess())
            {
                break;
            }

            item = this.find_item(item_id);

            if (item == null)
            {
                break;
            }

            item.picker = owner_id;
            item.startPicked();

            if (item_id.StartsWith("key"))
            {
                PartyControl.get().pickKey(item_id, owner_id);
            }
        } while(false);

        return(item);
    }
Exemple #7
0
    void    Update()
    {
        if (Input.GetKeyDown(KeyCode.A))
        {
            //YellDisp	yell = this.createCakeCount(1, 1, 32);

            //yell.setPosition(Vector3.up*64.0f);
            //this.dispatchYell(YELL_WORD.READY);
        }

        if (this.stat_win_local != null)
        {
            this.stat_win_local.setHP(PartyControl.get().getLocalPlayer().control.vital.getHitPoint());
        }

        //

        if (this.stat_wins_net != null)
        {
            for (int i = 0; i < this.stat_wins_net.Length; i++)
            {
                this.stat_wins_net[i].setHP(PartyControl.get().getFriend(i).control.vital.getHitPoint());
            }
        }
    }
Exemple #8
0
    // 삭제 직전에 호출된다.
    public override void            onDelete()
    {
        base.onDelete();

        // 아이템을 생성한다.
        if (this.reward_item.type != "" && this.reward_item.name != "")
        {
            string local_player_id = PartyControl.get().getLocalPlayer().getAcountID();

            ItemManager.get().createItem(this.reward_item.type, this.reward_item.name, local_player_id);
            ItemManager.get().setPositionToItem(this.reward_item.name, this.control.getPosition());

            var item = ItemManager.get().findItem(this.reward_item.name);

            if (item != null)
            {
                item.behavior.setFavorOption(this.reward_item.option0);
                item.behavior.beginSpawn();
            }
        }

        if (this.room != null)
        {
            LevelControl.get().onDeleteEnemy(this.room, this.control);
        }
    }
Exemple #9
0
    public void             execute_queries()
    {
        // 조정이 끝난 쿼리를 찾는다.
        List <QueryBase> queries = QueryManager.get().findDoneQuery(this.control.getAccountID());

        foreach (QueryBase query in queries)
        {
            switch (query.getType())
            {
            case "talk":
            {
                Debug.Log("query talk: " + PartyControl.get().getLocalPlayer().getAcountID());

                if (query.isSuccess())
                {
                    QueryTalk query_talk = query as QueryTalk;

                    this.control.cmdDispBalloon(query_talk.words);
                }
                query.set_expired(true);
            }
            break;
            }

            // 용무가 끝났으므로 삭제한다.
            query.set_expired(true);

            if (!query.isSuccess())
            {
                continue;
            }
        }
    }
Exemple #10
0
    public override void    initialize()
    {
        this.player        = PartyControl.get().getLocalPlayer();
        this.player_weapon = this.player.gameObject.findDescendant("anim_wepon");

        this.data = GameObject.Find("EventDataIceAtari").GetComponent <EventDataIceAtari>();

        // 당첨의 막대 모델.
        this.ice_bar = this.data.prefab_ice_atari_bar.instantiate();

        this.ice_bar.setParent(this.player.gameObject.findDescendant("anim_wrist_R"));
        this.ice_bar.setLocalPosition(new Vector3(-0.056f, -0.086f, 0.039f));
        this.ice_bar.SetActive(false);

        // "!" 말풍선.
        this.sprite_bikkuri = Sprite2DRoot.get().createSprite(this.data.texture_bikkuri, true);
        this.sprite_bikkuri.setVisible(false);

        // 당첨 말풍선.
        this.sprite_atari = Sprite2DRoot.get().createSprite(this.data.texture_atari, true);

        this.sprite_atari.setPosition(new Vector2(0.0f, 150.0f));
        this.sprite_atari.setVisible(false);

        this.sprite_ice_bar = Sprite2DRoot.get().createSprite(this.data.texture_ice_bar, true);
        this.sprite_ice_bar.setVisible(false);
        this.sprite_ice_bar.setMaterial(this.data.material_ice_sprite);

        this.spline = this.data.gameObject.findDescendant("spline_ice").GetComponent <SimpleSplineObject>();
        this.tracer.attach(this.spline.curve);
    }
Exemple #11
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();
    }
Exemple #12
0
    public void             attack(bool is_local)
    {
        this.is_trigger_attack = true;

        if (is_local)
        {
            CharacterRoot.get().SendAttackData(PartyControl.get().getLocalPlayer().getAcountID(), 1);
        }
    }
Exemple #13
0
    // 작지할 장소   캐릭터마다 다르다.
    protected Vector3       calc_landing_position(chrBehaviorPlayer player)
    {
        Vector3 position = Vector3.zero;

        position = PartyControl.get().getPositionOffset(player.control.global_index);

        position = Quaternion.AngleAxis(this.door_dir_to_y_angle(this.door.door_dir), Vector3.up) * position;

        return(position);
    }
    // 애니메이션에서 호출되는 이벤트 퀵 공격이 성공한 순간.
    public void     NotifyQuickAttack_Impact()
    {
        chrBehaviorLocal player = PartyControl.get().getLocalPlayer();

        if (Vector3.Distance(player.control.getPosition(), this.getPosition()) < 6.0f * this.getScale())
        {
            player.control.causeDamage(vital.getAttackPower(), -1);
            player.beginBlowOut(this.getPosition(), 3.0f * this.getScale());
        }
    }
    // 레벨 시작 시에 호출.
    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);
    }
Exemple #16
0
    void    Update()
    {
        // 플레이어가 주운 것을 목록에서 제외.
        this.cakes.RemoveAll(x => x == null);

        //

        this.create_timer += Time.deltaTime;

        do
        {
            if (!this.is_started)
            {
                break;
            }

            if (this.first_serve > 0)
            {
                if (this.create_timer < 0.5f)
                {
                    break;
                }

                if (this.first_serve == FIRST_SERVE_COUNT)
                {
                    this.set_position   = PartyControl.get().getLocalPlayer().control.getPosition() + new Vector3(0.5f, 0.0f, 0.0f);
                    this.set_position.y = 0.0f;
                }
                else
                {
                    this.calc_next_set_position();
                }
                this.first_serve--;
            }
            else
            {
                if (this.create_timer < 0.3f)
                {
                    break;
                }
                if (this.cakes.Count > 30)
                {
                    break;
                }

                this.calc_next_set_position();
            }

            //

            this.create_cakes(this.set_position);

            this.create_timer = 0.0f;
        } while(false);
    }
Exemple #17
0
        public override void    execute()
        {
            if (this.finish_child())
            {
                this.step.set_next(STEP.BOTTACHI);
            }

            // ---------------------------------------------------------------- //
            // 다음 상태로 이동할지 체크합니다.

            switch (this.step.do_transition())
            {
            // 서있기.
            case STEP.BOTTACHI:
            {
                chrBehaviorLocal player = PartyControl.get().getLocalPlayer();

                if (this.behavior.isInAttackRange(player.control))
                {
                    this.push(this.melee_attack);
                    this.step.sleep();
                }
            }
            break;
            }

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

            while (this.step.get_next() != STEP.NONE)
            {
                switch (this.step.do_initialize())
                {
                case STEP.BOTTACHI:
                {
                }
                break;
                }
            }

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

            switch (this.step.do_execution(Time.deltaTime))
            {
            case STEP.BOTTACHI:
            {
            }
            break;
            }

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

            this.execute_child();
        }
Exemple #18
0
    // 트리거에 충돌한 순간만 호출되는 메소드.
    void    OnTriggerEnter(Collider other)
    {
        // 이벤트 박스에 들어간 플레이어를 리스트에 추가한다.
        do
        {
            if (other.tag != "Player")
            {
                break;
            }

            chrController player = other.gameObject.GetComponent <chrController>();

            if (player == null)
            {
                break;
            }

            if (player.local_index < 0)
            {
                break;
            }

            if (this.entered_players.Contains(player.local_index))
            {
                break;
            }

            this.entered_players.Add(player.local_index);

            // 게임 서버에 알림.
            if (this.step.get_current() == STEP.WAIT_ENTER &&
                player.global_index == GlobalParam.get().global_account_id)
            {
                CharDoorState door = new CharDoorState();
                door.globalId    = player.global_index;
                door.keyId       = (this.keyItemName != null)? this.keyItemName : "NONE";
                door.isInTrigger = true;
                door.hasKey      = (this.keyItemName != null)? PartyControl.getInstance().hasKey(player.local_index, door.keyId) : true;

                string log = "DoorId:" + door.keyId + " trigger:" + door.isInTrigger + " hasKey:" + door.hasKey;
                Debug.Log(log);

                DoorPacket packet = new DoorPacket(door);
                if (m_network != null)
                {
                    int server_node = m_network.GetServerNode();
                    m_network.SendReliable <CharDoorState>(server_node, packet);
                }
                else
                {
                    PartyControl.get().cmdMoveRoom(door.keyId);
                }
            }
        } while(false);
    }
Exemple #19
0
    // ================================================================ //

    // 공격할 플레이어를 선택한다.
    public chrBehaviorPlayer        selectTargetPlayer(float distance_limit, float angle_limit)
    {
        chrBehaviorPlayer target = null;

        // 공격 가능 범위에서 가장 가깝고 정면에 있는 플레이어를.
        // 찾는다.

        var players = PartyControl.get().getPlayers();

        float min_score = -1.0f;

        foreach (var player in players)
        {
            // 거리를 조사한다.

            float distance = (this.control.getPosition() - player.control.getPosition()).Y(0.0f).magnitude;

            if (distance >= distance_limit)
            {
                continue;
            }

            // 정면에서 어느 정도 방향이 어긋나는가?.

            float angle = MathUtility.calcDirection(this.control.getPosition(), player.control.getPosition());

            angle = Mathf.Abs(MathUtility.snormDegree(angle - this.control.getDirection()));

            if (angle >= angle_limit)
            {
                continue;
            }

            //

            float score = distance * MathUtility.remap(0.0f, angle_limit, angle, 1.0f, 2.0f);

            if (target == null)
            {
                target    = player;
                min_score = score;
            }
            else
            {
                if (score < min_score)
                {
                    target    = player;
                    min_score = score;
                }
            }
        }

        return(target);
    }
Exemple #20
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);
    }
    // 플로어 키가 위에서 내려온다.
    protected void create_floor_key()
    {
        this.key_instance_name = key_item_name + "." + this.player.getAcountID();

        ItemManager.get().createItem(key_item_name, this.key_instance_name, PartyControl.get().getLocalPlayer().getAcountID());
        ItemManager.get().setPositionToItem(this.key_instance_name, WeaponSelectLevelSequence.getKeyStayPosition());

        ItemController item_key = ItemManager.get().findItem(this.key_instance_name);

        item_key.behavior.beginFall();
    }
Exemple #22
0
    // 스테이터스 창을 만든다.
    public void             createStatusWindows()
    {
        int local_gindex = PartyControl.get().getLocalPlayer().control.global_index;

        int friend_count = PartyControl.get().getFriendCount();

        int[] friend_gindex = new int[friend_count];

        for (int i = 0; i < friend_count; i++)
        {
            friend_gindex[i] = PartyControl.get().getFriend(i).control.global_index;
        }

        // 스테이터스 창   로컬 플레이어용.

        GameObject go;

        go = GameObject.Instantiate(this.status_window_local_prefab) as GameObject;

        this.stat_win_local = go.GetComponent <StatusWindowLocal>();

        this.stat_win_local.face_icon_texture    = this.face_icon_textures[local_gindex];
        this.stat_win_local.cookie_icon_textures = this.cookie_icon_textures;
        this.stat_win_local.number_textures      = this.number_textures;
        this.stat_win_local.lace_texture         = this.lace_texture;
        this.stat_win_local.create();
        this.stat_win_local.setPosition(new Vector2(640.0f / 2.0f - 70.0f, 480.0f / 2.0f - 70.0f));

        // 스테이터스 창 리포트 플레이어용.


        this.stat_wins_net = new StatusWindowNet[friend_count];

        Vector2 position = new Vector2(640.0f / 2.0f - 60.0f, 60.0f);

        for (int i = 0; i < friend_count; i++)
        {
            go = GameObject.Instantiate(this.status_window_net_prefab) as GameObject;

            StatusWindowNet stat_win_net = go.GetComponent <StatusWindowNet>();

            stat_win_net.face_icon_texture    = this.face_icon_textures[friend_gindex[i]];
            stat_win_net.cookie_icon_textures = this.cookie_icon_textures;
            stat_win_net.lace_texture         = this.lace_texture;
            stat_win_net.create();

            stat_win_net.setPosition(position);

            this.stat_wins_net[i] = stat_win_net;

            position.y -= 96.0f;
        }
    }
Exemple #23
0
    // 트리거로부터 뭔가가 부딪힌 순간만 호출되는 메소드.
    void    OnTriggerExit(Collider other)
    {
        // 이벤트 박스에서 나온 플레이어를 리스트에서 제거.
        do
        {
            if (other.tag != "Player")
            {
                break;
            }

            chrController player = other.gameObject.GetComponent <chrController>();

            if (player == null)
            {
                break;
            }

            if (!this.entered_players.Contains(player.local_index))
            {
                break;
            }

            this.entered_players.Remove(player.local_index);

            // 게임 서버에 알림.
            if (player.global_index == GlobalParam.get().global_account_id)
            {
                CharDoorState door = new CharDoorState();
                door.globalId    = player.global_index;
                door.keyId       = (this.keyItemName != null)? this.keyItemName : "NONE";
                door.isInTrigger = false;
                door.hasKey      = PartyControl.getInstance().hasKey(player.local_index, door.keyId);

                string log = "DoorId:" + door.keyId + " trigger:" + door.isInTrigger + " hasKey:" + door.hasKey;
                Debug.Log(log);

                DoorPacket packet = new DoorPacket(door);
                if (m_network != null)
                {
                    int serer_node = m_network.GetServerNode();
                    m_network.SendReliable <CharDoorState>(serer_node, packet);
                }
                else
                {
                    PartyControl.get().clearDoorState(door.keyId);
                }
            }
        } while(false);
    }
    // 맵에 아이텝을 배치하는 메소드.
    private void generateItems(GameRoot gameRoot)
    {
        string local_player_id = PartyControl.get().getLocalPlayer().getAcountID();

        string item_type = "shot_negi";
        string item_name = item_type + "." + local_player_id;

        ItemManager.get().createItem(item_type, item_name, local_player_id);
        ItemManager.get().setPositionToItem(item_name, WeaponSelectMapInitializer.getNegiItemPosition());

        item_type = "shot_yuzu";
        item_name = item_type + "." + local_player_id;
        ItemManager.get().createItem(item_type, item_name, local_player_id);
        ItemManager.get().setPositionToItem(item_name, WeaponSelectMapInitializer.getYuzuItemPosition());
    }
Exemple #25
0
    // 지정 범위 안에 있는 적 탐색.
    public List <chrController> getRoomEnemiesInRange(RoomController room, Vector3 center, float radius)
    {
        if (room == null)
        {
            room = PartyControl.get().getCurrentRoom();
        }

        var enemies = this.rooms[room.getIndex().x, room.getIndex().z].enemies;

        enemies = enemies.FindAll(x => x != null);

        enemies = enemies.FindAll(x => MathUtility.calcDistanceXZ(x.getPosition(), center) < radius);

        return(enemies);
    }
Exemple #26
0
    // 적이 그 자리에 멈춰선 상태 해제.
    public void             endStillEnemies(RoomController room_control, float delay)
    {
        if (room_control == null)
        {
            room_control = PartyControl.get().getCurrentRoom();
        }

        Room room = this.rooms[room_control.getIndex().x, room_control.getIndex().z];

        foreach (var chr in room.enemies)
        {
            chrBehaviorEnemy enemy = chr.behavior as chrBehaviorEnemy;

            enemy.endStill(delay);
        }
    }
Exemple #27
0
    // 가지고 있는 아이템을 버린다.
    public void     dropItem(string owner_id, string item_id)
    {
        ItemController item = this.find_item(item_id);

        if (item == null)
        {
            return;
        }

        item.picker = "";

        if (item_id.StartsWith("key"))
        {
            PartyControl.get().dropKey(item_id, "");
        }
    }
Exemple #28
0
    // ?뚮젅?댁뼱媛€ 蹂댁뒪??肄쒕━?꾩뿉 臾삵????€吏곸씪 ???녾쾶 ?섏? ?딅룄濡?
    // 諛⑹쓽 以묒떖 諛⑺뼢?쇰줈 諛€?대궦??
    protected bool  force_push_out(CollisionResult result)
    {
        bool is_pushouted = false;


        do
        {
            if (result.is_trigger)
            {
                break;
            }

            GameObject other = result.object1;

            chrControllerEnemyBoss control_other = other.GetComponent <chrControllerEnemyBoss>();

            if (control_other == null)
            {
                break;
            }

            // ???댁긽 媛€源뚯슦硫?媛뺤젣濡?諛€?대궦??
            float distance_limit = 2.0f * control_other.getScale();

            if (Vector3.Distance(other.transform.position, this.control.getPosition()) >= distance_limit)
            {
                break;
            }

            Vector3 room_center = MapCreator.get().getRoomCenterPosition(PartyControl.get().getCurrentRoom().getIndex());

            Vector3 v = room_center - other.transform.position;

            v.Normalize();

            if (v.magnitude == 0.0f)
            {
                v = Vector3.forward;
            }

            this.control.cmdSetPositionAnon(other.transform.position + v * distance_limit * 2.0f);

            is_pushouted = true;
        } while(false);

        return(is_pushouted);
    }
Exemple #29
0
    // 접속 끊김에 관한 이벤트 처리.
    private void DisconnectEventProc(int node)
    {
        int global_index = network.GetPlayerIdFromNode(node);

        if (node == network.GetServerNode() ||
            global_index == 0)
        {
            // 서버와 호스트와 접속이 끊기면 종료.
            this.step.set_next(STEP.ERROR);
        }
        else
        {
            Debug.Log("[CLIENT]disconnect character:" + global_index);

            PartyControl.get().deleteNetPlayer(global_index);
        }
    }
Exemple #30
0
    // 레벨 시작 시에 호출.
    public override void            start()
    {
        // 각 플레이어가 케이크를 획득한 수..

        this.cake_counts = new int[NetConfig.PLAYER_MAX];

        for (int i = 0; i < this.cake_counts.Length; i++)
        {
            if (GameRoot.get().isConnected(i))
            {
                this.cake_counts[i] = -1;
            }
            else
            {
                this.cake_counts[i] = 0;
            }
        }

        chrBehaviorLocal local_player = PartyControl.get().getLocalPlayer();

        this.cake_counts[local_player.getGlobalIndex()] = local_player.getCakeCount();

        QueryCakeCount query_cake = new QueryCakeCount(local_player.getAcountID(), local_player.getCakeCount());

        query_cake.timeout = 20.0f;

        QueryManager.get().registerQuery(query_cake);

        // Network 클래스의 컴포넌트 획득.
        GameObject obj = GameObject.Find("Network");

        if (obj != null)
        {
            this.m_network = obj.GetComponent <Network>();

            if (this.m_network != null)
            {
                this.m_network.RegisterReceiveNotification(PacketId.PrizeResult, OnReceivePrizeResultPacket);
            }
        }

        // 케이크 데이터 송신.
        sendPrizeData();

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