Пример #1
0
        private void UpdateSelectedSphereSelectionHud()
        {
            if (CurrentShapeCollection.Spheres.Count == 0)
            {
                mCurrentSphereHighlight.Visible = false;
                if (mCurrentSphereHighlight.Parent != null)
                {
                    mCurrentSphereHighlight.Detach();
                }
            }
            else
            {
                if (mCurrentSphereHighlight.Visible == false)
                {
                    mCurrentSphereHighlight.Visible = true;
                    mCurrentSphereHighlight.AttachTo(CurrentShapeCollection.Spheres[0], false);
                }
                else if (mCurrentSphereHighlight.Parent != CurrentShapeCollection.Spheres[0])
                {
                    mCurrentSphereHighlight.AttachTo(CurrentShapeCollection.Spheres[0], false);
                }

                mCurrentSphereHighlight.Position = CurrentShapeCollection.Spheres[0].Position;

                float extraScale = 4 / SpriteManager.Camera.PixelsPerUnitAt(0);

                mCurrentSphereHighlight.ScaleX = CurrentShapeCollection.Spheres[0].Radius + extraScale;
                mCurrentSphereHighlight.ScaleY = CurrentShapeCollection.Spheres[0].Radius + extraScale;
            }
        }
Пример #2
0
 private void CreateCollision()
 {
     frbCollision        = ShapeManager.AddAxisAlignedRectangle();
     frbCollision.ScaleX = 4;
     frbCollision.ScaleY = 4;
     frbCollision.AttachTo(this, false);
 }
Пример #3
0
        public void SetCollision(AxisAlignedRectangle rectangle)
        {
            mCollisionCircle = null;
            mCollisionPolygon = null;
            mCollisionLine = null;

            mCollisionAxisAlignedRectangle = rectangle;
            //mCollisionAxisAlignedRectangle.ScaleX = ScaleX;
            //mCollisionAxisAlignedRectangle.ScaleY = ScaleY;

            mCollisionAxisAlignedRectangle.AttachTo(this, false);
            mCollisionAxisAlignedRectangle.ForceUpdateDependencies();
        }