Ejemplo n.º 1
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="location">The location containing the garage.</param>
 /// <param name="building">The garage building.</param>
 /// <param name="tractor">The tractor for this garage (if found).</param>
 /// <param name="saveData">The garage save data.</param>
 public GarageMetadata(BuildableGameLocation location, Building building, Tractor tractor, CustomSaveBuilding saveData)
 {
     this.Location = location;
     this.Building = building;
     this.Tractor  = tractor;
     this.SaveData = saveData;
 }
Ejemplo n.º 2
0
        /****
        ** Helper methods
        ****/
        /// <summary>Get all tractor garages in the game.</summary>
        private IEnumerable <GarageMetadata> FindGarages()
        {
            foreach (BuildableGameLocation location in CommonHelper.GetLocations().OfType <BuildableGameLocation>())
            {
                foreach (TractorGarage garage in location.buildings.OfType <TractorGarage>())
                {
                    Tractor tractor      = Utility.findHorse(garage.HorseId) as Tractor;
                    int?    tractorHatID = tractor?.hat.Value?.which.Value;
                    var     saveData     = new CustomSaveBuilding(new Vector2(garage.tileX.Value, garage.tileY.Value), garage.HorseId, tractorHatID, this.GarageBuildingType, this.GetMapName(location), garage.daysOfConstructionLeft.Value);

                    yield return(new GarageMetadata(location, garage, saveData));
                }
            }
        }
Ejemplo n.º 3
0
        /****
        ** Helper methods
        ****/
        /// <summary>Get garages in the given location to save.</summary>
        private IEnumerable <GarageMetadata> GetGarages()
        {
            foreach (BuildableGameLocation location in CommonHelper.GetLocations().OfType <BuildableGameLocation>())
            {
                foreach (Stable stable in location.buildings.OfType <Stable>())
                {
                    if (stable.buildingType.Value != this.GarageBuildingType)
                    {
                        continue;
                    }

                    Tractor tractor      = Utility.findHorse(stable.HorseId) as Tractor;
                    int?    tractorHatID = tractor?.hat.Value?.which;
                    var     saveData     = new CustomSaveBuilding(new Vector2(stable.tileX.Value, stable.tileY.Value), stable.HorseId, tractorHatID, this.GarageBuildingType, this.GetMapName(location), stable.daysOfConstructionLeft.Value);

                    yield return(new GarageMetadata(location, stable, tractor, saveData));
                }
            }
        }