private void setUpAvatarDetails(AvatarDetailsData avatarDetailsData, OtherPlayerData data)
 {
     DCustomEquipment[] outfit = ((data.outfit == null) ? new DCustomEquipment[0] : CustomEquipmentResponseAdaptor.ConvertResponseToOutfit(data.outfit));
     if (data.profile != null)
     {
         Dictionary <int, AvatarColorDefinition> dictionary = Service.Get <GameData>().Get <Dictionary <int, AvatarColorDefinition> >();
         if (dictionary.TryGetValue(data.profile.colour, out var value) && value != null)
         {
             if (ColorUtility.TryParseHtmlString("#" + value.Color, out var color))
             {
                 avatarDetailsData.Init(outfit, color);
                 return;
             }
             Log.LogErrorFormatted(this, "Could not parse a color from color string {0}", value.Color);
             avatarDetailsData.Init(outfit);
         }
         else
         {
             Log.LogErrorFormatted(this, "Avatar color definitions did not contain a value for color id {0}", data.profile.colour);
             avatarDetailsData.Init(outfit);
         }
     }
     else
     {
         avatarDetailsData.Init(outfit);
     }
 }
Example #2
0
    //待招募化身数据列表返回
    void S2C_InvitationPlayer(Pt _info)
    {
        pt_update_recruit_robot_list_d746 info = _info as pt_update_recruit_robot_list_d746;

        if (info == null)
        {
            return;
        }
        ClearInviTations();
        OtherPlayerData other = null;

        for (int i = 0; i < info.recruit_robot_list.Count; i++)
        {
            st.net.NetBase.recruit_robot_list data = info.recruit_robot_list[i];
            other = new OtherPlayerData();
            other.serverInstanceID = data.uid;
            other.name             = data.name;
            other.prof             = data.prof;
            other.baseValueDic[ActorBaseTag.Level]      = (ulong)data.lev;
            other.baseValueDic[ActorBaseTag.FightValue] = (ulong)data.fight_score;
            OtherPlayerInfo otherInfo = new OtherPlayerInfo(other);
            if (!openInvitationPlayerData.Contains(otherInfo))
            {
                openInvitationPlayerData.Add(otherInfo);
            }
        }
        if (OpenInvitationPlayer != null && GameCenter.teamMng.isInTeam)
        {
            OpenInvitationPlayer();
        }
    }
    void RemoveOtherFromList(CymaticLabs.Unity3D.Amqp.SimpleJSON.JSONNode data)
    {
        bool found = false;
        List <OtherPlayerData> removeList = new List <OtherPlayerData>();

        for (int i = 0; i < otherPlayerDataList.Count; i++)
        {
            OtherPlayerData other = otherPlayerDataList[i];
            for (int j = 0; j < data.Count; j++)
            {
                string otherName = (string)data[j]["playerName"];
                if (other.playerName == otherName)
                {
                    found = true;
                    break;
                }
            }

            if (!found)
            {
                removeList.Add(other);
            }

            found = false;
        }

        Debug.Log("Remove = " + removeList.Count);

        for (int i = 0; i < removeList.Count; i++)
        {
            OtherPlayerData remove = removeList[i];

            GameObject otherPlayer    = GameObject.Find(remove.playerName);
            GameObject otherPetPlayer = GameObject.Find("pet_" + remove.playerName);
            GameObject food           = GameObject.Find("food_" + remove.playerName);
            GameObject ball           = GameObject.Find("ball_" + remove.playerName);
            if (otherPlayer != (GameObject)null)
            {
                Destroy(otherPlayer);
            }
            if (otherPetPlayer != (GameObject)null)
            {
                Destroy(otherPetPlayer);
            }
            if (food != (GameObject)null)
            {
                Destroy(food);
            }
            if (ball != (GameObject)null)
            {
                Destroy(ball);
            }

            otherPlayerDataList.Remove(remove);
        }
    }
 protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
 {
     ResponseBody          = new OtherPlayerData();
     ResponseBody.mascotXP = new Dictionary <string, long>();
     ResponseBody.outfit   = new List <CustomEquipment>();
     ResponseBody.name     = "";
     ResponseBody.id       = new PlayerId
     {
         id   = offlineDatabase.AccessToken,
         type = PlayerId.PlayerIdType.SWID
     };
     ResponseBody.zoneId = null;
 }
