protected Ship(int damage, int health, int shields, int energy, int speed, int specialtyDamage, Specialty specialty) { this.Damage = damage; this.Health = health; this.Shields = shields; this.previousSpeed = speed; this.MAX_SPEED = speed + (int)BonusType.Wind; this.Speed = speed; this.Energy = energy; this.specialtyDamage = specialtyDamage; this.FreezTimeOut = new Stopwatch(); this.BonusDamageTimeOut = new Stopwatch(); this.WindTimeOut = new Stopwatch(); this.specialty = specialty; this.FrameSize = new Point(137, 150); }
public static bool Collide(IShip shipColliding, ISpecialty specialtyItem) { Rectangle shipRect = new Rectangle( (int)shipColliding.Position.X + OFFSET, (int)shipColliding.Position.Y + OFFSET, shipColliding.FrameSize.X - (OFFSET * 2), shipColliding.FrameSize.Y - (OFFSET * 2)); Rectangle mineRectangle = new Rectangle( (int)specialtyItem.Position.X + OFFSET, (int)specialtyItem.Position.Y + OFFSET, specialtyItem.FrameSize.X - (OFFSET * 2), specialtyItem.FrameSize.Y - (OFFSET * 2)); if (shipRect.Intersects(mineRectangle)) { specialtyItem.Position = new Vector2(9999, 9999); // might be buggy return true; } return false; }
public static bool Collide(IShip shipColliding, ISpecialty specialtyItem) { Rectangle shipRect = new Rectangle( (int)shipColliding.Position.X + OFFSET, (int)shipColliding.Position.Y + OFFSET, shipColliding.FrameSize.X - (OFFSET * 2), shipColliding.FrameSize.Y - (OFFSET * 2)); Rectangle mineRectangle = new Rectangle( (int)specialtyItem.Position.X + OFFSET, (int)specialtyItem.Position.Y + OFFSET, specialtyItem.FrameSize.X - (OFFSET * 2), specialtyItem.FrameSize.Y - (OFFSET * 2)); if (shipRect.Intersects(mineRectangle)) { specialtyItem.Position = new Vector2(9999, 9999); // might be buggy return(true); } return(false); }