Пример #1
0
        private void PerformShipDestruction(Action callback, bool isFled = false)
        {
            IsDestroyed = true;

            Roster.DestroyShip(this.GetTag());

            foreach (var pilotAbility in PilotAbilities)
            {
                pilotAbility.DeactivateAbility();
            }

            foreach (var upgrade in UpgradeBar.GetUpgradesOnlyFaceup())
            {
                foreach (var upgradeAbility in upgrade.UpgradeAbilities)
                {
                    upgradeAbility.DeactivateAbility();
                }
            }

            if (OnShipIsDestroyed != null)
            {
                OnShipIsDestroyed(this, isFled);
            }
            if (OnDestroyedGlobal != null)
            {
                OnDestroyedGlobal(this, isFled);
            }

            Triggers.ResolveTriggers(TriggerTypes.OnShipIsDestroyed, callback);
        }
Пример #2
0
        public List <IShipWeapon> GetAllWeapons()
        {
            List <IShipWeapon> allWeapons = new List <IShipWeapon>
            {
                PrimaryWeapon
            };

            foreach (var upgrade in UpgradeBar.GetUpgradesOnlyFaceup())
            {
                IShipWeapon secondaryWeapon = upgrade as IShipWeapon;
                if (secondaryWeapon != null)
                {
                    allWeapons.Add(secondaryWeapon);
                }
            }

            return(allWeapons);
        }
Пример #3
0
        // ATTACK TYPES

        public int GetAnotherAttackTypesCount()
        {
            int result = 0;

            foreach (var upgrade in UpgradeBar.GetUpgradesOnlyFaceup())
            {
                IShipWeapon secondaryWeapon = upgrade as IShipWeapon;
                if (secondaryWeapon != null)
                {
                    if (secondaryWeapon.IsShotAvailable(Selection.AnotherShip))
                    {
                        result++;
                    }
                }
            }

            return(result);
        }
Пример #4
0
        public void DeactivateAllAbilities()
        {
            foreach (var shipAbility in ShipAbilities)
            {
                shipAbility.DeactivateAbility();
            }

            foreach (var pilotAbility in PilotAbilities)
            {
                pilotAbility.DeactivateAbility();
            }

            foreach (var upgrade in UpgradeBar.GetUpgradesOnlyFaceup())
            {
                foreach (var upgradeAbility in upgrade.UpgradeAbilities)
                {
                    upgradeAbility.DeactivateAbility();
                }
            }
        }