public void Add(ObjectInfo info, bool myPlayer = false) { // zone때문에 myPlayer와 player 패킷이 겹치게 들어옴 if (MyPlayer != null && MyPlayer.Id == info.ObjectId) { return; } // 중복으로 생성하는걸 방지 if (_objects.ContainsKey(info.ObjectId)) { return; } GameObjectType type = GetObjectTypeById(info.ObjectId); if (type == GameObjectType.Player) { // 추가되는게 플레이어 일때 GameObject go; if (myPlayer) { go = Managers.Resource.Instantiate("Creatures/MyPlayer"); go.name = info.Name; _objects.Add(info.ObjectId, go); MyPlayer = go.GetComponent <MyPlayerController>(); MyPlayer.Id = info.ObjectId; MyPlayer.PosInfo = info.PosInfo; MyPlayer.Stat.MergeFrom(info.StatInfo); MyPlayer.SynkPos(); } else { go = Managers.Resource.Instantiate("Creatures/Player"); go.name = info.Name; _objects.Add(info.ObjectId, go); PlayerController pc = go.GetComponent <PlayerController>(); pc.Id = info.ObjectId; pc.PosInfo = info.PosInfo; pc.Stat.MergeFrom(info.StatInfo); pc.SynkPos(); } } else if (type == GameObjectType.Monster) { // 몬스터 ADD GameObject go; go = Managers.Resource.Instantiate("Creatures/Monster"); go.name = info.Name; _objects.Add(info.ObjectId, go); MonsterController mc = go.GetComponent <MonsterController>(); mc.Id = info.ObjectId; mc.PosInfo = info.PosInfo; mc.Stat = info.StatInfo; mc.SynkPos(); } else if (type == GameObjectType.Projectile) { // 투사체 ADD GameObject go; go = Managers.Resource.Instantiate("Creatures/Arrow"); go.name = info.Name; _objects.Add(info.ObjectId, go); ArrowController ac = go.GetComponent <ArrowController>(); ac.PosInfo = info.PosInfo; ac.Stat = info.StatInfo; ac.CellPos = new Vector3Int(info.PosInfo.PosX, info.PosInfo.PosY, 0); ac.SynkPos(); } }