예제 #1
0
    public void QuadrantDestroyed(ShipQuadrant quad, AttachedWeapon weapon, float damage, bool ignoreShields, bool ignoreArmor, bool ignoreArmorRating)
    {
        if (quad == CenterSection)
        {
            if (Destroyed)
            {
                return;
            }
            weapon.GetKill(CurrentUnit);
            Destroyed = true;
            if (fleetData != null)
            {
                fleetData.RecalculateStats();
            }

            if (CurrentUnit != null)
            {
                (CurrentUnit as Ship).Die();
            }
            CurrentUnit = null;
            return;
        }
        else if (CurrentUnit != null)
        {
            CurrentUnit.AttachFireDamage((CurrentUnit as Ship).GetDamageHardPoint(), designData.Hull.ExplosionScale);
            if (damage > 0)
            {
                CenterSection.TakeDamage(weapon, CurrentUnit.transform.position, damage, ignoreShields, ignoreArmor, ignoreArmorRating);
            }
        }

        CalculateEngines();
    }
예제 #2
0
    public ShipData(ShipDesignData shipDesignData)
    {
        designData  = shipDesignData;
        DisplayName = designData.Design.Name;

        ForeSection      = new ShipQuadrant(this, designData.ForeQuadrant, QuadrantTypes.Fore);
        AftSection       = new ShipQuadrant(this, designData.AftQuadrant, QuadrantTypes.Aft);
        StarboardSection = new ShipQuadrant(this, designData.StarboardQuadrant, QuadrantTypes.Starboard);
        PortSection      = new ShipQuadrant(this, designData.PortQuadrant, QuadrantTypes.Port);
        CenterSection    = new ShipQuadrant(this, designData.CenterQuadrant, QuadrantTypes.Center);

        //Add Fighters
        foreach (KeyValuePair <FighterDefinition, int> keyVal in shipDesignData.Fighters)
        {
            Fighters.Add(new FighterComplement(keyVal.Key, keyVal.Value));
        }
        foreach (KeyValuePair <FighterDefinition, int> keyVal in shipDesignData.HeavyFighters)
        {
            HeavyFighters.Add(new FighterComplement(keyVal.Key, keyVal.Value));
        }
        foreach (KeyValuePair <FighterDefinition, int> keyVal in shipDesignData.AssaultPods)
        {
            AssaultPods.Add(new FighterComplement(keyVal.Key, keyVal.Value));
        }

        fuelMax         = designData.Fuel;
        fuel            = fuelMax;
        ammo            = designData.Ammo;
        ammoMax         = designData.Ammo;
        power           = designData.PowerStorage;
        powerMax        = designData.PowerStorage;
        crew            = designData.Crew;
        crewMax         = designData.Crew;
        supplies        = designData.Supplies;
        suppliesMax     = designData.Supplies;
        troops          = designData.Troops;
        troopsMax       = designData.Troops;
        commandPoints   = designData.CommandPoints;
        mass            = designData.Mass;
        powerGenerated  = designData.PowerGenerated;
        FTLSpeed        = designData.FTLSpeed;
        research        = designData.Research;
        mining          = designData.Mining;
        repair          = designData.Repair;
        ammoGenerated   = designData.AmmoGenerated;
        transporter     = designData.Transporter;
        medical         = designData.Medical;
        cloakingPower   = designData.CloakingPower;
        stealth         = designData.Stealth;
        boardingDefense = designData.BoardingDefense;
        colonies        = designData.Colonies;
        diplomacy       = designData.Diplomacy;
        sensor          = designData.Sensor;
        longRangeSensor = designData.LongRangeSensor;
        advancedSensor  = designData.AdvancedSensor;

        CalculateEngines();
        AttackDirection = designData.Design.attackDirection;
        AttackStyle     = designData.Design.attackStyle;
        if (designData.Design.attackRange != -1)
        {
            attackRange = designData.Design.attackRange;
        }
        else
        {
            attackRange = designData.maxRange;
        }

        SetCrewEffeciency();
    }