static public void Walls(SpaceShip spaceShip, Rectangle outBoundaries, Rectangle inBoundaries) { Rectangle playerShip = spaceShip.SpaceShipRectangle(); if (!outBoundaries.Contains(playerShip) || inBoundaries.IntersectsWith(playerShip)) { RestartPositions(spaceShip); } }
static public void Players(SpaceShip spaceShip1, SpaceShip spaceShip2) { Rectangle playerShip1 = spaceShip1.SpaceShipRectangle(); Rectangle playerShip2 = spaceShip2.SpaceShipRectangle(); if (playerShip1.IntersectsWith(playerShip2)) { RestartPositions(spaceShip1); RestartPositions(spaceShip2); } }
public static void LapCount(SpaceShip spaceShip, Rectangle startLine, Rectangle middleCheckPoint) { Rectangle playerShip = spaceShip.SpaceShipRectangle(); if (playerShip.IntersectsWith(middleCheckPoint)) { spaceShip.CheckPointFlag = true; } if (playerShip.IntersectsWith(startLine) && spaceShip.CheckPointFlag == true) { spaceShip.LapCount += 1; spaceShip.CheckPointFlag = false; } }