public bool IsCollided(Shot shot, Room room) { var intersectionDeter = new IntersectionDeterminant(); var border = room.Border; if (intersectionDeter.IsIntersected(shot.Form, new RectangleF(room.Form.Left, room.Form.Top, border.Width, room.Form.Height))) { return true; } if (intersectionDeter.IsIntersected(shot.Form, new RectangleF(room.Form.Left, room.Form.Top, room.Form.Width, -border.Height))) { return true; } if (intersectionDeter.IsIntersected(shot.Form, new RectangleF(room.Form.Right - border.Width, room.Form.Top, border.Width, room.Form.Height))) { return true; } if (intersectionDeter.IsIntersected(shot.Form, new RectangleF(room.Form.Left, room.Form.Bottom + border.Height, room.Form.Width, -border.Height))) { return true; } return false; }
public void Draw(Shot shot) { GL.BindTexture(TextureTarget.Texture2D, _textures[shot.Texture]); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); new RectangleDrawer().Draw(shot.Form); GL.Disable(EnableCap.Blend); }
public void Shoot(Room room, Shot shot) { if (_canShoot) { room.Shots.Add(shot); _canShoot = false; var timer = new Timer(_attackSpeed); timer.AutoReset = false; timer.Elapsed += OnTimedEvent; timer.Start(); } }
public bool IsCollided(Shot shot, Enemy enemy) { var intersectionDeter = new IntersectionDeterminant(); return(intersectionDeter.IsIntersected(shot.Form, enemy.Form)); }
public bool IsCollided(Shot shot, Player player) { var intersectionDeter = new IntersectionDeterminant(); return(intersectionDeter.IsIntersected(shot.Form, player.Form)); }
private void ShotPlayerHandle(Shot shot, Player player) { player.TakeDamage(shot.Damage); shot.IsRemoved = true; }
private void ShotEnemyHandle(Shot shot, Enemy enemy) { enemy.TakeDamage(shot.Damage); shot.IsRemoved = true; }
private void ShotBorderHandle(Shot shot, Room room) { shot.IsRemoved = true; }
private static bool ShotIsRemoved(Shot shot) { return (shot.Range <= 0 || shot.IsRemoved); }
public bool IsCollided(Shot shot, Player player) { var intersectionDeter = new IntersectionDeterminant(); return intersectionDeter.IsIntersected(shot.Form, player.Form); }
public bool IsCollided(Shot shot, Enemy enemy) { var intersectionDeter = new IntersectionDeterminant(); return intersectionDeter.IsIntersected(shot.Form, enemy.Form); }