public GameObject CreateEntityModel(Entity entity, UInt64 guid, Vector3 dir, Vector3 pos) { if (entity == null) { return(null); } int id = (int)entity.ObjTypeID; SetCommonProperty(entity, id); if (entity.ModelName == null || entity.ModelName == "") { return(null); } string path = GameConfig.MonsterModelsDir; // 创建GameObject string resPath = path + entity.ModelName; entity.RealObject = ObjectPoolManager.Instance.GetObject(resPath); if (entity.RealObject == null) { DebugEx.LogError("entity RealObject is null, resPath is " + resPath); } entity.ResPath = resPath; var transform = entity.RealObject.transform; transform.localPosition = pos; transform.localRotation = Quaternion.LookRotation(dir); if (entity is Player) { entity.EntityType = EEntityType.Player; if (entity is SelfPlayer) { PlayerManager.Instance.LocalPlayer = (SelfPlayer)entity; } } else { entity.EntityType = EEntityType.Monster; // todo 读取)ConfigReader.GetNpcInfo(id).NpcType; if (entity.EntityType == EEntityType.Monster && (int)entity.EntityCamp >= (int)EEntityCampType.A) { entity.EntityType = EEntityType.AltarSoldier; } entity.ColliderRadius = 0 / 100; // todo read } if (entity.NpcCateChild != ENpcCateChild.BuildShop) { entity.CreateHealthBar(); } AddEntityComponent(entity); return(entity.RealObject); }