コード例 #1
0
 public ControlableWave(
     LifeSpan lifeTime,
     float mass,
     PhysicsState physicsState, float initialRadius,
     float expansionRate,
     int[] colors,
     int primaryColor,
     ShipMovementInfo movementInfo,
     ShipState shipState,
     FactionInfo factionInfo,
     ControlableSounds controlableSounds)
     : base(
         lifeTime,
         mass,
         physicsState,
         initialRadius,
         expansionRate)
 {
     this.shipState                        = shipState;
     this.movementInfo                     = movementInfo;
     this.factionInfo                      = factionInfo;
     this.controlableSounds                = controlableSounds;
     this.attachedEffectCollection         = new EffectCollection();
     this.CollisionState.GenerateRayEvents = true;
     this.colors       = colors;
     this.primaryColor = primaryColor;
 }
コード例 #2
0
        public List <FactionInfo> GetAllOfDiplomacy(FactionInfo faction, FactionDiplomacy diplomacy)
        {
            List <FactionInfo> returnvalue = new List <FactionInfo>();
            int dval = (int)diplomacy;
            FactionDiplomacy ovalue;

            for (int other = 0; other < factioncount; ++other)
            {
                if (faction.factionNumber != other)
                {
                    long key = GetDiplomacyKey(faction.factionNumber, other);
                    if (factionDiplomacies.TryGetValue(key, out ovalue))
                    {
                        if ((dval & (int)ovalue) == dval)
                        {
                            returnvalue.Add(new FactionInfo(other, this));
                        }
                    }
                    else
                    {
                        factionDiplomacies[key] = FactionDiplomacy.Neutral;
                        if ((dval & (int)FactionDiplomacy.Neutral) == dval)
                        {
                            returnvalue.Add(new FactionInfo(other, this));
                        }
                    }
                }
            }
            return(returnvalue);
        }
コード例 #3
0
 public override void OnCreation(GameResult gameResult, FactionInfo factionInfo)
 {
     if (created)
     {
         return;
     }
     created = true;
     base.OnCreation(gameResult, factionInfo);
     actions.OnCreation(gameResult, this);
     if (subShips != null)
     {
         int length = subShips.Length;
         for (int pos = 0; pos < length; ++pos)
         {
             subShips[pos].OnCreation(gameResult, factionInfo);
             subShips[pos].OnHyperShipCreation(gameResult, this);
         }
     }
     if (aIInfo != null)
     {
         aIInfo.OnSourceCreation(gameResult, this);
     }
     if (weaponInfo != null)
     {
         OnCreation(gameResult, this, new ReMasters.SuperMelee.Actions.NullAction());
     }
 }
コード例 #4
0
 void AddAIClone(GameResult gameResult, IShip newShip2, FactionInfo factionInfo)
 {
     newShip2.Current.Position.Linear += Vector2D.FromLengthAndAngle(900, (float)rand.NextDouble());
     newShip2.SetAllPositions();
     newShip2.AddControler(null, new ComplexAIControler());
     newShip2.OnCreation(gameResult, factionInfo);
     SetTarget(newShip2);
 }
コード例 #5
0
        void AddAIClone(GameResult gameResult, FactionInfo faction, IShip target)
        {
            IShip ship = GetNewShip(faction);

            ship.Current.Position.Linear += Vector2D.FromLengthAndAngle(900 * rand.Next(1, 3), (float)rand.NextDouble());
            ship.SetAllPositions();
            ship.AddControler(null, new ComplexAIControler());
            data.AddShip(gameResult, ship, faction);
            //ship.Target = target;
        }
コード例 #6
0
 public virtual void OnCreation(GameResult gameResult, IWeapon host, IWeaponsLogic parentWeapon)
 {
     this.host         = host;
     this.parentWeapon = parentWeapon;
     this.source       = parentWeapon.Source;
     this.actionSource = parentWeapon.ActionSource;
     this.target       = parentWeapon.ActionSource.Target;
     this.factionInfo  = new FactionInfo(source.FactionInfo);
     this.effectCollection.OnCreation(source, this);
     //this.effectsWho = TargetingInfo.Merge(effectsWho, effectCollection.EffectsWho);
 }
コード例 #7
0
        public IShip GetNewShip(FactionInfo info)
        {
            IShip ship = null;

            if (info.FactionNumber == 1)
            {
                lock (player1ShipSelection)
                {
                    if (player1ShipSelection.ShipsLeft == 0)
                    {
                        MessageBox.Show("Player 1 Lost!");
                        Environment.Exit(0);
                    }
                    ship = player1ShipSelection.GetNextShip();
                }
            }
            if (info.FactionNumber == 2)
            {
                lock (player2ShipSelection)
                {
                    if (player2ShipSelection.ShipsLeft == 0)
                    {
                        MessageBox.Show("Player 2 Lost!");
                        Environment.Exit(0);
                    }
                    ship = player2ShipSelection.GetNextShip();
                }
            }
            if (ship != null)
            {
                ship.Current.Position = new ALVector2D(
                    (float)(rand.NextDouble() * MathHelper.TWO_PI),
                    (float)(rand.NextDouble() * -SuperMeleeData.ArenaSize),
                    (float)(rand.NextDouble() * -SuperMeleeData.ArenaSize));
                ship.SetAllPositions();
            }
            return(ship);

            /*
             * lock (shipSelector)
             * {
             *  shipSelector.Text = info.FactionName + " Selection";
             *  shipSelector.ShowDialog();
             *  if (shipSelector.CurrentLoader != null)//shipSelector.lvShips.SelectedItems.Count > 0)
             *  {
             *      IShip rv = shipSelector.CurrentLoader.Ship;
             *      rv.Current = state;
             *      rv.SetAllPositions();
             *      return rv;
             *
             *  }
             *  return null;
             * }*/
        }
