/// <summary> /// Initializes a new instance of the <see cref="SystemCreatorEditorSettings" /> class for SystemCreators that have preset values. /// </summary> /// <param name="presetStarCat">The preset star cat.</param> /// <param name="presetPlanetCats">The preset planet cats.</param> /// <param name="presetMoonCats">The preset moon cats.</param> /// <param name="desirability">The desirability.</param> public SystemCreatorEditorSettings(StarCategory presetStarCat, IList<PlanetoidCategory> presetPlanetCats, IList<PlanetoidCategory[]> presetMoonCats, SystemDesirability desirability) { PresetStarCategory = presetStarCat; IsCompositionPreset = true; if (presetPlanetCats.Count > TempGameValues.TotalOrbitSlotsPerSystem - 1) { D.Error("{0} should be <= {1}.", presetPlanetCats.Count, TempGameValues.TotalOrbitSlotsPerSystem - 1); } PresetPlanetCategories = presetPlanetCats; PresetMoonCategories = presetMoonCats; Desirability = desirability; }
protected void EarnReputation(Company company, StarCategory projectWeight, ProjectResult projectResult) { var resultValue = 0; switch(projectResult) { case ProjectResult.Completed: resultValue = 2; break; case ProjectResult.CompletedWithExtension: resultValue = 1; break; } var weightValue = (int)projectWeight - 1; checked { company.Reputation.EarnedStars += weightValue * resultValue; company.Reputation.PossibleStars += weightValue * 2; } }
private StarStat MakeRandomStarStat(StarCategory category, SystemDesirability desirability, out float systemOrbitSlotsStartRadius) { float radius = TempGameValues.StarRadius; float closeOrbitInnerRadius = radius + 2F; systemOrbitSlotsStartRadius = closeOrbitInnerRadius + TempGameValues.ShipCloseOrbitSlotDepth; int capacity = 100; // TODO vary by desirability return new StarStat(category, radius, closeOrbitInnerRadius, capacity, CreateRandomResourceYield(desirability, ResourceCategory.Common, ResourceCategory.Strategic)); }
private string MakeAndRecordStarDesign(StarCategory cat, SystemDesirability desirability, out float systemOrbitSlotsStartRadius) { string designName = GetUniqueDesignName(cat.GetValueName()); StarStat stat = MakeRandomStarStat(cat, desirability, out systemOrbitSlotsStartRadius); StarDesign design = new StarDesign(designName, stat); _gameMgr.CelestialDesigns.Add(design); return designName; }
private SystemCreator DeployAndConfigureCreatorTo(string systemName, Vector3 location, SystemDesirability systemDesirability, StarCategory starCat, IList<PlanetoidCategory> planetCatsByPlanetIndex) { float systemOrbitSlotsStartRadius; string starDesignName = MakeAndRecordStarDesign(starCat, systemDesirability, out systemOrbitSlotsStartRadius); Stack<OrbitData> innerOrbitSlots; Stack<OrbitData> goldilocksOrbitSlots; Stack<OrbitData> outerOrbitSlots; GenerateSystemOrbitSlots(systemOrbitSlotsStartRadius, out innerOrbitSlots, out goldilocksOrbitSlots, out outerOrbitSlots); OrbitData settlementOrbitSlot = goldilocksOrbitSlots.Pop(); D.AssertNotNull(settlementOrbitSlot); IList<int> unassignedPlanetIndices; IList<OrbitData> planetOrbitSlots; IList<string> planetDesignNames = MakePlanetDesignsAndOrbitSlots(planetCatsByPlanetIndex, systemDesirability, innerOrbitSlots, goldilocksOrbitSlots, outerOrbitSlots, out planetOrbitSlots, out unassignedPlanetIndices); IList<PlanetoidCategory[]> moonCatsByPlanetIndex = GetRandomMoonCats(planetCatsByPlanetIndex); if (unassignedPlanetIndices.Count > Constants.Zero) { // one or more planets could not be assigned an orbit slot and design so eliminate any moons for that planet foreach (var pIndex in unassignedPlanetIndices) { moonCatsByPlanetIndex[pIndex] = Enumerable.Empty<PlanetoidCategory>().ToArray(); planetCatsByPlanetIndex[pIndex] = default(PlanetoidCategory); } } IList<OrbitData[]> moonOrbitSlots; IList<string[]> moonDesignNames = MakeMoonDesignsAndOrbitSlots(planetCatsByPlanetIndex, moonCatsByPlanetIndex, systemDesirability, out moonOrbitSlots); SystemCreatorConfiguration config = new SystemCreatorConfiguration(systemName, starDesignName, settlementOrbitSlot, planetDesignNames, planetOrbitSlots, moonDesignNames, moonOrbitSlots); SystemCreator creator = _systemFactory.MakeCreatorInstance(location); creator.Configuration = config; return creator; }
/// <summary> /// Initializes a new instance of the <see cref="StarData"/> class. /// </summary> /// <param name="category">The category of Star.</param> /// <param name="name">The name.</param> /// <param name="parentName">Name of the parent.</param> public StarData(StarCategory category, string name, string parentName) : base(name, parentName) { Category = category; }