Ejemplo n.º 1
0
        //public static void Main()
        //{
        //    new Tutorial().Go();
        //}

        protected override void CreateScene()
        {
            physics = new Physics();

            player = new Player(mSceneMgr);
            player.Model.SetPosition(new Vector3(50, 10, 100));
            playerStats = new PlayerStats();

            environment = new Environment(mSceneMgr, mWindow);

            cameraNode = mSceneMgr.CreateSceneNode();
            cameraNode.AttachObject(mCamera);
            player.Model.GameNode.AddChild(cameraNode);
            inputsManager.PlayerController = (PlayerController)player.Controller;

            hudElement = new GameInterface(mSceneMgr, mWindow, playerStats);
            mSceneMgr.ShadowTechnique = ShadowTechnique.SHADOWTYPE_STENCIL_MODULATIVE;

            testGun = new BombDropper(mSceneMgr);

            blueGems         = new List <BlueGem>();
            blueGemsToRemove = new List <BlueGem>();
            for (int i = 0; i < 5; i++)
            {
                BlueGem aBlueGem = new BlueGem(mSceneMgr, playerStats.Score);
                aBlueGem.SetPosition(new Vector3(Mogre.Math.RangeRandom(-500, 500), 10, Mogre.Math.RangeRandom(-500, 500)));

                blueGems.Add(aBlueGem);
            }

            redGems         = new List <RedGem>();
            redGemsToRemove = new List <RedGem>();
            for (int i = 0; i < 5; i++)
            {
                RedGem aRedGem = new RedGem(mSceneMgr, playerStats.Score);
                aRedGem.SetPosition(new Vector3(Mogre.Math.RangeRandom(-500, 500), 10, Mogre.Math.RangeRandom(-500, 500)));

                redGems.Add(aRedGem);
            }

            shieldPU         = new List <ShieldPU>();
            shieldPUToRemove = new List <ShieldPU>();
            for (int i = 0; i < 2; i++)
            {
                ShieldPU aShieldPU = new ShieldPU(mSceneMgr, playerStats.Shield);
                aShieldPU.SetPosition(new Vector3(Mogre.Math.RangeRandom(-500, 500), 10, Mogre.Math.RangeRandom(-500, 500)));

                shieldPU.Add(aShieldPU);
            }

            //robot1 = new Robot(mSceneMgr, playerStats.Lives);
            //robot1.InitialPosition(new Vector3(-300, 0, -200));
            //robot2 = new Robot(mSceneMgr, playerStats.Lives);
            //robot2.InitialPosition(new Vector3(100, 0, 300));
            //robot3 = new Robot(mSceneMgr, playerStats.Lives);
            //robot3.InitialPosition(new Vector3(-300, 0, 300));

            physics.StartSimTimer();
        }
        /// <summary>
        /// This method create the initial scene
        /// </summary>
        protected override void CreateScene()
        {
            physics = new Physics();

            player = new Player(mSceneMgr);

            cameraNode = mSceneMgr.CreateSceneNode();
            cameraNode.AttachObject(mCamera);
            player.Model.GameNode.AddChild(cameraNode);

            inputsManager.PlayerController = (PlayerController)player.Controller;


            robot  = new Robot(mSceneMgr);
            robot2 = new Robot(mSceneMgr);
            robot3 = new Robot(mSceneMgr);

            robot.RobotNode.Translate(100, -7, -100);
            robot2.RobotNode.Translate(200, -7, 200);
            robot3.RobotNode.Translate(-200, -7, -200);



            gemBlue = new BlueGem(mSceneMgr, ((PlayerStats)player.Stats).Score);

            gemBlue.GemNode.Translate(100, 0, 0);

            gemRed = new RedGem(mSceneMgr, ((PlayerStats)player.Stats).Score);

            gemRed.GemNode.Translate(200, 0, 0);



            shieldPU = new ShieldPU(mSceneMgr, player.Stats.Shield);

            shieldPU.PUNode.Translate(-100, 0, 0);

            lifePU = new LifePU(mSceneMgr, player.Stats.Lives);

            lifePU.PUNode.Translate(0, 0, 0);

            healthPU = new HealthPU(mSceneMgr, player.Stats.Health);

            healthPU.ControlNode.Translate(0, 300, 0);



            bombs         = new List <Bomb>();
            bombsToRemove = new List <Bomb>();



            wallLeft = new Cube(mSceneMgr);
            MeshPtr cubePtr = wallLeft.getCube("wallLeft", "Dirt", 20, 50, 1000);

            wallLeftEntity = mSceneMgr.CreateEntity("wallLeft_Entity", "wallLeft");
            wallLeftNode   = mSceneMgr.RootSceneNode.CreateChildSceneNode("wallLeft_Node");
            wallLeftNode.AttachObject(wallLeftEntity);

            wallLeftNode.Translate(500, 0, 0);

            wallRight = new Cube(mSceneMgr);
            MeshPtr wallRightPtr = wallRight.getCube("wallRight", "Dirt", 20, 50, 1000);

            wallRightEntity = mSceneMgr.CreateEntity("wallRight_Entity", "wallRight");
            wallRightNode   = mSceneMgr.RootSceneNode.CreateChildSceneNode("wallRight_Node");
            wallRightNode.AttachObject(wallRightEntity);

            wallRightNode.Translate(-500, 0, 0);

            wallTop = new Cube(mSceneMgr);
            MeshPtr wallTopPtr = wallTop.getCube("wallTop", "Dirt", 1000, 50, 20);

            wallTopEntity = mSceneMgr.CreateEntity("wallTop_Entity", "wallTop");
            wallTopNode   = mSceneMgr.RootSceneNode.CreateChildSceneNode("wallTop_Node");
            wallTopNode.AttachObject(wallTopEntity);

            wallTopNode.Translate(0, 0, 500);

            wallBottom = new Cube(mSceneMgr);
            MeshPtr wallBottomPtr = wallBottom.getCube("wallBottom", "Dirt", 1000, 50, 20);

            wallBottomEntity = mSceneMgr.CreateEntity("wallBottom_Entity", "wallBottom");
            wallBottomNode   = mSceneMgr.RootSceneNode.CreateChildSceneNode("wallBottom_Node");
            wallBottomNode.AttachObject(wallBottomEntity);

            wallBottomNode.Translate(0, 0, -500);



            PlayerStats playerStats = new PlayerStats();

            gameHMD = new GameInterface(mSceneMgr, mWindow, playerStats);

            environment = new Environment(mSceneMgr, mWindow);

            physics.StartSimTimer();
        }