/// <summary> /// 添加一个新的精灵 /// </summary> /// <param name="type"></param> public static void AddNewEntity(SpriteType type, EntityServerInfo info = null) { if (info == null) { info = new EntityServerInfo(); } EntityParent entity = null; switch (type) { case SpriteType.NONE: break; case SpriteType.Myself: if (thePlayer == null) { entity = new EntityMyself(); info.id = 1000; info.dataId = 1; info.position = Vector3.zero; info.x = 100; info.y = 100; } else { info.id = 1000; info.position = Vector3.zero; info.x = 100; info.y = 100; thePlayer.SetEntityServerInfo(info); thePlayer.UpdatePosition(); return; } break; case SpriteType.Player: entity = new EntityPlayer(); break; case SpriteType.Monster: entity = new EntityMonster(); break; default: break; } if (entity == null) { return; } entity.SetEntityServerInfo(info); entity.CreateModel(); entity.EnterWorld(); OnEnterWorld(entity); }