flxSharp.flxSharp.FlxSprite.onScreen C# (CSharp) Méthode

onScreen() public méthode

Check and see if this object is currently on screen. Differs from FlxObject's implementation in that it takes the actual graphic into account, not just the hitbox or bounding box or whatever.
public onScreen ( FlxCamera camera = null ) : bool
camera FlxCamera Specify which game camera you want. If null getScreenXY() will just grab the first global camera.
Résultat bool
        public override bool onScreen(FlxCamera camera = null)
        {
            if (camera == null)
            {
                camera = FlxG.camera;
            }

            getScreenXY(_tagPoint, camera);
            _tagPoint.X = _tagPoint.X - Offset.X;
            _tagPoint.Y = _tagPoint.Y - Offset.Y;

            /*
            if (((angle == 0) || (_bakedRotation > 0)) && (scale.x == 1) && (scale.y == 1))
                return ((_point.x + frameWidth > 0) && (_point.x < Camera.width) && (_point.y + frameHeight > 0) && (_point.y < Camera.height));
            */

            float halfWidth = FrameWidth / 2;
            float halfHeight = FrameHeight / 2;
            float absScaleX = (Scale.X > 0) ? Scale.X : -Scale.X;
            float absScaleY = (Scale.Y > 0) ? Scale.Y : -Scale.Y;
            float radius = (float)Math.Sqrt((halfWidth * halfWidth) + (halfHeight * halfHeight)) * ((absScaleX >= absScaleY) ? absScaleX : absScaleY);
            _tagPoint.X = _tagPoint.X + halfWidth;
            _tagPoint.Y = _tagPoint.Y + halfHeight;
            return ((_tagPoint.X + radius > 0) && (_tagPoint.X - radius < camera.Width) && (_tagPoint.Y + radius > 0) && (_tagPoint.Y - radius < camera.Height));
        }