Example #5
0
        //method for obtaining data for all other users
        protected List <OtherPlayerData> GetInfoAboutOtherPlayers()
        {
            List <OtherPlayerData> otherPlayersDataList = new List <OtherPlayerData>();

            for (int i = minPlayerNumber; i < maxPlayerNumber + 1; i++)
            {
                if (i != playerNumber)
                {
                    OtherPlayerData otherPlayerInfo = GetInfoAboutOneOtherPlayer(i);
                    otherPlayersDataList.Add(otherPlayerInfo);
                }
            }

            return(otherPlayersDataList);
        }
Example #6
0
        //method for obtaining data about one other player
        protected OtherPlayerData GetInfoAboutOneOtherPlayer(int otherPlayerNumber)
        {
            OtherPlayerData returnData = new OtherPlayerData()
            {
                OtherPlayerNumber        = otherPlayerNumber,
                OtherPlayerName          = GetPlayerName(otherPlayerNumber),
                OtherPlayerID            = GetPlayerID(otherPlayerNumber),
                OtherPlayerAmountOfCards = DataPlaceholders.GameStateHolder.EngineInstance.PlayersCards[otherPlayerNumber].Count,
            };

            var logger = NLog.LogManager.GetCurrentClassLogger();

            logger.Info($"Gatherd data about other player: {otherPlayerNumber}.");

            return(returnData);
        }
Example #7
0
    // 不要写Monobehaviour的构造函数
    // 当这个monobehaviour被从prefab中反序列化出来的时候,构造函数会被执行两次,第一次在Resource.Load时,第二次在Instantiate时
//    private GameManager()
//    {
//        m_ActiveScene = new ActiveScene();
//        m_MissionManager = new MissionManager();
//		m_TableManager = new TableManager();
//        m_UILoadResource = new UILoadResource();
//        m_PlayerDataPool = new PlayerData();
//        m_OtherPlayerData = new OtherPlayerData();
//    }

    /// <summary>
    /// 初始化数据,代替原来的构造函数,只能由SceneLogic调用(因为GameManager实例在SceneLogic里创建)
    /// </summary>
    public void Init()
    {
        if (dataInitialized)
        {
            return;
        }

        m_ActiveScene     = new ActiveScene();
        m_FlyWingMananger = new FlyWingMananger();
        m_MissionManager  = new MissionManager();
        m_TableManager    = new TableManager();
        m_PlayerDataPool  = new PlayerData();
        m_OtherPlayerData = new OtherPlayerData();

        dataInitialized = true;
    }
Example #8
0
    /// <summary>
    /// 获取玩家
    /// </summary>
    public List <OtherPlayerInfo> GetPlayer()
    {
        List <OtherPlayerInfo> strs   = new List <OtherPlayerInfo>();
        OtherPlayerData        player = null;

        for (int i = 0; i < robot_list.Count; i++)
        {
            st.net.NetBase.robot_list data = robot_list[i];
            player = new OtherPlayerData();
            player.serverInstanceID = (int)data.uid;
            player.name             = data.name;
            player.baseValueDic[ActorBaseTag.FightValue] = data.battle;
            player.prof = (int)data.prof;
            strs.Add(new OtherPlayerInfo(player));
        }
        return(strs);
    }
