public AddArgs(Point3D position, Vector3D? angularVelocity, ItemAddedHandler itemAdded) { this.Position = position; this.AngularVelocity = angularVelocity; this.ItemAdded = itemAdded; }
public AddArgs(Point3D position, Vector3D?angularVelocity, ItemAddedHandler itemAdded) { this.Position = position; this.AngularVelocity = angularVelocity; this.ItemAdded = itemAdded; }
public void EmitOnItemAdded(Item item, int amount) { ItemAddedHandler handler = OnItemAdded; if (handler != null) { handler(this, new ItemEventArgs(item, amount)); } GameEventsLogger.LogItemAdded(this, item, amount); }
public AddBotArgs(Point3D position, Vector3D? angularVelocity, ItemAddedHandler itemAdded, BotDNA bot, int level, Point3D homingPoint, double homingRadius, WeaponDNA attachedWeapon = null, WeaponDNA[] inventoryWeapons = null) : base(position, angularVelocity, itemAdded) { this.Bot = bot; this.Level = level; this.HomingPoint = homingPoint; this.HomingRadius = homingRadius; this.AttachedWeapon = attachedWeapon; this.InventoryWeapons = inventoryWeapons; }
public AddBotArgs(Point3D position, Vector3D?angularVelocity, ItemAddedHandler itemAdded, BotDNA bot, int level, Point3D homingPoint, double homingRadius, WeaponDNA attachedWeapon = null, WeaponDNA[] inventoryWeapons = null) : base(position, angularVelocity, itemAdded) { this.Bot = bot; this.Level = level; this.HomingPoint = homingPoint; this.HomingRadius = homingRadius; this.AttachedWeapon = attachedWeapon; this.InventoryWeapons = inventoryWeapons; }
internal CollectorPump(Collector <T> collector, ItemAddedHandler pumpOutput, bool openPump = false) { Collector = collector; Counter = 0; IsClosed = false; CollectorAction = (item, itemnumber, last) => Sucker(); collector.ItemAddedApproved += (item, itemnumber, last) => LastReceived = last; //Last listener ItemReceived += pumpOutput; if (openPump) { OpenPump(); } }
/// <summary> /// Waits for arrival of an item for <param name="timeout"> milliseconds. </param> /// </summary> /// <param name="comparer">The comparator for indentifying the wanted item</param> /// <param name="timeout">The time in milliseconds to wait. set it to -1 for infinite</param> /// <returns></returns> public T WaitFor(CompareItems comparer, int timeout = -1) //todo test it { T res = default(T); //ignore default(T), it doesnt matter anyway var firstOrDefault = this.FirstOrDefault(t => comparer(t)); if (firstOrDefault != null && firstOrDefault.Equals(default(T)) == false) { return(firstOrDefault); } //not found.. wait for it. var waiter = new ManualResetEventSlim(false); var itemAddedHandler = new ItemAddedHandler(item => { if (comparer(item)) { res = item; waiter.Set(); } }); ItemAdded += itemAddedHandler; var fod = this.FirstOrDefault(t => comparer(t)); if (fod != null && fod.Equals(default(T)) == false) { ItemAdded -= itemAddedHandler; return(fod); } if (timeout > -1) { waiter.Wait(timeout); } else { waiter.Wait(); } return(res); }
public AddWeaponArgs(Point3D position, Vector3D? angularVelocity, ItemAddedHandler itemAdded, WeaponDNA weapon) : base(position, angularVelocity, itemAdded) { this.Weapon = weapon; }
public AddWeaponArgs(Point3D position, Vector3D?angularVelocity, ItemAddedHandler itemAdded, WeaponDNA weapon) : base(position, angularVelocity, itemAdded) { this.Weapon = weapon; }