示例#1
0
 public override void Trigger()
 {
     if (FactionManager.CanAfford(ParentShip.FactionNumber, 0, 150) && ParentShip.GetOffenseProgress() == 0)
     {
         Triggered = true;
         PauseTime = 0;
     }
     base.Trigger();
 }
 public override void Update(GameTime gameTime)
 {
     if (ParentShip.Dead && ParentShip.Attacking && FactionManager.CanAfford(ParentShip.FactionNumber, 0, PlayerShip.GetRespawnCost()))
     {
         PayToRespawnAlpha += gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f * AlphaChange;
         if (PayToRespawnAlpha > 1)
         {
             PayToRespawnAlpha = 1;
         }
     }
     else
     {
         PayToRespawnAlpha -= gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f * AlphaChange;
         if (PayToRespawnAlpha < 0)
         {
             PayToRespawnAlpha = 0;
         }
     }
     base.Update(gameTime);
 }
        public override bool APress(PlayerShip Ship, bool APrevious)
        {
            if (!APrevious)
            {
                {
                    int CardCost = CardCellsCost;
                    if (FactionCostIncreases.ContainsKey(Ship.FactionNumber))
                    {
                        CardCost += CardCellsCostIncrease * FactionCostIncreases[Ship.FactionNumber];
                    }

                    if (FactionManager.CanAfford(Ship.FactionNumber, CardCost) && Ship.CanPlaceTurret(TurretSize))
                    {
                        if (FactionCostIncreases.ContainsKey(Ship.FactionNumber))
                        {
                            FactionCostIncreases[Ship.FactionNumber]++;
                        }
                        else
                        {
                            FactionCostIncreases.Add(Ship.FactionNumber, 1);
                        }

                        FactionManager.AddCells(Ship.FactionNumber, -CardCost);
                        UnitTurret u = (UnitTurret)GetUnit(Ship.FactionNumber);
                        u.MyCard = this;
                        Ship.PlaceTurret(u);
                        return(true);
                    }
                    else
                    {
                        RedFlashAlpha = 1;
                    }
                }
            }
            return(false);
        }
        public override bool TriggerAsCurrent(BasicMarker m)
        {
            if (BasicMarker.SelectSound != null)
            {
                BasicMarker.SelectSound.Play(BasicMarker.SelectVolume, 0, 0);
            }

            Faction f = FactionManager.Factions[ParentShip.FactionNumber];

            FlashAlpha = 1;

            if (FactionManager.GetFaction(ParentShip.FactionNumber).PickingCards)
            {
                if (Selected)
                {
                    for (int i = 0; i < f.Cards.Count; i++)
                    {
                        if (f.Cards[i] == MyCard)
                        {
                            f.Cards[i] = null;
                            Selected   = false;
                            return(true);
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < f.Cards.Count; i++)
                    {
                        if (f.Cards[i] == null)
                        {
                            f.Cards[i] = MyCard;
                            Selected   = true;
                            break;
                        }
                    }

                    if (!Selected)
                    {
                        f.Cards.Add(MyCard);
                        Selected = true;
                    }

                    if (Faction.MaxCards == f.Cards.Count)
                    {
                        for (int i = 0; i < f.Cards.Count; i++)
                        {
                            if (f.Cards[i] == null)
                            {
                                return(true);
                            }
                        }

                        ParentShip.ReadyMenu();
                    }
                }
            }
            else
            {
                int CardCost = MyCard.CardCellsCost;
                if (MyCard.FactionCostIncreases.ContainsKey(ParentShip.FactionNumber))
                {
                    CardCost += MyCard.CardCellsCostIncrease * MyCard.FactionCostIncreases[ParentShip.FactionNumber];
                }

                if (FactionManager.CanAfford(ParentShip.FactionNumber, CardCost) && ParentShip.CanPlaceTurret(MyCard.TurretSize))
                {
                    if (MyCard.FactionCostIncreases.ContainsKey(ParentShip.FactionNumber))
                    {
                        MyCard.FactionCostIncreases[ParentShip.FactionNumber]++;
                    }
                    else
                    {
                        MyCard.FactionCostIncreases.Add(ParentShip.FactionNumber, 1);
                    }

                    FactionManager.AddCells(ParentShip.FactionNumber, -CardCost);
                    UnitTurret u = (UnitTurret)MyCard.GetUnit(ParentShip.FactionNumber);
                    u.MyCard = MyCard;
                    ParentShip.PlaceTurret(u);
                    //ParentFrame.DeActivate();
                }
                else
                {
                    ErrorAlpha = 1;
                }
            }

            return(base.TriggerAsCurrent(m));
        }
 public override bool CanInteract(PlayerShip p)
 {
     return((FactionManager.CanAfford(p.FactionNumber, FactionManager.GetMiningPlatformCost(p.FactionNumber)) || !p.PlacedStartingMineralRock) && miningPlatform == null && FactionManager.CanBuildMiningPlatform(p.FactionNumber));
 }
 public override bool CanInteract(PlayerShip p)
 {
     return(FactionManager.CanAfford(p.FactionNumber, UpgradeCost));
 }