Example #9
0
//	public OtherPlayerInfo(SceneAnimActionRef _refData)
//	{
//		if (_refData == null || _refData.values.Count < 4)
//		{
//			GameSys.LogError("参数个数错误,构造玩家信息失败!");
//			return;
//		}
//		serverData = new OtherPlayerData();
//		serverData.serverInstanceID = _refData.targetInstanceID;
//		serverData.prof = _refData.targetConfigID;
//		serverData.startPosX = (int)(_refData.values[0] / 2.0f);
//		serverData.startPosZ = (int)(_refData.values[1] / 2.0f);
//		serverData.dir = _refData.values[2];
//		serverData.camp = _refData.values[3];
//		if (_refData.texts.Count > 0)
//		{
//			serverData.name = _refData.texts[0];
//		}
//		isActor = true;
//		ProcessServerData(serverData);
//	}

    /// <summary>
    /// 构造  by吴江
    /// </summary>
    /// <param name="_actorData"></param>
    public OtherPlayerInfo(st.net.NetBase.scene_model _info)
    {
        serverData = new OtherPlayerData(_info);


        List <int> defaultEquipList = RefData.defaultEquipList;

        foreach (var item in defaultEquipList)
        {
            EquipmentInfo eq = new EquipmentInfo(item, EquipmentBelongTo.EQUIP);
            if (defaultDictionary.ContainsKey(eq.Slot))
            {
                GameSys.LogError(ConfigMng.Instance.GetUItext(213));
            }
            defaultDictionary[eq.Slot] = eq;
        }

        ProcessServerData(serverData);
    }
Example #10
0
    /// <summary>
    /// 好友数据
    /// </summary>
    public List <OtherPlayerInfo> GetOtherPlayerInfoS()
    {
        List <OtherPlayerInfo> lists     = new List <OtherPlayerInfo>();
        OtherPlayerData        playerEty = null;

        //===========fix list禁止用foreach,应用for
        for (int i = 0; i < GameCenter.friendsMng.friendList.Count; i++)
        {
            if (GameCenter.friendsMng.friendList[i].IsOnline)
            {
                FriendsInfo info = GameCenter.friendsMng.friendList[i];
                playerEty = new OtherPlayerData();
                playerEty.serverInstanceID = info.configId;
                playerEty.name             = info.name;
                playerEty.prof             = info.prof;
                playerEty.baseValueDic[ActorBaseTag.FightValue] = (ulong)info.fight;
                playerEty.baseValueDic[ActorBaseTag.Level]      = (ulong)info.lev;
                lists.Add(new OtherPlayerInfo(playerEty));
            }
        }
        return(lists);
    }
