Ejemplo n.º 1
0
 /// <summary>
 /// This method initializes the stats objects, initial values are to be set in derived classes
 /// </summary>
 override protected void InitStats()
 {
     health = new Stat();
     shield = new Stat();
     shield.InitValue(100);
     health.InitValue(100);
 }
Ejemplo n.º 2
0
 ///// <summary>
 // Sets the max ammo value for the gun and loads the model
 ///// </summary>
 public Cannon(SceneManager mSceneMgr)
 {
     this.mSceneMgr = mSceneMgr;  //Initialize the scene manager to the parameter you just passed;
     maxAmmo        = 25;         //Initialize the maxAmmo field to a certain value
     ammo           = new Stat(); //Initialize the field ammo to a new Stat object
     ammo.InitValue(maxAmmo);     //Set the initial value of ammo to maxAmmo using the InitValue method of ammo
     LoadModel();                 //Call the LoadModel method
 }
 public Cannon(SceneManager mSceneMgr, Vector3 position)
 {
     this.mSceneMgr = mSceneMgr;
     ammo           = new Stat();
     maxAmmo        = 10;
     ammo.InitValue(maxAmmo);
     LoadModel();
 }
Ejemplo n.º 4
0
 /// <summary>
 /// This class set up the initial values for each player stat
 /// </summary>
 protected override void InitStats()
 {
     base.InitStats();
     score = new Score();
     score.InitValue(0);
     health.InitValue(100);
     shield.InitValue(100);
     lives.InitValue(3);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// This class set up the initial values for each player stat
 /// </summary>
 protected override void InitStats()
 {
     base.InitStats();
     score = new Score();
     score.InitValue(0);
     health.InitValue(100);
     shield.InitValue(100);
     lives.InitValue(3);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// This method initializes the stats objects, initial values are to be set in derived classes
 /// </summary>
 override protected void InitStats()
 {
     lives  = new Stat();
     health = new Stat();
     shield = new Stat();
     score  = new Stat();
     score.InitValue(0);
     shield.InitValue(100);
     health.InitValue(100);
     lives.InitValue(5);
 }
Ejemplo n.º 7
0
        /// <summary>
        /// This method creates the initial scene
        /// </summary>
        protected override void CreateScene()
        {
            gameOver = false;
            physics  = new Physics();
            // Lights
            environment = new Environment(mSceneMgr, mWindow);
            // Add cubes and floor
            obstacle_cube = new List <CubeModel>();
            int a;

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

            for (a = 0; a < cubeNum; a++)
            {
                x    = rnd.Next(-2000, 2000);
                z    = rnd.Next(-2000, 2000);
                cube = new CubeModel(mSceneMgr, a, x, 150, z);
                obstacle_cube.Add(cube);
                obstacle_cube[a].GameNode.SetPosition(x, 150, z);
                obstacle_cube[a].GameNode.Scale(new Vector3(1.25f, 1.25f, 1.25f));
            }

            // Add Camera
            cameraNode = mSceneMgr.CreateSceneNode();
            cameraNode.AttachObject(mCamera);
            // Add Player
            robots      = new List <Robot>();
            robotNum    = 60;
            player      = new Player(mSceneMgr, robotNum);
            playerModel = player.Model as PlayerModel;
            playerModel.AddChild(cameraNode);
            player.Model = playerModel;
            player.Model.GameNode.Translate(new Vector3(0, 80, 0));
            inputsManager.PlayerController = (PlayerController)player.Controller;
            // Add Robots

            for (a = 0; a < robotNum; a++)
            {
                x           = rnd.Next(-2000, 2000);
                z           = rnd.Next(-2000, 2000);
                robot       = new Robot(mSceneMgr, a, x, 0, z);
                robotModel  = robot.Model as RobotModel;
                robot.Model = robotModel;
                robots.Add(robot);
                robots[a].Model.GameNode.SetPosition(x, 180, z);
            }

            // HUD
            gameHMD      = new GameInterface(mSceneMgr, mWindow, player.Stats);
            gameHMD.Time = new Timer();

            //Collectables
            x      = rnd.Next(-200, 200);
            z      = rnd.Next(-200, 200);
            cannon = new Cannon(mSceneMgr, x, 100, z);

            cannon.GameNode.SetPosition(x, 180, z);
            cannon.GameNode.Scale(new Vector3(2f, 2f, 2f));
            ammoFill = new Stat();
            ammoFill.InitValue(20);
            gems_ammo         = new List <GemAmmo>();
            gems_ammo_remover = new List <GemAmmo>();
            gemNum            = 100;
            for (a = 0; a < gemNum; a++)
            {
                x    = rnd.Next(-2000, 2000);
                z    = rnd.Next(-2000, 2000);
                ammo = new GemAmmo(mSceneMgr, ammoFill, x, 50, z, a);
                gems_ammo.Add(ammo);
                gems_ammo[a].GameNode.SetPosition(x, 50, z);
                gems_ammo[a].GameNode.Scale(new Vector3(5f, 5f, 5f));
            }
            gems_health         = new List <GemHealth>();
            gems_health_remover = new List <GemHealth>();
            gemNum2             = 20;
            for (a = 0; a < gemNum2; a++)
            {
                x      = rnd.Next(-2000, 2000);
                z      = rnd.Next(-2000, 2000);
                health = new GemHealth(mSceneMgr, healthFill, x, 50, z, a);
                gems_health.Add(health);
                gems_health[a].GameNode.SetPosition(x, 50, z);
                gems_health[a].GameNode.Scale(new Vector3(5f, 5f, 5f));
            }
            healthFill = new Stat();
            healthFill.InitValue(100);
            //health = new GemHealth(mSceneMgr, ammoFill);
            // health.GameNode.Translate(new Vector3(-200, 8, -200));
            //health.GameNode.Scale(new Vector3(5f, 5f, 5f));
            physics.StartSimTmer();
        }