コード例 #1
0
ファイル: Program.cs プロジェクト: angjminer/rawbots
        public void LoadMap(string filename)
        {
            int x = 0;
            int y = 0;
            Light light;

            map = MapFile.Load(resourcePath + "/Maps/" + filename);

            mapWidth = map.GetWidth();
            mapHeight = map.GetHeight();

            activeRobot = map.GetActiveRobot();
            robotCamera.Attach(activeRobot);
            map.AddRobotToRemoteControlUnitList(activeRobot);

            light = new Light(LightName.Light7);
            activeRobot.AddLight(light);

            someRobot = activeRobot;

            LightPost lightpost = new LightPost(4);
            map.SetTile(lightpost, x, y);

            light = new Light(LightName.Light0);
            light.setCutOff(45.0f);
            light.lookAt(0.0f, 6.0f, 0.0f,
                         2.0f * (float) Math.Sqrt(2.0f), 0.0f, -2.0f * (float) Math.Sqrt(2.0f),
                         1.0f, 1.0f, 1.0f);

            lightpost.AddLight(light);

            l = light;

            lightCamera1 = new Camera(0.0f, 6.0f, 0.0f,
                         2.0f * (float) Math.Sqrt(2.0f), 0.0f, -2.0f * (float) Math.Sqrt(2.0f),
                         0.0f, 1.0f, 0.0f);

            lightpost = new LightPost(3);
            map.SetTile(lightpost, x + mapWidth - 1, y);

            light = new Light(LightName.Light1);
            light.setCutOff(45.0f);
            light.lookAt(0.0f, 6.0f, 0.0f,
                -2.0f * (float) Math.Sqrt(2.0f), 0.0f, -2.0f * (float) Math.Sqrt(2.0f),
                0.0f, 0.0f, 1.0f);
            lightpost.AddLight(light);

            lightCamera2 = new Camera(mapWidth - 1, 6.0f, 0.0f,
                (mapWidth - 1) - 2.0f * (float) Math.Sqrt(2.0f), 0.0f, -2.0f * (float) Math.Sqrt(2.0f),
                0.0f, 1.0f, 0.0f);

            lightpost = new LightPost(2);
            map.SetTile(lightpost, x + mapWidth - 1, y + mapHeight -1);

            light = new Light(LightName.Light2);
            light.setCutOff(45.0f);
            light.lookAt(0.0f, 6.0f, 0.0f,
                -2.0f * (float) Math.Sqrt(2.0f), 0.0f, 2.0f * (float) Math.Sqrt(2.0f),
                1.0f, 1.0f, 1.0f);
            lightpost.AddLight(light);

            lightCamera3 = new Camera(mapWidth, 6.0f, -(mapHeight - 1),
                (mapWidth - 1) - 2.0f * (float) Math.Sqrt(2.0f), 0.0f, -(mapHeight - 1) + 2.0f * (float) Math.Sqrt(2.0f),
                0.0f, 1.0f, 0.0f);

            lightpost = new LightPost(1);
            map.SetTile(lightpost, x, y + (mapHeight - 1));

            light = new Light(LightName.Light3);
            light.setCutOff(45.0f);
            light.lookAt(0.0f, 6.0f, 0.0f,
                2.0f * (float) Math.Sqrt(2.0f), 0.0f, 2.0f * (float) Math.Sqrt(2.0f),
                1.0f, 1.0f, 1.0f);
            lightpost.AddLight(light);

            lightCamera4 = new Camera(0.0f, 6.0f, -(mapHeight - 1),
                2.0f * (float) Math.Sqrt(2.0f), 0.0f, -(mapHeight - 1) + 2.0f * (float) Math.Sqrt(2.0f),
                0.0f, 1.0f, 0.0f);

            this.Title = this.baseTitle;

            PrintHelp();

            prevMousePosition = this.WindowCenter;
            prevMouseDelta = new Point(0, 0);
            nullDelta = new Point(0, 0);

            globalCamera.SetMap(map);
            robotCamera.SetMap(map);

            camera = globalCamera;

            System.Windows.Forms.Cursor.Hide();

            GL.Enable(EnableCap.Lighting);
            GL.Enable(EnableCap.ColorMaterial);
            GL.Enable(EnableCap.Texture2D);

            /* To Avoid Having Z-Fighting for projecting surfaces onto another surface (Shadows) */
            GL.PolygonOffset(-10.0f, -25.0f);
        }
コード例 #2
0
ファイル: Robot.cs プロジェクト: angjminer/rawbots
 public void AddLight(Light l)
 {
     light = l;
     lightOn = true;
 }
コード例 #3
0
 public void AttachLight(Light light)
 {
     this.light = light;
     this.light.setCutOff(45.0f);
     this.light.setDirection(0.0f, -0.45f, -0.45f);
 }
コード例 #4
0
ファイル: Robot.cs プロジェクト: angjminer/rawbots
		private void Init()
		{
			chassis = null;
			weapons = null;
			electronics = null;
			lightOn = false;
			Angle = 0.0f;

			light = new Light(LightName.Light2);
		}
コード例 #5
0
ファイル: Tile.cs プロジェクト: angjminer/rawbots
 public void AddLight(Light light)
 {
     this.light = light;
 }