Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShipHullStat" /> class.
 /// </summary>
 /// <param name="hullCategory">The category.</param>
 /// <param name="name">The name.</param>
 /// <param name="imageAtlasID">The image atlas identifier.</param>
 /// <param name="imageFilename">The image filename.</param>
 /// <param name="description">The description.</param>
 /// <param name="size">The size.</param>
 /// <param name="mass">The mass.</param>
 /// <param name="drag">The drag of this hull in Topography.OpenSpace.</param>
 /// <param name="pwrRqmt">The PWR RQMT.</param>
 /// <param name="expense">The expense.</param>
 /// <param name="maxHitPts">The maximum hit PTS.</param>
 /// <param name="damageMitigation">The damage mitigation.</param>
 /// <param name="hullDimensions">The hull dimensions.</param>
 /// <param name="science">The science generated by this hull, if any.</param>
 /// <param name="culture">The culture generated by this hull, if any.</param>
 /// <param name="income">The income generated by this hull, if any.</param>
 public ShipHullStat(ShipHullCategory hullCategory, string name, AtlasID imageAtlasID, string imageFilename, string description,
     float size, float mass, float drag, float pwrRqmt, float expense, float maxHitPts, DamageStrength damageMitigation,
     Vector3 hullDimensions, float science, float culture, float income)
     : base(name, imageAtlasID, imageFilename, description, size, mass, pwrRqmt, expense, maxHitPts, damageMitigation, hullDimensions) {
     HullCategory = hullCategory;
     Drag = drag;
     Science = science;
     Culture = culture;
     Income = income;
 }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShipStat" /> struct.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="mass">The mass.</param>
 /// <param name="maxHitPts">The maximum hit PTS.</param>
 /// <param name="category">The category.</param>
 /// <param name="stance">The stance.</param>
 /// <param name="maxTurnRate">The ship's maximum turn rate in degrees per hour.</param>
 /// <param name="drag">The drag.</param>
 /// <param name="fullStlThrust">The maximum force projected by the STL engines. FullStlSpeed = FullStlThrust / (Mass * Drag).
 /// NOTE: This value uses a Game Hour denominator. It is adjusted in
 /// realtime to a Unity seconds value in EngineRoom.ApplyThrust() using GeneralSettings.HoursPerSecond.</param>
 /// <param name="fullFtlThrust">The maximum force projected by the FTL engines. FullFtlSpeed = FullFtlThrust / (Mass * Drag).
 /// NOTE: This value uses a Game Hour denominator. It is adjusted in
 /// realtime to a Unity seconds value in EngineRoom.ApplyThrust() using GeneralSettings.HoursPerSecond.</param>
 /// <param name="science">The science generated by this ship.</param>
 /// <param name="culture">The culture generated by this ship.</param>
 /// <param name="income">The income generated by this ship.</param>
 /// <param name="expense">The expense consumed by this ship.</param>
 public ShipStat(string name, float mass, float maxHitPts, ShipHullCategory category, ShipCombatStance stance,
     float maxTurnRate, float drag, float fullStlThrust, float fullFtlThrust, float science, float culture,
     float income, float expense)
     : this() {
     Name = name;
     Mass = mass;
     MaxHitPoints = maxHitPts;
     Category = category;
     CombatStance = stance;
     MaxTurnRate = maxTurnRate;
     Drag = drag;
     FullStlThrust = fullStlThrust;
     FullFtlThrust = fullFtlThrust;
     Science = science;
     Culture = culture;
     Income = income;
     Expense = expense;
 }
