Ejemplo n.º 1
0
 void FixedUpdate()
 {
     rigidbody.MovePosition(rigidbody.position + Ground.ProjectOnPlane(Velocity) * Time.fixedDeltaTime);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// This method create the initial scene
        /// </summary>
        protected override void CreateScene()
        {
            physics = new Physics();

            player = new Player(this.mSceneMgr);

            timer = new Timer();

            gameHMD = new GameInterface(mSceneMgr, mWindow, player.Stats, timer);

            bombDropperGun = new BombDropperGun(mSceneMgr);
            ((PlayerModel)player.Model).AttachGun(bombDropperGun);
            ///CAMERA
            cameraNode = mSceneMgr.CreateSceneNode();
            cameraNode.AttachObject(mCamera);
            ///((PlayerModel)player.Model).Body.AddChild(cameraNode); //Tells it that you are expecting a player model instead of a character model. Called casting

            player.Model.GameNode.AddChild(cameraNode);
            player.Model.SetPosition(new Vector3(0, 20, 0));

            ///inputManager.PlayerModel = playerModel;
            inputManager.PlayerController = (PlayerController)player.Controller;

            //cannonBall = new CannonBall(mSceneMgr);
            //cube = new Cube(this.mSceneMgr);
            //cube.Load();
            ///cube.SetPosition(new Vector3(20f, 20f, 20f));

            /////ENEMY MODEL

            //enemy2 = new Enemy(this.mSceneMgr);

            //enemy3 = new Enemy(this.mSceneMgr);
            //enemy4 = new Enemy(this.mSceneMgr);

            /////ENEMY POSITION


            //enemy2.Model.SetPosition(new Vector3(400, 0, -200));

            //enemy3.Model.SetPosition(new Vector3(-300, 0, 300));
            //enemy4.Model.SetPosition(new Vector3(400, 0, 400));



            ///GEMS
            blueGems        = new List <BlueGem>();
            blueGemToRemove = new List <BlueGem>();
            spawnBlueGems();

            redGems        = new List <RedGem>();
            redGemToRemove = new List <RedGem>();
            spawnRedGems();


            timerPUs        = new List <TimerPU>();
            timerPUToRemove = new List <TimerPU>();

            spawnTimePU();

            healthPus        = new List <HealthPU>();
            healthPuToRemove = new List <HealthPU>();

            spawnHealthPU();


            Random rnd = new Random();
            float  x;
            float  z;

            ///POWER UPS
            lifePus        = new List <LifePU>();
            lifePuToRemove = new List <LifePU>();

            spawnLifePU();

            shieldPus        = new List <ShieldPU>();
            shieldPuToRemove = new List <ShieldPU>();

            spawnShieldPU();

            cannonBalls        = new List <CannonBall>();
            cannonBallToRemove = new List <CannonBall>();


            ///ENEMIES
            enemys         = new List <Enemy>();
            enemysToRemove = new List <Enemy>();
            for (var enemyCount = 0; enemyCount < 4; enemyCount++)
            {
                x = rnd.Next(-400, 400);
                z = rnd.Next(-400, 400);

                enemy = new Enemy(mSceneMgr, (PlayerStats)player.Stats);
                enemy.SetPosition(new Vector3(x, 0, z));


                enemys.Add(enemy);
                enemy.Movement.Walking();
            }
            ///AddBomb();
            bombs        = new List <Bomb>();
            bombToRemove = new List <Bomb>();
            spawnBombs();



            ///ENVIRONMENT
            environment = new Environment(mSceneMgr, mWindow);
            ground      = new Ground(mSceneMgr);
            border      = new Boundary(mSceneMgr);
            player.Model.GameNode.AttachObject(environment.Light);


            ///cube.Quad();

            physics.StartSimTimer();
        }