private void InvokeFire() { _timer.Dispose(); _timer = null; Fired?.Invoke(_lastSender, _lastArgs); _lastSender = null; _lastArgs = null; }
private void OnDataReceivedWorker() { while (_IsRunning) { try { byte[] data = _BlockingCollection.Take(_CancellationTokenSource.Token); Fired?.Invoke(this, data); } catch (Exception) { } } }
private void GlobalShortcuts_KeyUp(object sender, KeyEventArgs e) { int index = Array.IndexOf(keys, e.Key); if (index >= 0) { if (state.All(f => f)) { Fired?.Invoke(this, EventArgs.Empty); } state[index] = false; } }
public void Update(float dt) { if (Num != -1 && _numTimesFired >= Num) { return; } _timeElapsedSinceLastFire += dt; if (_timeElapsedSinceLastFire > Period) { Fired?.Invoke(this); _numTimesFired += 1; _timeElapsedSinceLastFire = 0; } }
private void FireProjectile() { if (!firedFirstShot) { firedFirstShot = true; } GameObject projectile = Instantiate(projectilePrefab, transform.position, Quaternion.identity) as GameObject; var launchVelocity = fireVelocity * normalizedTrajectory; projectile.GetComponent <Projectile>().launchVelocity = launchVelocity; float angle = Vector2.SignedAngle(Vector2.right, launchVelocity); projectile.transform.rotation = Quaternion.Euler(0, 0, angle); Fired?.Invoke(); }
private IEnumerator ShootLoop() { while (true) { do { if (enemiesInRange.Count < 1) { yield return(new WaitForSeconds(0.1f)); } UpdateTarget(); } while (target == null); target.HealthPrediction -= stats.AttackDamage; animator.SetTrigger("Shoot"); Fired?.Invoke(stats, transform, target); yield return(new WaitForSeconds(1f / stats.AttacksPerSecond)); } }
public Status fire_at(int X, int Y) { Status status = Status.tba; if (!(board[Y, X].status == Status.tba)) { status = Status.miss; } if (board[Y, X].type == Type.Wasser) { board[Y, X].status = Status.miss; } Fired?.Invoke(X, Y, this); status = Status.miss; if (board[Y, X].ship != null) { if (board[Y, X].ship.Lives > 0) { board[Y, X].ship.Lives -= 1; } if (board[Y, X].ship.Lives == 0) { foreach (GameElement g in board[Y, X].ship.positions) { g.status = Status.sunk; Fired?.Invoke(g.X, g.Y, this); } status = Status.sunk; } else { board[Y, X].status = Status.hit; status = Status.hit; Fired?.Invoke(X, Y, this); } } return(status); }
/// <summary> /// Fires the cannon's projectile from the cannon and its projection speed and projectile angle. /// </summary> public void Fire() { // Clear other trajectories foreach (Projectile p in projectiles) { p.RemoveTrajectory(); } // Create a copy of the cannon's projectile Projectile projectile = new Projectile("projectile", Position, Projectile.TextureName, Projectile.Mass, Projectile.RestitutionCoefficient, Projectile.Radius, Projectile.DragCoefficient); // Determine the transformed position to fire the projectile from. projectile.Centre = DetermineFiringPosition(); projectiles.Add(projectile); // Takes into account facing direction Vector2 impulse = projectile.Mass * Speed * new Vector2((int)Facing * MathF.Cos(ProjectionAngle), -MathF.Sin(ProjectionAngle)); // Invoke events Fired?.Invoke(this, new FiringArgs(projectile, impulse)); Triggered?.Invoke(this, new EventArgs()); }
public static void Fire(ODEventType odEventType, object tag) { Fired?.Invoke(new ODEventArgs(odEventType, tag)); }
public void FireEvent(string value) => Fired?.Invoke(this, new StringEventArgs(value));
// Поджигает дерево public void Fire(int power) { state.Fire(this, power); Fired?.Invoke(this, new FireTreeEventArgs()); }
///<summary>Invoke this method when the MySQL data adapter cannot fill a DataTable correctly or reports that it ran successfully.</summary> public static void Fire(DataReaderNullEventArgs e) { Fired?.Invoke(e); }
///<summary>Invoke this method when a crashed table has been detected or reports that it is now OK.</summary> public static void Fire(CrashedTableEventArgs e) { Fired?.Invoke(e); }
protected override void RaiseEvent(Signal <T> signal) { Fired?.Invoke(signal.Data); }
public void FireEvent(ODEventArgs e) { Fired?.Invoke(e); }
public void Shoot() { Firing?.Invoke(this, EventArgs.Empty); Bang?.Invoke(this); Fired?.Invoke(this, new FiredArgs("Bang!")); }
///<summary>Triggers the global Fired event to get called with the passed in ODEventArgs.</summary> public static void Fire(ODEventArgs e) { Fired?.Invoke(e); }