Esempio n. 1
0
        // new  CharacterStats stats;                 // This field is to contain an instance of the CharacterStats
        //new CharacterModel model;                 // This field is to contain an instance of the CharacterModel
        //new bool isDead;                  // This field is to determine weter the caracter is dead

        /// <summary>
        /// Constructor for class Player.
        /// </summary>
        public Robot(SceneManager mSceneMgr, int index, float x, float y, float z)
        {
            this.mSceneMgr = mSceneMgr;
            model          = new RobotModel(mSceneMgr, index, x, y, z);
            controller     = new RobotController(this);
            stats          = new RobotStats();
        }
Esempio n. 2
0
 /// <summary>
 /// This class implements a robot
 /// </summary>
 ///
 public Robot(SceneManager mSceneMgr, Player playerr, bool isBoss)
 {
     this.mSceneMgr  = mSceneMgr;        //Initialize the scene manager to the parameter you just passed;
     boss            = isBoss;           //determines whether the robot is a boss
     model           = new RobotModel(mSceneMgr, playerr, boss);
     stats           = new EnemyStats(); //stats to an instance of EnemyStats
     this.player     = playerr;
     playerCollision = false;
     //robotController = new EnemyController(this);
     shooting = false;
 }
Esempio n. 3
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();
        }