private void OnGoingTooFar(Ammo ammo) { Ammo.Remove(ammo); if (IsWaiting && Ammo.Count == 0) { IsWaiting = false; } }
private void OnHit(Ammo ammo) { Ammo.Remove(ammo); if (OnShoot != null) { OnShoot(this); } }
private void CreateNewAmmo() { Vector2 oneStep = OwnerShip.NextPosition - Position; Radians = (float)Math.Atan2(oneStep.Y, oneStep.X) + (90 * (float)Math.PI / 180); oneStep.Normalize(); Velocity = oneStep * (SpeedMod / 2f); Ammo temp = new Ammo(Texture, Position, Origin, Velocity, SpeedMod, Radians, OwnerShip.NextPosition); temp.OnHit += new Ammo.OnHitHandler(OnHit); temp.OnGoingTooFar += new Ammo.OnGoingTooFarHandler(OnGoingTooFar); Ammo.Add(temp); }