Example #11
0
    void OtherPetMovement()
    {
        for (int i = 0; i < otherPlayerDataList.Count; i++)
        {
            OtherPlayerData player = (OtherPlayerData)otherPlayerDataList[i];

            if (player.playerName != this.playerName)
            {
                if (player.petState == "walk" || player.petState == "walkFood" || player.petState == "call" || player.petState == "walktoball" || player.petState == "walkbringball")
                {
                    GameObject curPetObject = GameObject.Find("pet_" + player.playerName);
                    Animator   anim         = curPetObject.GetComponent <Animator>();
                    anim.runtimeAnimatorController = Resources.Load("AnimationController/PetWalkController") as RuntimeAnimatorController;

                    Vector3 lookpos = new Vector3(player.petToPosX, 0.0f, player.petToPosY) - curPetObject.transform.position;
                    lookpos.y = 0;
                    if (lookpos != Vector3.zero)
                    {
                        var rotation = Quaternion.LookRotation(lookpos);
                        curPetObject.transform.rotation = Quaternion.Slerp(curPetObject.transform.rotation, rotation, Time.deltaTime * 2.0f);
                    }

                    curPetObject.transform.position = Vector3.MoveTowards(curPetObject.transform.position, new Vector3(player.petToPosX, 0.0f, player.petToPosY), Time.deltaTime * player.petSpeed);
                }
                else if (player.petState == "eatFood")
                {
                    Animator anim = GameObject.Find("pet_" + player.playerName).GetComponent <Animator>();
                    anim.runtimeAnimatorController = Resources.Load("AnimationController/PetEatController") as RuntimeAnimatorController;
                    GameObject food = GameObject.Find("food_" + player.playerName);
                    if (food != (GameObject)null)
                    {
                        Destroy(food);
                    }
                }
            }
        }
    }
        private void addOtherPlayerDetails(OtherPlayerData data)
        {
            DataEntityHandle handle;

            if (data.id.type == PlayerId.PlayerIdType.SWID)
            {
                handle = dataEntityCollection.FindEntity <SwidData, string>(data.id.id);
                if (DataEntityHandle.IsNullValue(handle))
                {
                    handle = PlayerDataEntityFactory.CreateRemotePlayerEntity(dataEntityCollection, data.name);
                }
            }
            else
            {
                handle = PlayerDataEntityFactory.CreateRemotePlayerEntity(dataEntityCollection, data.name);
            }
            if (!dataEntityCollection.TryGetComponent <AvatarDetailsData>(handle, out var component))
            {
                component = dataEntityCollection.AddComponent <AvatarDetailsData>(handle);
            }
            if (!dataEntityCollection.TryGetComponent <ProfileData>(handle, out var component2))
            {
                component2 = dataEntityCollection.AddComponent <ProfileData>(handle);
            }
            if (!dataEntityCollection.TryGetComponent <MembershipData>(handle, out var component3))
            {
                component3 = dataEntityCollection.AddComponent <MembershipData>(handle);
            }
            if (!dataEntityCollection.TryGetComponent <PresenceData>(handle, out var component4))
            {
                component4 = dataEntityCollection.AddComponent <PresenceData>(handle);
            }
            setUpAvatarDetails(component, data);
            setUpProfile(component2, component4, component3, data);
            component4.IsDisconnecting = false;
        }
 private void setUpProfile(ProfileData profileData, PresenceData presenceData, MembershipData membershipData, OtherPlayerData data)
 {
     profileData.PenguinAgeInDays  = ((data.profile != null) ? data.profile.daysOld : 0);
     profileData.MascotXP          = data.mascotXP;
     membershipData.IsMember       = data.member;
     profileData.ZoneId            = data.zoneId;
     membershipData.MembershipType = (data.member ? MembershipType.Member : MembershipType.None);
     if (!membershipData.IsMember && Service.Get <AllAccessService>().IsAllAccessActive())
     {
         membershipData.IsMember       = true;
         membershipData.MembershipType = MembershipType.AllAccessEventMember;
     }
     if (data.onlineLocation != null)
     {
         profileData.IsOnline           = true;
         presenceData.World             = data.onlineLocation.world;
         presenceData.Room              = data.onlineLocation.zoneId.name;
         presenceData.ContentIdentifier = data.onlineLocation.contentIdentifier;
         if (string.IsNullOrEmpty(data.onlineLocation.zoneId.instanceId))
         {
             presenceData.InstanceRoom = null;
         }
         else
         {
             presenceData.InstanceRoom = data.onlineLocation.zoneId;
         }
     }
     else
     {
         profileData.IsOnline           = false;
         presenceData.World             = null;
         presenceData.Room              = null;
         presenceData.ContentIdentifier = null;
         presenceData.InstanceRoom      = null;
     }
 }
Example #14
0
 public OtherPlayerDataReceived(OtherPlayerData data)
 {
     Data = data;
 }
Example #15
0
 public OtherPlayerInfo(OtherPlayerData data)
 {
     serverData = data;
 }
Example #16
0
    /// <summary>
    /// 构造  by吴江
    /// </summary>
    /// <param name="_actorData"></param>
    public OtherPlayerInfo(st.net.NetBase.scene_ply _info, List <int> _equipList, bool _isInFight)
    {
        serverData = new OtherPlayerData(_info);

        if (_equipList != null && _equipList.Count > 0)
        {
            serverData.equipTypeList.AddRange(_equipList);
        }
        serverData.isInFight = _isInFight;
        IsAlive = serverData.baseValueDic.ContainsKey(ActorBaseTag.CurHP)?(serverData.baseValueDic[ActorBaseTag.CurHP] != 0):true;        //其他玩家是否死亡和复活

        List <int> defaultEquipList = RefData == null?new List <int>():RefData.defaultEquipList;

        foreach (var item in defaultEquipList)
        {
            EquipmentInfo eq = new EquipmentInfo(item, EquipmentBelongTo.EQUIP);
            if (defaultDictionary.ContainsKey(eq.Slot))
            {
                GameSys.LogError(ConfigMng.Instance.GetUItext(213));
            }
            defaultDictionary[eq.Slot] = eq;
        }
        RefineRef rr = ConfigMng.Instance.GetRefineRef(_info.magic_weapon_id, _info.magic_strength_lev, _info.magic_strength_star);

        if (rr != null)
        {
            serverData.magicWeaponID = rr.model;
            if (serverData.equipTypeList.Contains(serverData.magicWeaponID))
            {
                if (!GameCenter.systemSettingMng.OtherPlayerMagic)
                {
                    serverData.equipTypeList.Remove(serverData.magicWeaponID);
                }
            }
            else
            {
                if (GameCenter.systemSettingMng.OtherPlayerMagic)
                {
                    serverData.equipTypeList.Add(serverData.magicWeaponID);
                }
            }
        }
        WingRef data = null;

        if (_info.wing_id > 0)
        {
            data = ConfigMng.Instance.GetWingRef(_info.wing_id, _info.wing_lev);
        }
        if (data != null)
        {
            serverData.wingID = data.itemui;
            if (serverData.equipTypeList.Contains(serverData.wingID))
            {
                if (!GameCenter.systemSettingMng.OtherPlayerWing)
                {
                    serverData.equipTypeList.Remove(serverData.wingID);
                }
            }
            else
            {
                if (GameCenter.systemSettingMng.OtherPlayerWing)
                {
                    serverData.equipTypeList.Add(serverData.wingID);
                }
            }
        }



        ProcessServerData(serverData);

        if (_info.ride_type > 0)
        {
            curMountInfo = new MountInfo(_info, this);
        }
    }
