コード例 #1
0
        public override Timeline Copy(AnimationClass.AnimationLayer ActiveLayer)
        {
            CollisionBoxTimeline NewSetMarkerEvent = new CollisionBoxTimeline(Owner);

            NewSetMarkerEvent.UpdateFrom(this, ActiveLayer);

            return(NewSetMarkerEvent);
        }
コード例 #2
0
        public override List <VisibleTimeline> CreateNewEditorItem(AnimationClass ActiveAnimation, AnimationClass.AnimationLayer ActiveLayer, int KeyFrame, System.Drawing.Point MousePosition)
        {
            List <VisibleTimeline> ReturnValue = new List <VisibleTimeline>();

            Vector2[] LocalPoints = new Vector2[4]
            {
                new Vector2(MousePosition.X - 40, MousePosition.Y - 40),
                new Vector2(MousePosition.X - 40, MousePosition.Y + 40),
                new Vector2(MousePosition.X + 40, MousePosition.Y + 40),
                new Vector2(MousePosition.X + 40, MousePosition.Y - 40),
            };

            List <Polygon>       ListPolygon             = new List <Polygon>();
            CollisionBoxTimeline NewCollisionBoxTimeline = new CollisionBoxTimeline();
            PolygonCutterHelper  NewSpawner = new PolygonCutterHelper(ActiveLayer.renderTarget, ListPolygon, true);

            Polygon NewPolygon = new Polygon(LocalPoints, GameScreen.GraphicsDevice.Viewport.Width, GameScreen.GraphicsDevice.Viewport.Height);

            NewSpawner.PolygonCutterViewer.ListPolygon.Add(NewPolygon);

            if (NewSpawner.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                NewCollisionBoxTimeline.SpawnFrame = KeyFrame;
                NewCollisionBoxTimeline.DeathFrame = KeyFrame + 10;
                NewCollisionBoxTimeline.IsUsed     = true;//Disable the spawner as we spawn the Marker manually.

                Vector2[] NewArrayVertex = new Vector2[NewSpawner.PolygonCutterViewer.ListPolygon[0].ArrayVertex.Length];
                Array.Copy(NewSpawner.PolygonCutterViewer.ListPolygon[0].ArrayVertex, NewArrayVertex, NewSpawner.PolygonCutterViewer.ListPolygon[0].ArrayVertex.Length);

                VisibleAnimationObjectKeyFrame NewPolygonCutterKeyFrame = new VisibleAnimationObjectKeyFrame(NewCollisionBoxTimeline.Position,
                                                                                                             true, -1);

                Polygon NewKeyFramePolygon = new Polygon(NewArrayVertex, ActiveLayer.renderTarget.Width, ActiveLayer.renderTarget.Height);

                NewCollisionBoxTimeline.Add(KeyFrame, NewPolygonCutterKeyFrame);
                NewCollisionBoxTimeline.ListCollisionPolygon.Add(NewKeyFramePolygon);
                NewCollisionBoxTimeline.ListOriginalPolygon.Add(new Polygon(NewKeyFramePolygon));
                NewKeyFramePolygon.UpdateWorldPosition(Vector2.Zero, 0f);

                NewCollisionBoxTimeline.ComputeSourceRectangle();
                ReturnValue.Add(NewCollisionBoxTimeline);
            }

            return(ReturnValue);
        }