コード例 #1
0
ファイル: PlayStateUnused.cs プロジェクト: JonasAAA/Lighting
        public PlayStateUnused()
        {
            HasWon  = false;
            HasLost = false;

            player = new LightDiskPlayer(new Vector2(600, 600), 16, 0, Keys.Up, Keys.Left, Keys.Down, Keys.Right, Color.Black * 0f, 1f, new Color(0, 255, 0));

            obstacles = new List <IObstacle>()
            {
                new DiskObst(new Vector2(500, 500), 32, 0, "disk", Color.Black /*White*/),
                new DiskObst(new Vector2(1700, 500), 64, 0, "disk", Color.Black /*Red*/),
                new SegmentObst(new Vector2(700, 700), new Vector2(700, 500), 2, Color.Black /*Green*/),
                new PolygonObst(new List <Vector2>()
                {
                    new Vector2(1800, 900), new Vector2(1600, 800), new Vector2(1700, 700)
                }, 2, Color.Black)
            };

            lights = new List <Light>()
            {
                new Light(new Vector2(1920 / 2, 1080 / 2), 2f, Color.White),
                new RotatingLight(new Vector2(1920 / 2, 0), MathHelper.TwoPi * 0.75f, MathHelper.Pi * 0.125f, 1f, 2f, new Color(255, 0, 0)),
                new Light(new Vector2(1920, 1080 / 2), 2f, new Color(0, 0, 255)),
                player.light,
            };

            foreach (Light light in lights)
            {
                //if (light != player.light)
                //    light.AddObject(player);

                foreach (IObstacle obstacle in obstacles)
                {
                    light.AddObject(obstacle);
                }
            }

            background = new Background(new Point(C.screenWidth / 2, C.screenHeight / 2), "random background", Color.White);
        }
コード例 #2
0
ファイル: PlayState.cs プロジェクト: JonasAAA/Lighting2
        public PlayState()
        {
            player = new LightDiskPlayer(new Vector2(-20, -50), 32, 0, Keys.Up, Keys.Left, Keys.Down, Keys.Right, Color.Yellow, 1f, Color.Yellow);

            blocks = new List <Block>();
            //{
            //    new Block(new Vector2(100, 100)),
            //};

            for (int i = 0; i < 10; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    blocks.Add(new Block(new Vector2(3 * i * (Block.width + 10), j * (Block.height + 10))));
                }
            }

            lights = new List <Light1>()
            {
                player.light,
                //new Light1(new Vector2(-100, -100), 2, Color.White),
                //new Light(new Vector2(-100, 0), 2, Color.White),
            };

            //lights[0].AddObject(player);
            //foreach (Block block in blocks)
            //    lights[0].AddObject(block);


            foreach (Light1 light in lights)
            {
                foreach (Block block in blocks)
                {
                    light.AddObject(block);
                }
            }

            background = new Background(new Point(0, 0), "ground", Color.White);
        }