Example #17
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            List <PlayingCard> cardsList = new List <PlayingCard>
            {
                new PlayingCard(CardSuits.None, CardRanks.Joker, 1),
                new PlayingCard(CardSuits.Diamond, CardRanks.Seven, 1),
                new PlayingCard(CardSuits.Spade, CardRanks.Seven, 1),
                new PlayingCard(CardSuits.Heart, CardRanks.Ace, 1),
                new PlayingCard(CardSuits.Heart, CardRanks.Jack, 1),
            };

            ThisPlayerData thisPlayerData = new ThisPlayerData
            {
                ThisPlayerID     = "dwefkwbfwhbfwhbfb",
                ThisPlayerName   = "Michał",
                ThisPlayerNumber = 0,
                ThisPlayerCards  = cardsList
            };

            List <OtherPlayerData> otherPlayerData = new List <OtherPlayerData>();

            OtherPlayerData opd1 = new OtherPlayerData
            {
                OtherPlayerAmountOfCards = 5,
                OtherPlayerID            = "fwefergergerg",
                OtherPlayerName          = "Marek",
                OtherPlayerNumber        = 1,
            };

            OtherPlayerData opd2 = new OtherPlayerData
            {
                OtherPlayerAmountOfCards = 4,
                OtherPlayerID            = "ffvebtnyukio.io.u,",
                OtherPlayerName          = "Gosia",
                OtherPlayerNumber        = 2,
            };

            OtherPlayerData opd3 = new OtherPlayerData
            {
                OtherPlayerAmountOfCards = 6,
                OtherPlayerID            = "fwewevrtntyyu",
                OtherPlayerName          = "Basia",
                OtherPlayerNumber        = 3,
            };

            otherPlayerData.Add(opd1);
            otherPlayerData.Add(opd2);
            otherPlayerData.Add(opd3);

            GameStateData gameData = new GameStateData()
            {
                AmountOfPausingTurns                  = 0,
                CurrentlyDemandedRank                 = CardRanks.None,
                CurrentlyDemandedSuit                 = CardSuits.None,
                CurrentPlayerNumber                   = 0,
                AmountOfCardsToTakeIfLostBattle       = 0,
                BlockPossibilityOfTakingCardsFromDeck = false,
            };


            PersonalizedForSpecificPlayerStartGameDataRequest data = new PersonalizedForSpecificPlayerStartGameDataRequest
            {
                MinimumPlayerNumber   = 0,
                MaximumPlayerNumber   = 3,
                AmountOfPlayers       = 4,
                CurrentGameStatusData = gameData,
                PlayerID = "dwefkwbfwhbfwhbfb",
                NewCardsOnTheTableList = new List <PlayingCard> {
                    new PlayingCard(CardSuits.Heart, CardRanks.Seven, 1)
                },
                AmountOfCardsInDeck = 58,
                CurrentPlayerNumber = 0,
                DataOfThisPlayer    = thisPlayerData,
                DataOfOtherPlayers  = otherPlayerData
            };

            Windows.GameWindow gameWindow = new Windows.GameWindow(ThirdPlayerLocation.Left, data, CardGraphicsLibraryHandler.BackColor.Blue)
            {
                Owner = this,
            };
            gameWindow.ShowDialog();
        }
