Example #1
0
        public void Load()
        {
            // Camera
            _gameManager.TvCamera.SetPosition(100, 150, 50);
            _gameManager.TvCamera.SetLookAt(100, 0, 55);

            // Scene and lighting
            _gameManager.TvScene.SetShadowParameters(_gameManager.TvGlobals.RGBA(0.1f, 0.1f, 0.1f, 0.5f), false);
            _gameManager.TvScene.SetBackgroundColor(0, 0, 0);
            _light = _gameManager.TvLights.CreatePointLight(new TV_3DVECTOR(100, 200, -100), 0.2f, 0.2f, 0.2f, 500);
            _gameManager.TvLights.SetLightProperties(_light, false, true, true);
            _gameManager.TvLights.EnableLight(_light, true);
            StandardMaterial = _gameManager.TvMaterials.CreateLightMaterial(1, 1, 1, 1);

            // Walls and floor. 100 units = 1m
            _field = _gameManager.TvScene.CreateMeshBuilder();
            _field.AddWall3D(0, 0, 50f, 200, 50f, 10f, 100);                              // floor
            _field.AddWall3D(0, 0, 105f, 200, 105f, 20f, 10f, false, false, 0, 0.1f, 1f); // top side
            _field.AddWall3D(0, 0, -5f, 200, -5f, 20f, 10f, false, false, 0, 0.1f, 1f);   // bottom side

            _field.SetLightingMode(CONST_TV_LIGHTINGMODE.TV_LIGHTING_NORMAL);
            _field.SetMaterial(StandardMaterial);
            _field.SetShadowCast(true, true);
            _field.ComputeNormalsEx();

            _fieldPhysicsBody = _gameManager.TvPhysics.CreateStaticMeshBody(_field);
            _gameManager.TvPhysics.SetBodyMaterialGroup(_fieldPhysicsBody, 0);

            // Ball
            Ball = new Ball(_gameManager);
            Ball.Load(new TV_3DVECTOR(100f, 20f, 55f));

            // Player 1
            Area player1MoveArea = new Area(20, 25, 50, 75);

            Player1GoalArea   = new Area(-50, 0, 50, 100);
            Player1GoalHeight = -20;
            _gameManager.Player1.Bat.Load(player1MoveArea);

            // Player 2
            Area player2MoveArea = new Area(150, 25, 180, 75);

            Player2GoalArea   = new Area(150, 0, 250, 100);
            Player2GoalHeight = -20;
            _gameManager.Player2.Bat.Load(player2MoveArea);
        }
Example #2
0
        //Inicializace a vytvoreni mistnosti
        private void VyvorMistnost()
        {
            //Inicializace mistnosti
            Room = Scene.CreateMeshBuilder("RoomMesh");

            //Nacteni textur
            VytvorTextury();

            //Pridani sten a nastaveni pozice mistnosti
            Room.AddWall3D(Globals.GetTex("Wall"), 150.0f, -350.0f, -350.0f, -350.0f, 350.0f, 5.0f, false, false, -50.0f, 5.0f, 5.0f);
            Room.AddWall3D(Globals.GetTex("Wall"), -350.0f, -350.0f, -350.0f, 150.0f, 350.0f, 5.0f, false, false, -50.0f, 5.0f, 5.0f);
            Room.AddWall3D(Globals.GetTex("Wall"), -350.0f, 150.0f, 150.0f, 150.0f, 350.0f, 5.0f, false, false, -50.0f, 5.0f, 5.0f);
            Room.AddWall3D(Globals.GetTex("Wall"), 150.0f, 150.0f, 150.0f, -350.0f, 350.0f, 5.0f, false, false, -50.0f, 5.0f, 5.0f);
            Room.AddFloor(Globals.GetTex("Floor"), -350.0f, -350f, 150.0f, 150.0f, -50.0f, 20.0f, 20.0f, true);
            Room.AddFloor(Globals.GetTex("Floor"), -350.0f, -350.0f, 150.0f, 150.0f, 300.0f, 10.0f, 10.0f, true);
            Room.SetPosition((float)30.0f, (float)-30.0f, (float)150.0f);

            //Pridani stolku
            Obj1 = new TVMesh();
            Obj1 = Scene.CreateMeshBuilder("Obj1");
            Obj1.LoadXFile("Meshe\\stul.x", true, true);
            Obj1.SetPosition(-57.0f, -80.0f, 38.0f);
            Obj1.SetTexture(Globals.GetTex("Wood"), -1);
            Obj1.SetMeshName("other");

            Obj2 = new TVMesh();
            Obj2 = Scene.CreateMeshBuilder("Obj2");
            Obj2.LoadXFile("Meshe\\okraj.x", true, true);
            Obj2.SetPosition(xc + 17.5f, yc - 1.0f, zc + 17.5f);
            Obj2.SetTexture(Globals.GetTex("Wood2"), -1);
            Obj2.SetMeshName("other");
        }