Beispiel #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="mSceneMgr"></param>
 public Player(SceneManager mSceneMgr)
 {
     this.mSceneMgr = mSceneMgr;
     model          = new PlayerModel(mSceneMgr);
     controller     = new PlayerController(this);
     stats          = new PlayerStats();
     armoury        = new Armoury();
     time           = new Timer();
     invulnerable   = 1000;
     this.isDead    = false;
 }
Beispiel #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="mSceneMgr">Scene Manager</param>
        /// <param name="gun">Gun</param>
        /// <param name="playerArmoury">Player's Armoury</param>
        public CollectableGun(SceneManager mSceneMgr, Gun gun, Armoury playerArmoury)
        {
            //Initializing values
            this.mSceneMgr     = mSceneMgr;
            this.gun           = gun;
            this.playerArmoury = playerArmoury;

            //Creating and attaching scenenode containing the gun model
            this.gameNode = mSceneMgr.CreateSceneNode();
            this.gameNode.Scale(new Vector3(1.5f, 1.5f, 1.5f));
            this.gameNode.AddChild(gun.GameNode);
            mSceneMgr.RootSceneNode.AddChild(this.gameNode);


            //Link to physics engine
            this.physObj      = new PhysObj(10, "Gun", 0.1f, 0.5f);
            physObj.SceneNode = gameNode;
            physObj.AddForceToList(new WeightForce(physObj.InvMass));
            physObj.AddForceToList(new FrictionForce(physObj));
            Physics.AddPhysObj(physObj);
        }