Example #18
0
    void UpdateOthersPosition(CymaticLabs.Unity3D.Amqp.SimpleJSON.JSONNode data)
    {
        Debug.Log("list player responses");

        for (int i = 0; i < data.Count; i++)
        {
            string otherUsername = (string)data[i]["playerName"];
            float  otherPosX     = (float)data[i]["posX"];
            float  otherPosY     = (float)data[i]["posY"];

            string otherPetName     = (string)data[i]["petName"];
            float  otherPetPosX     = (float)data[i]["petPosX"];
            float  otherPetPosY     = (float)data[i]["petPosY"];
            float  otherPetLastPosX = (float)data[i]["petLastPosX"];
            float  otherPetLastPosY = (float)data[i]["petLastPosY"];

            string otherStartTimeMoveString = (string)data[i]["timeStartMove"];
            long   otherStartTimeMove       = 0L;

            if (otherStartTimeMoveString != "")
            {
                otherStartTimeMove = Convert.ToInt64(otherStartTimeMoveString);
            }

            string otherPetState = (string)data[i]["petState"];
            float  otherPetSpeed = (float)data[i]["petSpeed"];

            Debug.Log("main player = " + this.playerName);
            Debug.Log("other player = " + otherUsername);

            if (otherUsername != this.playerName)
            {
                OtherPlayerData other = otherPlayerDataList.Find(x => x.playerName == otherUsername);

                if (other == null)
                {
                    OtherPlayerData newOtherPlayer = new OtherPlayerData();
                    newOtherPlayer.playerName = otherUsername;
                    newOtherPlayer.posX       = otherPosX - this.centerPosX;
                    newOtherPlayer.posY       = otherPosY - this.centerPosY;
                    newOtherPlayer.petName    = otherPetName;
                    newOtherPlayer.petState   = otherPetState;

                    float mapPetLastPosX = otherPetLastPosX - this.centerPosX;
                    float mapPetLastPosY = otherPetLastPosY - this.centerPosY;
                    float mapPetPosX     = otherPetPosX - this.centerPosX;
                    float mapPetPosY     = otherPetPosY - this.centerPosY;

                    Vector3 mapPetLastPos    = new Vector3(mapPetLastPosX, 0.0f, mapPetLastPosY);
                    Vector3 mapPetPos        = new Vector3(mapPetLastPosY, 0.0f, mapPetLastPosY);
                    float   totalDistance    = Vector3.Distance(mapPetLastPos, mapPetPos);
                    float   distanceTraveled = 0.0f;

                    //double seconds = (DateTime.Now - new DateTime(otherStartTimeMove)).TotalSeconds;
                    //Debug.Log(seconds);
                    //float distanceTraveled = (float)(seconds * 1f);

                    if (otherStartTimeMove != 0L)
                    {
                        double seconds = (DateTime.Now - new DateTime(otherStartTimeMove)).TotalSeconds;
                        distanceTraveled = (float)(seconds * otherPetSpeed);
                    }

                    Debug.Log(distanceTraveled + " --- distance traveled");
                    Debug.Log(totalDistance + " --- total distance");
                    //Debug.Log(seconds + "  --- time seconds");

                    Vector3 predictedPos;

                    if (distanceTraveled >= totalDistance)
                    {
                        newOtherPlayer.petFromPosX = mapPetLastPosX;
                        newOtherPlayer.petFromPosY = mapPetLastPosY;
                        newOtherPlayer.petToPosX   = mapPetPosX;
                        newOtherPlayer.petToPosY   = mapPetPosY;

                        predictedPos = new Vector3(mapPetPosX, 0.0f, mapPetPosY);
                    }
                    else
                    {
                        float percentage = distanceTraveled / totalDistance;

                        predictedPos = Vector3.Lerp(mapPetLastPos, mapPetPos, percentage);
                        newOtherPlayer.petFromPosX = predictedPos.x;
                        newOtherPlayer.petFromPosY = predictedPos.z;
                        newOtherPlayer.petToPosX   = mapPetPosX;
                        newOtherPlayer.petToPosY   = mapPetPosY;
                    }

                    newOtherPlayer.petSpeed = otherPetSpeed;

                    otherPlayerDataList.Add(newOtherPlayer);

                    //jika belum ada nama pet
                    GameObject newPetObject = Instantiate(Resources.Load("PetPrefab")) as GameObject;
                    newPetObject.name = "pet_" + otherPetName;
                    newPetObject.transform.position = new Vector3(predictedPos.x, 0.0f, predictedPos.z);

                    GameObject petName     = newPetObject.transform.Find("PetNameText").gameObject;
                    TextMesh   petNameMesh = petName.GetComponent <TextMesh>();

                    petNameMesh.text          = "<pet>\n" + otherPetName;
                    petNameMesh.characterSize = 0.05f;
                    petNameMesh.fontSize      = 100;
                    petNameMesh.color         = Color.green;

                    Font font = Resources.Load <Font>("Font/youmurdererbb_reg");
                    petNameMesh.font = font;
                    var mr = petNameMesh.GetComponent <Renderer>();
                    mr.material = font.material;

                    GameObject otherPlayerNameObject = new GameObject();
                    otherPlayerNameObject.AddComponent <NameController>();
                    otherPlayerNameObject.name = otherUsername;
                    otherPlayerNameObject.transform.position = new Vector3(otherPosX - this.centerPosX, 10.0f, this.centerPosY);

                    var meshText = otherPlayerNameObject.AddComponent <TextMesh>() as TextMesh;
                    meshText.text          = "<user>\n" + otherUsername;
                    meshText.characterSize = 0.05f;
                    meshText.fontSize      = 100;
                    meshText.color         = Color.green;

                    Font font1 = Resources.Load <Font>("Font/youmurdererbb_reg");
                    meshText.font = font1;
                    var mr1 = meshText.GetComponent <Renderer>();
                    mr1.material = font1.material;
                }
                else
                {
                    other.petToPosX = otherPetPosX - this.centerPosX;
                    other.petToPosY = otherPetPosY - this.centerPosY;
                    other.petState  = otherPetState;
                    other.petSpeed  = otherPetSpeed;

                    if (other.petState == "walkFood")
                    {
                        GameObject food = GameObject.CreatePrimitive(PrimitiveType.Cube);

                        food.name = "food_" + other.playerName;
                        food.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
                        food.transform.position   = new Vector3(other.petToPosX, 0, other.petToPosY);
                    }

                    if (other.petState == "walktoball")
                    {
                        GameObject otherBallFound = GameObject.Find("ball_" + otherUsername);
                        if (otherBallFound == (GameObject)null)
                        {
                            GameObject otherBall = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                            otherBall.name = "ball_" + otherUsername;
                            otherBall.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);
                            otherBall.transform.position   = new Vector3(other.petToPosX, 0.0f, other.petToPosY);

                            Rigidbody ballRigibody = otherBall.AddComponent <Rigidbody>();
                            ballRigibody.mass        = 1;
                            ballRigibody.isKinematic = true;
                        }
                    }

                    if (other.petState == "walkbringball")
                    {
                        GameObject otherBall = GameObject.Find("ball_" + otherUsername);
                        GameObject otherPet  = GameObject.Find("pet_" + otherUsername);

                        otherBall.transform.position = otherPet.transform.position;
                        otherBall.transform.parent   = otherPet.transform;
                    }

                    GameObject otherPlayer = GameObject.Find(otherUsername);
                    if (otherPlayer != (GameObject)null)
                    {
                        otherPlayer.transform.position = new Vector3(otherPosX - this.centerPosX, 10.0f, otherPosY - centerPosY);
                    }
                }
            }
        }
    }
    private void otherPlayerDataReturned(GetOtherPlayerDataOperation operation, HttpResponse response)
    {
        OtherPlayerData responseBody = operation.ResponseBody;

        Service.Get <EventDispatcher>().DispatchEvent(new PlayerStateServiceEvents.OtherPlayerDataReceived(responseBody));
    }