コード例 #8
0
 private Predicate <IControlable> CreatePredicate(TargetingInfo targetingInfo)
 {
     return
         (delegate(IControlable possibleTarget)
     {
         return
         possibleTarget.IsTargetable &&
         targetingInfo.MeetsRequirements(FactionInfo.GetTargetingType(host, possibleTarget));
         //  GetTargetingType(possibleTarget));
     });
 }
コード例 #9
0
 public WeaponsLogic(WeaponsLogic copy)
 {
     this.effectCollection = new EffectCollection(copy.effectCollection);
     this.actionSource     = copy.actionSource;
     this.source           = copy.source;
     this.parentWeapon     = copy.parentWeapon;
     this.target           = copy.target;
     this.factionInfo      = copy.factionInfo;
     this.effectsWho       = copy.effectsWho;
     this.host             = copy.host;
     this.solidHost        = copy.solidHost;
 }
コード例 #10
0
        public FactionDiplomacy GetDiplomacy(FactionInfo first, FactionInfo second)
        {
            long             key = GetDiplomacyKey(first.factionNumber, second.factionNumber);
            FactionDiplomacy returnvalue;

            if (factionDiplomacies.TryGetValue(key, out returnvalue))
            {
                return(returnvalue);
            }
            else
            {
                return(factionDiplomacies[key] = FactionDiplomacy.Neutral);
            }
        }
コード例 #11
0
        public bool IsDiplomacy(FactionInfo first, FactionInfo second, FactionDiplomacy diplomacy)
        {
            long             key = GetDiplomacyKey(first.factionNumber, second.factionNumber);
            FactionDiplomacy returnvalue;
            int dval = (int)diplomacy;

            if (factionDiplomacies.TryGetValue(key, out returnvalue))
            {
                return((dval & (int)(returnvalue)) == dval);
            }
            else
            {
                return((dval & (int)(factionDiplomacies[key] = FactionDiplomacy.Neutral)) == dval);
            }
        }
コード例 #12
0
 public virtual void OnCreation(GameResult gameResult, FactionInfo factionInfo)
 {
     this.targetRetriever = new TargetRetriever();
     this.targetRetriever.OnSourceCreation(this);
     this.factionInfo = factionInfo;
     this.SetAllPositions();
     this.controlableSounds.Created.Play();
     controlers.OnCreation(gameResult, this);
     if (controlHandler != null)
     {
         controlHandler.OnCreation(this);
     }
     attachedEffectCollection.OnCreation(gameResult, this);
     created = true;
     gameResult.AddControlable(this);
 }
コード例 #13
0
 public virtual void OnCreation(GameResult gameResult, IWeapon host, IShip source, IAction actionSource)
 {
     this.host         = host;
     this.source       = source;
     this.actionSource = actionSource;
     this.target       = actionSource.Target;
     this.parentWeapon = null;
     if (source != null)
     {
         this.factionInfo = new FactionInfo(source.FactionInfo);
     }
     else
     {
         this.factionInfo = new FactionInfo(solidHost.FactionInfo);
     }
     this.effectCollection.OnCreation(source, this);
     this.effectsWho = TargetingInfo.Merge(effectsWho, effectCollection.EffectsWho);
 }
コード例 #14
0
 public void AddShip(GameResult gameResult, IShip ship, FactionInfo factionInfo)
 {
     if (ship == null)
     {
         return;
     }
     statusBoxs.Add(new StatusBox(ship));
     ship.OnCreation(gameResult, factionInfo);
     ship.Killed += new EventHandler(OnShipsDeath);
     if (ship.SubShips != null)
     {
         foreach (IShip subShip in ship.SubShips)
         {
             if (!subShip.IsExpired)
             {
                 subShip.Killed += new EventHandler(OnShipsDeath);
             }
         }
     }
     SetTarget(ship);
 }
コード例 #15
0
 public bool CanEffect(IControlable controlable)
 {
     return(effectsWho.IsAll ||
            effectsWho.MeetsRequirements(FactionInfo.GetTargetingType(Source, controlable)));
 }
コード例 #16
0
 public void SetDiplomacy(FactionInfo first, FactionInfo second, FactionDiplomacy diplomacy)
 {
     factionDiplomacies[GetDiplomacyKey(first.factionNumber, second.factionNumber)] = diplomacy;
 }
コード例 #17
0
 public FactionInfo(FactionInfo info)
 {
     this.factionNumber     = info.factionNumber;
     this.factionCollection = info.factionCollection;
 }