コード例 #1
0
ファイル: GameForm.cs プロジェクト: PartusLetum/GameTestBed
        private void DoInitialize()
        {
            keyStatus = new KeyStatus();

            playerWorldLocation    = new PointF(200.0f, 200.0f);
            playerWorldOrientation = 0;
            playerDirectionVector  = new PointF(0.0f, 1.0f);
            playerStrafeVector     = new PointF(1.0f, 0.0f);

            wallRect          = new RectangleF(new PointF(-100.0f, 100.0f), new SizeF(200.0f, 25.0f));
            wallWorldLocation = new PointF(200.0f, 300.0f);
        }
コード例 #2
0
        private void DoInitialize()
        {
            keyStatus = new KeyStatus();

            playerWorldLocation    = new PointF(0.0f, 50.0f);
            playerWorldOrientation = 0;
            playerDirectionVector  = new PointF(0.0f, 1.0f);
            playerStrafeVector     = new PointF(1.0f, 0.0f);

            wallRect          = new RectangleF(new PointF(-100.0f, 100.0f), new SizeF(200.0f, 25.0f));
            wallWorldLocation = new PointF(200.0f, 300.0f);

            fovNearDistance = 10.0f;
            fovFarDistance  = 200.0f;

            viewport = new Bitmap[3]
            {
                new Bitmap(100, 100, CreateGraphics()),
                new Bitmap(100, 100, CreateGraphics()),
                new Bitmap(100, 100, CreateGraphics())
            };

            mapvector[] map1 = new mapvector[8]
            {
                new mapvector()
                {
                    pt = new PointF(50, 90), pen = Pens.Green, height = 5
                },
                new mapvector()
                {
                    pt = new PointF(90, 70), pen = Pens.Red, height = 5
                },
                new mapvector()
                {
                    pt = new PointF(90, 60), pen = Pens.Blue, height = 5
                },
                new mapvector()
                {
                    pt = new PointF(50, 60), pen = Pens.Yellow, height = 5
                },
                new mapvector()
                {
                    pt = new PointF(50, 10), pen = Pens.Purple, height = 5
                },
                new mapvector()
                {
                    pt = new PointF(20, 30), pen = Pens.Orange, height = 5
                },
                new mapvector()
                {
                    pt = new PointF(30, 40), pen = Pens.Cyan, height = 5
                },
                new mapvector()
                {
                    pt = new PointF(50, 90), pen = Pens.Green, height = 5
                }
            };

            mapvector[] map2 = new mapvector[6]
            {
                new mapvector()
                {
                    pt = new PointF(70, 90), pen = Pens.Yellow, height = 5
                },
                new mapvector()
                {
                    pt = new PointF(70, 20), pen = Pens.Violet, height = 5
                },
                new mapvector()
                {
                    pt = new PointF(20, 30), pen = Pens.Green, height = 5
                },
                new mapvector()
                {
                    pt = new PointF(20, 60), pen = Pens.Purple, height = 5, isPortal = false
                },
                new mapvector()
                {
                    pt = new PointF(40, 90), pen = Pens.Orange, height = 5
                },
                new mapvector()
                {
                    pt = new PointF(70, 90), pen = Pens.Ivory, height = 5
                }
            };

            mapvector[] map3 = new mapvector[2]
            {
                new mapvector()
                {
                    pt = new PointF(50, 50 + (50 / 2.0f)), pen = Pens.Yellow, height = 5.0f
                },
                new mapvector()
                {
                    pt = new PointF(50, 50 - (50 / 2.0f)), pen = Pens.Yellow, height = 5.0f
                }
            };

            map = map1;

            portalMap = new PortalMap()
            {
                PlayerStartLocation = new PointF(0, 0),
                Sectors             = new List <PortalMapSector>()
                {
                    new PortalMapSector()
                    {
                        LineSegments = new List <PortalMapLineSegment>()
                        {
                            new PortalMapLineSegment(new PointF(30, -30), new PointF(-30, -30))
                            {
                                IsPortal = true
                            },
                            new PortalMapLineSegment(new PointF(-30, -30), new PointF(-30, 30)),
                            new PortalMapLineSegment(new PointF(-30, 30), new PointF(30, 30)),
                            new PortalMapLineSegment(new PointF(30, 30), new PointF(30, -30))
                        }
                    },
                    new PortalMapSector()
                    {
                        LineSegments = new List <PortalMapLineSegment>()
                        {
                            new PortalMapLineSegment(new PointF(-30, -30), new PointF(30, -30))
                            {
                                IsPortal = true
                            },
                            new PortalMapLineSegment(new PointF(30, -30), new PointF(60, -60)),
                            new PortalMapLineSegment(new PointF(60, -60), new PointF(0, -60)),
                            new PortalMapLineSegment(new PointF(0, -60), new PointF(-30, -30))
                        }
                    }
                }
            };
            portalMap.PlayerSector = portalMap.Sectors[0];
            portalMap.Sectors[0].LineSegments[0].LinkedSector = portalMap.Sectors[1];
            portalMap.Sectors[1].LineSegments[0].LinkedSector = portalMap.Sectors[0];

            playerWorldLocation = portalMap.PlayerStartLocation;

            Size = new Size(640, 400);
        }