protected virtual void OnCollisionHandle(ProjectileCollisionArgs e) { EventHandler<ProjectileCollisionArgs> handler = OnCollision; if (handler != null) { handler(this, e); } }
public void Update(GameTime gameTime, GraphicsDeviceManager graphics) { ProjectileCollisionArgs P = null; Position += Speed; int MaxX = graphics.GraphicsDevice.Viewport.Width - Skin.Width; int MinX = 0; int MaxY = graphics.GraphicsDevice.Viewport.Height - Skin.Height; int MinY = 0; if (Position.X > MaxX || Position.X < MinX || Position.Y > MaxY || Position.Y < MinY) { P = new ProjectileCollisionArgs(this.Position); } if (P != null) { OnCollisionHandle(P); } }
private void OnCollidePre(object sender, ProjectileCollisionArgs e) { OnCollide((Projectile)sender, e); }
public abstract void OnCollide(Projectile P, ProjectileCollisionArgs e);