Exemplo n.º 1
0
 static async Task InstantiateStructures(IEnumerable <IArea> loadedAreas, Dictionary <int, IStructureModel> loadedStructureModels, IGalaxyRegistrationManager rm, IPlayerLocator pl)
 {
     foreach (IArea a in loadedAreas)
     {
         var structureIDs = a.GetStructureIDs();
         foreach (int id in structureIDs)
         {
             IStructure s = StructureHelper.InstantiateStructure(loadedStructureModels[id], pl, rm);
             a.AddStructure(s);
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Loads the structures associated with the given object
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        public static async Task <List <IStructure> > LoadStructures(IHasStructures loadMine, IDatabaseManager dbm, IGalaxyRegistrationManager rm, IPlayerLocator pl)
        {
            var loadedStructureModels = await dbm.GetStructuresAsync(loadMine.GetStructureIDs());

            List <IStructure> loadedStructures = new List <IStructure>();

            foreach (var ls in loadedStructureModels)
            {
                IStructure s = StructureHelper.InstantiateStructure(ls, pl, rm);
                loadMine.AddStructure(s);
                loadedStructures.Add(s);
            }

            return(loadedStructures);
        }
Exemplo n.º 3
0
 protected override IStructure _instantiateObject(IDBObject s, LocatorService ls)
 {
     return(StructureHelper.InstantiateStructure((IStructureModel)s, ls.PlayerLocator, ls.RegistrationManager));
 }