public void Del(IShieldField field) { switch (field) { case LinearShieldLink link: _linearLinks.Remove(link); break; default: _fields.Remove(field); break; } }
public void Add(IShieldField field) { switch (field) { case LinearShieldLink link: _linearLinks.Add(link); break; default: _fields.Add(field); break; } }
private static bool Impact(ProjectileCE projectile, IShieldField shield, Vector3 position) { var traverse = new Traverse(projectile); var ticksToImpact = traverse.Field("ticksToImpact"); var startingTicksToImpact = traverse.Property("StartingTicksToImpact").GetValue <float>(); // rewind the projectile 1 tick to get the last position before the CheckForCollisionBetween we are in ticksToImpact.SetValue(ticksToImpact.GetValue <int>() + 1); while (shield.Collision(projectile.ExactPosition.Yto0())) { var amount = ticksToImpact.GetValue <int>(); if (amount > startingTicksToImpact) { Log.Message("Unable to find good place to detonate " + projectile.ThingID + ", destroying without detonating"); return(false); } ticksToImpact.SetValue(amount + 1); } impactMethod.Invoke(projectile, new object[] { null }); return(true); }
public abstract void Del(IShieldField field);
public abstract void Add(IShieldField field);
public static bool HostileTo(IShieldField shield, Faction faction, bool invert = false) { return((shield.Faction != faction && shield.Faction.RelationKindWith(faction) == FactionRelationKind.Hostile) != invert); }
public static bool FriendlyTo(IShieldField shield, Faction faction, bool invert = false) { return((shield.Faction == faction || shield.Faction.RelationKindWith(faction) == FactionRelationKind.Ally) != invert); }
public static bool OfFaction(IShieldField shield, Faction faction, bool invert = false) { return(shield.Faction == faction != invert); }
public static bool IsActive(IShieldField shield, bool isActive = true) { return(shield.IsActive() == isActive); }
public static IShieldManager For(IShieldField shield) { return(For(shield.Map, false)); }
public IEnumerable <Map> PresentOnMaps(IShieldField field) { return(_associated.Where(field.PresentOnMap)); }
private static bool Impact(Projectile projectile, IShieldField shield, Vector3 point) { impactMethod.Invoke(projectile, new object[] { null }); return(true); }