public void TestEmpty() { ShotPatterns patterns = new ShotPatterns(); foreach (ShotPattern shot in patterns) { Assert.Fail("Empty list returned a member anyway."); } }
public void TestOne() { ShotPatterns patterns = ShotPatterns.Create(new ShotPattern(0, Vector2.Zero, Effects.None)); int i = 0; foreach (ShotPattern shot in patterns) { i++; } Assert.AreEqual(i, 1, "Wrong number of shots in iterator."); }
public void TestChange() { ShotPatterns patterns = ShotPatterns.Create(new ShotPattern(0, Vector2.Zero, Effects.None)); ShotPattern p = null; foreach (ShotPattern pattern in patterns) { p = pattern; } foreach (ShotPattern pattern in patterns) { Assert.AreNotSame(p, pattern, "ShotPattern can be edited externally."); } }
public override void Apply() { ShotPatterns upgraded = new ShotPatterns(); foreach (ShotPattern shot in UpgradeTarget.Shots) { if (keepExistingEffects) { shot.Effects |= newEffects; } else { shot.Effects = newEffects; } upgraded = upgraded.Add(shot); } UpgradeTarget.Shots = upgraded; UpgradeTarget.ApplyUpgrade(Type); }
public ShotUpgrade(IGun toUpgrade, ShotPatterns newShotPatterns, bool keepExistingShots, UpgradeType type) : base(toUpgrade, type) { this.newShotPatterns = newShotPatterns; this.keepExistingShots = keepExistingShots; }
public ShotArgs(ShotPatterns s) { this.s = s; }