示例#1
0
        private bool ObjectIsInScope(ICameraRelativeWithOffCameraDispose objectToCheck, Rectangle cameraViewport)
        {
            Rectangle inShotTester = new Rectangle(
                (int)objectToCheck.WorldPosition.X + objectToCheck.OutOfShotTolerance.X,
                (int)objectToCheck.WorldPosition.Y + objectToCheck.OutOfShotTolerance.Y,
                objectToCheck.OutOfShotTolerance.Width,
                objectToCheck.OutOfShotTolerance.Height);

            return((cameraViewport.Intersects(inShotTester)) || (cameraViewport.Contains(inShotTester)));
        }
示例#2
0
        public void RemoveCameraLinkedObject(ICameraLinked toRemove)
        {
            if (_objectsOnCamera.Contains(toRemove))
            {
                _objectsOnCamera.Remove(toRemove);
            }

            ICameraRelativeWithOffCameraDispose disposable = toRemove as ICameraRelativeWithOffCameraDispose;

            if ((disposable != null) && (_objectsToDisposeOfOnceOffCamera.Contains(disposable)))
            {
                _objectsToDisposeOfOnceOffCamera.Remove(disposable);
            }
        }
        private bool ObjectIsInScope(ICameraRelativeWithOffCameraDispose objectToCheck, Rectangle cameraViewport)
        {
            Rectangle inShotTester = new Rectangle(
                (int)objectToCheck.WorldPosition.X + objectToCheck.OutOfShotTolerance.X,
                (int)objectToCheck.WorldPosition.Y + objectToCheck.OutOfShotTolerance.Y,
                objectToCheck.OutOfShotTolerance.Width,
                objectToCheck.OutOfShotTolerance.Height);

            return ((cameraViewport.Intersects(inShotTester)) || (cameraViewport.Contains(inShotTester)));
        }