Beispiel #1
0
        public override void Load()
        {
            CollisionManager.Instance().WallCollideReset();

            entityManager = EntityManager.Instance();
            systemManager = SystemManager.Instance();
            inputManager  = InputManager.Instance();

            audioManager = AudioManager.Instance();
            audioManager.AddAudio("Death", "Audio/WilhelmScream.wav", false);
            audioManager.AddAudio("Collect", "Audio/CollectCoin.wav", false);
            audioManager.AddAudio("Powerup", "Audio/ElevatorMusic.wav", true);
            audioManager.AddAudio("KillGhost", "Audio/ko.wav", false);

            coinsCollected = 0;

            // Set the title of the window
            sceneManager.Title = "Game";
            // Set the Render and Update delegates to the Update and Render methods of this class
            sceneManager.renderer = Render;
            sceneManager.updater  = Update;
            // Set Keyboard events to go to a method in this class
            sceneManager.Keyboard.KeyDown += Keyboard_KeyDown;

            GL.ClearColor(0.0f, 0.0f, 0.0f, 1.0f);

            map = new MapLoader();
            map.LoadMap("Maps/Level1.txt");

            mapCamera    = new MiniMapCamera(map.GetWidth(), map.GetHeight(), sceneManager.Width, sceneManager.Height);
            entityCamera = new EntityCamera(sceneManager.Width, sceneManager.Height);

            mapCamera.Position  = new Vector3(0, 0, 0);
            mapCamera.Direction = new Vector3(0, -1, 0);
            mapCamera.Up        = new Vector3(0, 0, -1);

            CollisionManager.Instance().SetMap(map);
            CollisionManager.Instance().SetLevel(this);
            Entity player = map.GetPlayer();

            entityCamera.SetEntity(player);
            audioManager.SetCamera(entityCamera);

            CreateSystems();

            CubeMapTexture cubeMap = ResourceManager.LoadCubeMap("Textures/darkskies_up.png", "Textures/darkskies_dn.png", "Textures/darkskies_lf.png",
                                                                 "Textures/darkskies_rt.png", "Textures/darkskies_ft.png", "Textures/darkskies_bk.png");

            Shader   shader   = ResourceManager.LoadShader("Shaders/cubemapVS.glsl", "Shaders/cubemapFS.glsl");
            Geometry geometry = ResourceManager.LoadGeometry("Geometry/SkyBox.obj");

            cubemapRender = new CubeMapRender(entityCamera, cubeMap, shader, geometry);
            customRender  = new MiniMapRender(entityCamera, mapCamera);
        }
 public CubeMapRender(Camera.aCamera pCamera, CubeMapTexture pCubemap, Shader pShader, Geometry pGeometry)
 {
     camera           = pCamera;
     cubemap          = pCubemap;
     shader           = pShader;
     geometry         = pGeometry;
     ViewMatLocation  = GL.GetUniformLocation(shader.ShaderID, "ViewMat");
     ProjMatLocation  = GL.GetUniformLocation(shader.ShaderID, "ProjMat");
     ModelMatLocation = GL.GetUniformLocation(shader.ShaderID, "ModelMat");
     SkyBoxLocation   = GL.GetUniformLocation(shader.ShaderID, "SkyBox");
 }
        public static CubeMapTexture LoadCubeMap(string TopTexture, string BottomTexture, string LeftTexture, string RightTexture, string FrontTexture, string BackTexture)
        {
            CubeMapTexture cubemap;
            string         concat = TopTexture + BottomTexture + LeftTexture + RightTexture + FrontTexture + BackTexture;

            cubemapDictionary.TryGetValue(concat, out cubemap);
            if (cubemap == null)
            {
                cubemap = new CubeMapTexture();
                cubemap.LoadCubeMap(TopTexture, BottomTexture, LeftTexture, RightTexture, FrontTexture, BackTexture);
                cubemapDictionary.Add(concat, cubemap);
            }

            return(cubemap);
        }
Beispiel #4
0
 public EnvironmentBox(CubeMapTexture texture)
 {
     Texture = texture;
 }