Exemple #1
0
        public static PolygonSave FromPolygon(FlatRedBall.Math.Geometry.Polygon polygon)
        {
            PolygonSave polygonSave = new PolygonSave();

            int pointCount = polygon.Points.Count;

            polygonSave.Points = new Point[pointCount];

            for (int i = 0; i < polygon.Points.Count; i++)
            {
                polygonSave.Points[i] = polygon.Points[i];
            }

            polygonSave.Name = polygon.Name;
            polygonSave.X    = polygon.Position.X;
            polygonSave.Y    = polygon.Position.Y;
            polygonSave.Z    = polygon.Position.Z;

            polygonSave.RotationZ = polygon.RotationZ;

            polygonSave.Alpha = polygon.Color.A / 255.0f;
            polygonSave.Red   = polygon.Color.R / 255.0f;
            polygonSave.Green = polygon.Color.G / 255.0f;
            polygonSave.Blue  = polygon.Color.B / 255.0f;

            return(polygonSave);
        }
Exemple #2
0
        public PositionedObjectList <FlatRedBall.Math.Geometry.Polygon> ToPolygonList()
        {
            PositionedObjectList <FlatRedBall.Math.Geometry.Polygon> listToReturn = new PositionedObjectList <FlatRedBall.Math.Geometry.Polygon>();

            foreach (PolygonSave polygonSave in PolygonSaves)
            {
                FlatRedBall.Math.Geometry.Polygon polygon = polygonSave.ToPolygon();
                listToReturn.Add(polygon);
            }

            return(listToReturn);
        }
