Example #1
0
 public void before_every_test()
 {
     _worldBounds = AsteroidManager.Instance.GetBounds();
     _wrapper     = Substitute.For <IWrapInBounds>();
     _wrapper.HalfSizeX.Returns(halfSize);
     _wrapper.HalfSizeY.Returns(halfSize);
 }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
        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));
        }