public void Update(IFullPositionHolder target, IGameSectorBoundaries sectorBoundary)
 {
     if (target.Position.X >= sectorBoundary.MaxSectorX)
     {
         target.Position.X = target.Position.X - sectorBoundary.MaxSectorX + 10;
     }
     if (target.Position.X <= sectorBoundary.MinSectorX)
     {
         target.Position.X = target.Position.X + sectorBoundary.MaxSectorX - 10;
     }
     if (target.Position.Y >= sectorBoundary.MaxSectorY)
     {
         target.Position.Y = sectorBoundary.MaxSectorY - target.Position.Y + 10;
     }
     if (target.Position.Y <= sectorBoundary.MinSectorY)
     {
         target.Position.Y = sectorBoundary.MaxSectorY + target.Position.Y - 10;
     }
 }
 public void Update(
     TCharacter target,
     IGameSectorBoundaries sectoBoundaries)
 {
     if (target.CurrentImage.Position.X >= sectoBoundaries.MaxSectorX)
     {
         OnIntersectionCallback(target);
     }
     if (target.CurrentImage.Position.X <= sectoBoundaries.MinSectorX)
     {
         OnIntersectionCallback(target);
     }
     if (target.CurrentImage.Position.Y >= sectoBoundaries.MaxSectorY)
     {
         OnIntersectionCallback(target);
     }
     if (target.CurrentImage.Position.Y <= sectoBoundaries.MinSectorY)
     {
         OnIntersectionCallback(target);
     }
 }
Example #3
0
 public Rectangle ToRectangle(IGameSectorBoundaries sectorBoundary) => new Rectangle(
     sectorBoundary.MinSectorX,
     sectorBoundary.MinSectorY,
     sectorBoundary.MaxSectorX,
     sectorBoundary.MaxSectorY);