public Intersects ( |
||
boundBox | ||
Résultat | bool |
private void AttackSword() { int leftX = FacingLeft ? BoundBox.Left - 15 : BoundBox.Right; ShapeAABB bound = new ShapeAABB(new Rectangle(leftX, (int)BoundBox.Top + 5, 15, PlayerHeight - 6)); List<Vector2> newTiles = RectangleHitsTiles(bound); foreach (Vector2 v in newTiles) { BlockData block = GameServer.GetBlockAt(v.X, v.Y); if (block.ID != 0) { ShapeAABB bound2 = new ShapeAABB(block.Block.GetBlockBoundBox((int)v.X, (int)v.Y)); if (bound2.Intersects(bound)) { GameServer.HurtBlock((int)v.X, (int)v.Y, 2); } } } foreach (NetworkPlayer player in GameServer.NetworkPlayers) { if (player == this) continue; if (player.PlayerTeam == PlayerTeam) continue; if (player.BoundBox.Intersects(bound) || player.BoundBox.Contains(bound) || bound.Contains(player.BoundBox)) { player.HurtPlayer(1); player.EntityVelocity.Y = -4; player.EntityVelocity.X = FacingLeft ? -5 : 5; } } }