Paint.BaseGame.CheckToolboxCollision C# (CSharp) Méthode

CheckToolboxCollision() protected méthode

Checks whether the user has touched inside the toolbox
protected CheckToolboxCollision ( ITouchPoint touchPoint ) : bool
touchPoint ITouchPoint
Résultat bool
        protected bool CheckToolboxCollision(ITouchPoint touchPoint)
        {
            bool touchInToolbox = false;
            ITouchPoint offsetCollisionPoint = touchPoint;

            if (this.ToolBox.DockPosition == DockPosition.Bottom)
            {
                int toolboxPositionY = (this.ImageStateData.Height - this.ToolBox.ToolboxHeight);
                Vector2 offsetPosition = new Vector2(touchPoint.Position.X, touchPoint.Position.Y - toolboxPositionY);

                offsetCollisionPoint = new TouchPoint(offsetPosition, touchPoint.TouchType);

                if (touchPoint.Position.Y >= toolboxPositionY)
                {
                    touchInToolbox = true;
                }
            }
            else
            {
                if (touchPoint.Position.Y <= this.ToolBox.ToolboxHeight)
                {
                    touchInToolbox = true;
                }
            }

            if (touchInToolbox == false)
            {
                return false;
            }

            this.ToolBox.CheckTouchCollision(offsetCollisionPoint);
            return true;
        }