public CollectableGun(SceneManager mSceneMgr, Gun gun, Armoury playerArmoury, Vector3 position)
        {
            // Initialize here the mSceneMgr, the gun and the playerArmoury fields to the values passed as parameters

            this.mSceneMgr     = mSceneMgr;
            this.gun           = gun;
            this.playerArmoury = playerArmoury;
            // Initialize the gameNode here, scale it by 1.5f using the Scale funtion, and add as its child the gameNode contained in the Gun object.
            // Finally attach the gameNode to the sceneGraph.
            //gunNode = new ModelElement(mSceneMgr);
            //gunNode.GameNode.Scale(new Vector3(1.5f, 1.5f, 1.5f));
            //gunNode.GameNode.AddChild(gun.GameNode);

            gameNode = mSceneMgr.CreateSceneNode();
            gameNode.AddChild(gun.modelNode);
            gameNode.Position = position;
            mSceneMgr.RootSceneNode.AddChild(gameNode);

            // Here goes the link to the physics engine
            // (ignore until week 8) ...
            physObj           = new PhysObj(10, "CollectableGun", 0.01f, 0.7f, 0.3f);
            physObj.SceneNode = gameNode;
            physObj.Position  = gameNode.Position;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            Physics.AddPhysObj(physObj);
        }
示例#2
0
 public Player(SceneManager mSceneMgr)
 {
     model         = new PlayerModel(mSceneMgr);
     controller    = new PlayerController(this);
     stats         = new PlayerStats();
     playerArmoury = new Armoury();
 }
示例#3
0
        /// <summary>
        // Constructor. Creates a new model, controller, stats and armoury for the player. Lists to store shot projectiles are also created.
        /// </summary>
        public Player(SceneManager mSceneMgr)
        {
            model         = new PlayerModel(mSceneMgr);    //model to an instance of the PlayerModel
            controller    = new PlayerController(this);    //As parameter for the constructor of the PlayerController class pass  this
            stats         = new PlayerStats();             //stats to an instance of PlayerStats
            playerArmoury = new Armoury(mSceneMgr);        //create a new playerArmoury for the player to hold collected guns

            projectiles         = new List <Projectile>(); //create a list to hold newly instantiated bullets shot by the player
            projectilesToRemove = new List <Projectile>(); //list to hold projectiles to be removed
        }
示例#4
0
 /// <summary>
 /// Constructor for class Player.
 /// </summary>
 public Player(SceneManager mSceneMgr, int robotNum)
 {
     this.mSceneMgr = mSceneMgr;
     model          = new PlayerModel(mSceneMgr);
     controller     = new PlayerController(this);
     stats          = new PlayerStats();
     playerArmoury  = new Armoury();
     this.robotNum  = robotNum;
     //playerArmoury.SwapGun(0);
 }
示例#5
0
        public CollectableGun(SceneManager mSceneMgr, Gun gun, Armoury playerArmoury)
        {
            // Initialize here the mSceneMgr, the gun and the playerArmoury fields to the values passed as parameters


            // Initialize the gameNode here, scale it by 1.5f using the Scale funtion, and add as its child the gameNode contained in the Gun object.
            // Finally attach the gameNode to the sceneGraph.

            // Here goes the link to the physics engine
            // (ignore until week 8) ...
        }
示例#6
0
        public CollectableGun(SceneManager mSceneMgr, Gun gun, Armoury playerArmoury)
        {
            // Initialize here the mSceneMgr, the gun and the playerArmoury fields to the values passed as parameters
            this.mSceneMgr = mSceneMgr;

            this.gun           = gun;
            this.playerArmoury = playerArmoury;

            // Initialize the gameNode here, scale it by 1.5f using the Scale funtion, and add as its child the gameNode contained in the Gun object.
            // Finally attach the gameNode to the sceneGraph.
            this.GameNode.AddChild(gun.GameNode);
            this.GameNode.Scale(new Vector3(1.5f, 1.5f, 1.5f));
            mSceneMgr.RootSceneNode.AddChild(this.GameNode);
            // Here goes the link to the physics engine
            // (ignore until week 8) ...
        }
示例#7
0
        //Initialize the mSceneMgr, the gun and the playerArmoury fields to the values passed as parameters
        public CollectableGun(SceneManager mSceneMgr, Gun g, Armoury pArmoury)
        {
            // Initialize here the mSceneMgr, the gun and the playerArmoury fields to the values passed as parameters
            this.mSceneMgr     = mSceneMgr;
            this.gun           = g;
            this.playerArmoury = pArmoury;

            gameNode = mSceneMgr.CreateSceneNode();         //Initialize the gameNode here
            gameNode.SetPosition(Mogre.Math.RangeRandom(-450, 450), 150, Mogre.Math.RangeRandom(-450, 450));

            gameNode.AddChild(gun.GameNode);                //add as its child the gameNode contained in the Gun object
            mSceneMgr.RootSceneNode.AddChild(gameNode);     //Finally attach the gameNode to the sceneGraph.

            //initialize the physics object and add a weight and friction force to it
            physObj           = new PhysObj(14f, "CollectableGun", 0.1f, 0.3f, 15f);
            physObj.SceneNode = gameNode;
            physObj.Position  = gameNode.Position;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            physObj.AddForceToList(new FrictionForce(physObj));
            Physics.AddPhysObj(physObj);
        }
示例#8
0
        public CollectableGun(SceneManager mSceneMgr, Gun gun, Armoury playerArmoury)
        {
            // Initialize here the mSceneMgr, the gun and the playerArmoury fields to the values passed as parameters
            this.mSceneMgr     = mSceneMgr;
            this.gun           = gun;
            this.playerArmoury = playerArmoury;

            collGunNode = mSceneMgr.CreateSceneNode();
            gameNode    = collGunNode;


            gameNode.AddChild(gun.GameNode);
            mSceneMgr.RootSceneNode.AddChild(gameNode);// <--

            physObj = new PhysObj(8, "Gun", 0.1f, 0.5f);
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            physObj.SceneNode = gameNode;

            Physics.AddPhysObj(physObj);

            //this.gameNode = gameNode;

            //this.gameNode = collGunNode;       // Initialize the gameNode
        }