public void before_every_test() { _worldBounds = AsteroidManager.Instance.GetBounds(); _wrapper = Substitute.For <IWrapInBounds>(); _wrapper.HalfSizeX.Returns(halfSize); _wrapper.HalfSizeY.Returns(halfSize); }
public static float WrapYPosition(IWrapInBounds mover, Bounds bounds) { var minY = bounds.min.y - mover.HalfSizeY; var maxY = bounds.max.y + mover.HalfSizeY; var newY = WrapValue(minY, maxY, mover.Position.y); return(newY); }
public static float WrapXPosition(IWrapInBounds mover, Bounds bounds) { var minX = bounds.min.x - mover.HalfSizeX; var maxX = bounds.max.x + mover.HalfSizeX; var newX = WrapValue(minX, maxX, mover.Position.x); return(newX); }
public static void ProcessMove(IWrapInBounds mover, Bounds bounds) { if (bounds.Contains(mover.Position)) { return; } var newX = WrapXPosition(mover, bounds); var newY = WrapYPosition(mover, bounds); mover.WrapTo(mover.Position.With(x: newX, y: newY)); }