public void SwapBack() { if (Swapping) { Vector2 tmpPos = Position; Position = _swappedEnemy.Position + new Vector2(0, _swappedEnemy.Dimension.Y / 2 * _swappedEnemy.BoundingBoxOffset.W - Dimension.Y / 2); _swappedEnemy.Position = tmpPos + new Vector2(0, Dimension.Y / 2 * BoundingBoxOffset.W - _swappedEnemy.Dimension.Y / 2); GameGlobals.PassEffect(new WindEffect(this, new Vector2(Dimension.Y * 1.5f, Dimension.Y * 1.5f))); GameGlobals.PassEffect(new WindEffect(_swappedEnemy, new Vector2(Dimension.Y * 1.5f, Dimension.Y * 1.5f))); SwapTimer.ResetToZero(); _swappedEnemy = null; } }
public void SwapPositionWithClosestEnemy() { Npc closestEnemy = (Npc)GameGlobals.GetClosestNpc(this); if (closestEnemy != null && Math.Abs(closestEnemy.Position.X - Position.X) < 1000) { Vector2 tmpPos = Position; Position = closestEnemy.Position + new Vector2(0, closestEnemy.Dimension.Y / 2 * closestEnemy.BoundingBoxOffset.W - Dimension.Y / 2); closestEnemy.Position = tmpPos + new Vector2(0, Dimension.Y / 2 * BoundingBoxOffset.W - closestEnemy.Dimension.Y / 2); GameGlobals.PassEffect(new WindEffect(this, new Vector2(Dimension.Y * 1.5f, Dimension.Y * 1.5f))); GameGlobals.PassEffect(new WindEffect(closestEnemy, new Vector2(Dimension.Y * 1.5f, Dimension.Y * 1.5f))); Stamina -= 3; SwapTimer.ResetToZero(); _swappedEnemy = closestEnemy; } }