Exemple #3
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            mLine1      = new FlatRedBall.Math.Geometry.Polygon();
            mLine1.Name = "mLine1";
            mLine2      = new FlatRedBall.Math.Geometry.Polygon();
            mLine2.Name = "mLine2";

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Exemple #4
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            mArrowPoly1      = new FlatRedBall.Math.Geometry.Polygon();
            mArrowPoly1.Name = "mArrowPoly1";
            mArrowPoly4      = new FlatRedBall.Math.Geometry.Polygon();
            mArrowPoly4.Name = "mArrowPoly4";
            mArrowPoly2      = new FlatRedBall.Math.Geometry.Polygon();
            mArrowPoly2.Name = "mArrowPoly2";
            mArrowPoly3      = new FlatRedBall.Math.Geometry.Polygon();
            mArrowPoly3.Name = "mArrowPoly3";

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Exemple #5
0
        protected virtual void InitializeEntity(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            BoatSpriteInstance      = new FlatRedBall.Sprite();
            BoatSpriteInstance.Name = "BoatSpriteInstance";
            mHitbox                   = new FlatRedBall.Math.Geometry.Polygon();
            mHitbox.Name              = "mHitbox";
            AnchorSpriteInstance      = new FlatRedBall.Sprite();
            AnchorSpriteInstance.Name = "AnchorSpriteInstance";
            CannonballList            = new FlatRedBall.Math.PositionedObjectList <Pirates.Entities.Cannonball>();
            CannonballList.Name       = "CannonballList";

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
        public override void Initialize(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            mCenterH                     = new FlatRedBall.Math.Geometry.Polygon();
            mCenterH.Name                = "mCenterH";
            mCenterV                     = new FlatRedBall.Math.Geometry.Polygon();
            mCenterV.Name                = "mCenterV";
            RectsList                    = new FlatRedBall.Math.PositionedObjectList <FlatRedBall.Math.Geometry.AxisAlignedRectangle>();
            RectsList.Name               = "RectsList";
            mRect1Main                   = new FlatRedBall.Math.Geometry.AxisAlignedRectangle();
            mRect1Main.Name              = "mRect1Main";
            mRect2InnerTouching          = new FlatRedBall.Math.Geometry.AxisAlignedRectangle();
            mRect2InnerTouching.Name     = "mRect2InnerTouching";
            mRectOuterTouching2          = new FlatRedBall.Math.Geometry.AxisAlignedRectangle();
            mRectOuterTouching2.Name     = "mRectOuterTouching2";
            mRect3InnerTouching          = new FlatRedBall.Math.Geometry.AxisAlignedRectangle();
            mRect3InnerTouching.Name     = "mRect3InnerTouching";
            mRect4InnerTouching          = new FlatRedBall.Math.Geometry.AxisAlignedRectangle();
            mRect4InnerTouching.Name     = "mRect4InnerTouching";
            mRect5InnerTouching          = new FlatRedBall.Math.Geometry.AxisAlignedRectangle();
            mRect5InnerTouching.Name     = "mRect5InnerTouching";
            mRect6OuterTouching          = new FlatRedBall.Math.Geometry.AxisAlignedRectangle();
            mRect6OuterTouching.Name     = "mRect6OuterTouching";
            mRect7OuterTouching          = new FlatRedBall.Math.Geometry.AxisAlignedRectangle();
            mRect7OuterTouching.Name     = "mRect7OuterTouching";
            mRect8OuterNotTouching       = new FlatRedBall.Math.Geometry.AxisAlignedRectangle();
            mRect8OuterNotTouching.Name  = "mRect8OuterNotTouching";
            mRect8OuterNotTouching2      = new FlatRedBall.Math.Geometry.AxisAlignedRectangle();
            mRect8OuterNotTouching2.Name = "mRect8OuterNotTouching2";
            mRect6OuterTouching2         = new FlatRedBall.Math.Geometry.AxisAlignedRectangle();
            mRect6OuterTouching2.Name    = "mRect6OuterTouching2";


            PostInitialize();
            base.Initialize(addToManagers);
            if (addToManagers)
            {
                AddToManagers();
            }
        }
        internal static FlatRedBall.Math.Geometry.Polygon ReadPolygon(ContentReader input)
        {
            FlatRedBall.Math.Geometry.Polygon polygon = new FlatRedBall.Math.Geometry.Polygon();

            polygon.Position = new Vector3(input.ReadSingle(), input.ReadSingle(), input.ReadSingle());

            polygon.RotationZ = input.ReadSingle();

            int numberOfPoints = input.ReadInt32();

            FlatRedBall.Math.Geometry.Point[] pointList = new FlatRedBall.Math.Geometry.Point[numberOfPoints];

            for (int i = 0; i < numberOfPoints; i++)
            {
                pointList[i] = new FlatRedBall.Math.Geometry.Point(input.ReadDouble(), input.ReadDouble());
            }

            polygon.Points = pointList;

            polygon.Name = input.ReadString();

            return(polygon);
        }
Exemple #8
0
        public FlatRedBall.Math.Geometry.Polygon ToPolygon()
        {
            FlatRedBall.Math.Geometry.Polygon polygon = new FlatRedBall.Math.Geometry.Polygon();
            polygon.Points = Points;

            polygon.Position.X = X;
            polygon.Position.Y = Y;
            polygon.Position.Z = Z;

            polygon.RotationZ = RotationZ;

            polygon.Name = Name;

            polygon.Color =
                new Color(
                    (byte)(Red * 255),
                    (byte)(Green * 255),
                    (byte)(Blue * 255),
                    (byte)(Alpha * 255));

            polygon.FillVertexArray();

            return(polygon);
        }
        protected virtual void InitializeEntity(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            CapacitorScn = SceneFile2.Clone();
            for (int i = 0; i < CapacitorScn.Texts.Count; i++)
            {
                CapacitorScn.Texts[i].AdjustPositionForPixelPerfectDrawing = true;
            }
            mCollision = CapacitorCollisionFile.Polygons.FindByName("Polygon1").Clone();

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
        protected virtual void InitializeEntity(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            CapacitorScn = SceneFile1.Sprites.FindByName("capacitor1").Clone();
            mCollision = CapacitorCollisionFile.Polygons.FindByName("Polygon1").Clone();

            PostInitialize();
            if (addToManagers)
            {
                AddToManagers(null);
            }
        }
Exemple #11
0
        public FlatRedBall.Math.Geometry.Polygon ToPolygon()
        {
            FlatRedBall.Math.Geometry.Polygon polygon = new FlatRedBall.Math.Geometry.Polygon();
            polygon.Points = Points;

            polygon.Position.X = X;
            polygon.Position.Y = Y;
            polygon.Position.Z = Z;

            polygon.RotationZ = RotationZ;

            polygon.Name = Name;

            polygon.Color =
#if FRB_MDX
                Color.FromArgb(
                (int)(Alpha * 255),
                (int)(Red * 255),
                (int)(Green * 255),
                (int)(Blue * 255));
#else
                new Color(
                    (byte)(Red * 255),
                    (byte)(Green * 255),
                    (byte)(Blue * 255),
                    (byte)(Alpha * 255));
#endif

            polygon.FillVertexArray();

            return polygon;
        }