Exemple #3
0
        protected override void AssignValues(AItemData data) {
            var sData = data as ShipData;
            var accessCntlr = sData.InfoAccessCntlr;

            if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.Culture)) {
                Culture = sData.Culture;
            }
            if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.Defense)) {
                DefensiveStrength = sData.DefensiveStrength;
            }
            if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.Offense)) {
                OffensiveStrength = sData.OffensiveStrength;
            }
            if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.Health)) {
                Health = sData.Health;
            }
            if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.AlertStatus)) {
                AlertStatus = sData.AlertStatus;
            }
            if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.CurrentHitPoints)) {
                CurrentHitPoints = sData.CurrentHitPoints;
            }
            if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.Science)) {
                Science = sData.Science;
            }
            if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.NetIncome)) {
                Income = sData.Income;
                Expense = sData.Expense;
            }
            if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.Name)) {
                Name = sData.Name;
            }
            if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.ParentName)) {
                ParentName = sData.ParentName;
            }
            if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.Position)) {
                Position = sData.Position;
            }
            if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.Owner)) {
                Owner = sData.Owner;
            }
            if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.Category)) {
                Category = sData.HullCategory;
            }
            if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.MaxHitPoints)) {
                MaxHitPoints = sData.MaxHitPoints;
            }
            if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.Mass)) {
                Mass = sData.Mass;
            }
            // SensorRange on an element makes little sense
            ////if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.SensorRange)) {
            ////    SensorRange = sData.SensorRange;
            ////}
            if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.WeaponsRange)) {
                WeaponsRange = sData.WeaponsRange;
            }
            if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.SectorID)) {
                SectorID = sData.SectorID;
            }
            if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.Target)) {
                Target = sData.Target;
            }
            if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.CombatStance)) {
                CombatStance = sData.CombatStance;
            }
            if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.CurrentSpeedSetting)) {
                CurrentSpeedSetting = sData.CurrentSpeedSetting;
            }
            if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.FullSpeed)) {
                FullSpeed = sData.FullSpeedValue;
            }
            if (accessCntlr.HasAccessToInfo(Player, ItemInfoID.MaxTurnRate)) {
                MaxTurnRate = sData.MaxTurnRate;
            }

            __ActualSpeedValue = (Item as IShip_Ltd).ActualSpeedValue_Debug;
        }
    /// <summary>
    /// Gets the power generated by the STL engines when operating at Full capability.
    /// </summary>
    /// <param name="hull">The ship hull.</param>
    /// <returns></returns>
    private float GetFullStlPropulsionPower(ShipHullCategory hullCat) {
        float fastestFullFtlSpeedTgt = TempGameValues.__TargetFtlOpenSpaceFullSpeed; // 40F
        float slowestFullFtlSpeedTgt = fastestFullFtlSpeedTgt * 0.75F;   // this way, the slowest Speed.OneThird speed >= Speed.Slow
        float fullFtlSpeedTgt = UnityEngine.Random.Range(slowestFullFtlSpeedTgt, fastestFullFtlSpeedTgt);
        float hullMass = hullCat.Mass(); // most but not all of the mass of the ship
        float hullOpenSpaceDrag = hullCat.Drag();

        float reqdFullFtlPower = GameUtility.CalculateReqdPropulsionPower(fullFtlSpeedTgt, hullMass, hullOpenSpaceDrag);
        return reqdFullFtlPower / TempGameValues.__StlToFtlPropulsionPowerFactor;
    }
 private float GetEngineMass(ShipHullCategory hullCat) {
     return hullCat.Mass();
 }
    private EnginesStat MakeEnginesStat(ShipHullCategory hullCategory) {
        float maxTurnRate = UnityEngine.Random.Range(TempGameValues.MinimumTurnRate, 270F);
        float singleEngineSize = 10F;
        float singleEngineMass = GetEngineMass(hullCategory);
        float singleEngineExpense = 5F;

        float fullStlPropulsionPower = GetFullStlPropulsionPower(hullCategory);   // FullFtlOpenSpaceSpeed ~ 30-40 units/hour, FullStlSystemSpeed ~ 1.2 - 1.6 units/hour
        return new EnginesStat("EngineName", AtlasID.MyGui, TempGameValues.AnImageFilename, "Description...", fullStlPropulsionPower, maxTurnRate, singleEngineSize, singleEngineMass, singleEngineExpense, TempGameValues.__StlToFtlPropulsionPowerFactor, engineQty: 1);
    }
 private ShipHullStat CreateElementHullStat(ShipHullCategory hullCat, string elementName) {
     float hullMass = hullCat.Mass();
     float drag = hullCat.Drag();
     float science = hullCat.Science();
     float culture = hullCat.Culture();
     float income = hullCat.Income();
     float expense = hullCat.Expense();
     Vector3 hullDimensions = hullCat.Dimensions();
     return new ShipHullStat(hullCat, elementName, AtlasID.MyGui, TempGameValues.AnImageFilename, "Description...", 0F,
         hullMass, drag, 0F, expense, 50F, new DamageStrength(2F, 2F, 2F), hullDimensions, science, culture, income);
 }
Exemple #8
0
 private Vector3 __GetHullDimensions(ShipHullCategory hullCat) {
     Vector3 dimensions;
     switch (hullCat) {  // 10.28.15 Hull collider dimensions increased to encompass turrets, 11.20.15 reduced mesh scale from 2 to 1
         case ShipHullCategory.Frigate:
             dimensions = new Vector3(.02F, .03F, .05F); //new Vector3(.04F, .035F, .10F);
             break;
         case ShipHullCategory.Destroyer:
         case ShipHullCategory.Support:
             dimensions = new Vector3(.06F, .035F, .10F);    //new Vector3(.08F, .05F, .18F);
             break;
         case ShipHullCategory.Cruiser:
         case ShipHullCategory.Investigator:
         case ShipHullCategory.Colonizer:
             dimensions = new Vector3(.09F, .05F, .16F); //new Vector3(.15F, .08F, .30F); 
             break;
         case ShipHullCategory.Dreadnought:
         case ShipHullCategory.Troop:
             dimensions = new Vector3(.12F, .05F, .25F); //new Vector3(.21F, .07F, .45F);
             break;
         case ShipHullCategory.Carrier:
             dimensions = new Vector3(.10F, .06F, .32F); // new Vector3(.20F, .10F, .60F); 
             break;
         case ShipHullCategory.Fighter:
         case ShipHullCategory.Scout:
         case ShipHullCategory.None:
         default:
             throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(hullCat));
     }
     float radius = dimensions.magnitude / 2F;
     D.Warn(radius > TempGameValues.ShipMaxRadius, "Ship {0}.Radius {1:0.####} > MaxRadius {2:0.##}.", hullCat.GetValueName(), radius, TempGameValues.ShipMaxRadius);
     return dimensions;
 }
 public IList<ShipData> GetData(ShipHullCategory category) {
     return _composition[category];
 }