This class represent the weapon attached to the player
Inheritance: CDrawableComponent
Exemplo n.º 1
0
        private void initializeGame1()
        {
            switch (StartScreen.Difficulty)
            {
                case Constants.Difficulties.Novice: difficultyConstants = new NoviceConstants(); break;
                case Constants.Difficulties.Advanced: difficultyConstants = new AdvancedConstants(); break;
                case Constants.Difficulties.Xtreme: difficultyConstants = new XtremeConstants(); break;
            }
            //camera = new FreeCamera(this, new Vector3(0, 0, 0), 0, 0, 0 , 0);
            //camera = new FreeCamera(new Vector3(400, 600, 400), MathHelper.ToRadians(45), MathHelper.ToRadians(-30), GraphicsDevice);
            camera = new ChaseCamera(this, Constants.CAMERA_POSITION_THIRD_PERSON, Constants.CAMERA_TARGET_THIRD_PERSON, Vector3.Zero);

            //for (int i = 0; i < Constants.NUM_OF_TERRAINS; i++)
            //{
                terrain = new Terrain(this, camera, Content.Load<Texture2D>("terrain"+currentLevel), Constants.TERRAIN_CELL_SIZE,
                    Constants.TERRAIN_HEIGHT, Content.Load<Texture2D>("grass"), Constants.TERRAIN_TEXTURE_TILING,
                    new Vector3(1, -1, 0)/*,new Vector2(i%2*-1,i/2*-1)*/);
                terrain.WeightMap = Content.Load<Texture2D>("weightMap"+currentLevel);
                terrain.RTexture = Content.Load<Texture2D>("sand");
                terrain.GTexture = Content.Load<Texture2D>("rock");
                terrain.BTexture = Content.Load<Texture2D>("snow");
                terrain.DetailTexture = Content.Load<Texture2D>("noise_texture");
            //}
            player = initializePlayer();
            sky = intitializeSky();
            initializeClouds();

            initializeTrees();
            //trees = initializeBillBoard(100, "tree_billboard", true, Constants.TREE_SIZE,true);
            grass = initializeBillBoard(300, "grass_billboard", false, Constants.GRASS_SIZE,false);

            weapon = new Weapon(this, player, Content.Load<Model>("model//WeaponMachineGun"),
                new Unit(this, Vector3.Zero, Vector3.Zero, Vector3.One));
            bullets = new BulletsManager(this);
            scoreBoard = new ScoreBoard(this);
            monsters = new MonstersManager(this);
            firstAidManger = new FirstAidManager(this);

            //testing = new CDrawableComponent(this, new Unit(this, new Vector3(0,terrain.GetHeightAtPosition(0,0),0),
            //    Vector3.Zero,new Vector3(5f)),
            //    new CModel(this, Content.Load<Model>("firtree1")));

            //waterMesh = new CModel(game.Content.Load<Model>("plane"), position,
            //   Vector3.Zero, new Vector3(size.X, 1, size.Y), game.GraphicsDevice);
            water = new Water(this,Content.Load<Model>("plane"),
                new WaterUnit(this, new Vector3(0,Constants.WATER_HEIGHT,0), Vector3.Zero, new Vector3(10240,1,10240)));
            ((WaterUnit)water.unit).Objects.Add(sky);
            //((WaterUnit)water.unit).Objects.Add(terrain);
            stateManager = new StateManager(this);
            audioManager = new AudioManager(this);

            frameRateCounter = new FrameRateCounter(this);

            kinectManager = new KinectManager(this);
            //CDrawableComponent test = new CDrawableComponent(this,
            //    new Unit(this, new Vector3(0, 80, 0), Vector3.Zero, Vector3.One * .5f),
            //    new CModel(this, Content.Load<Model>(@"model/First Aid Kit2")));
            //mediator.fireEvent(MyEvent.G_StartGame);
        }
Exemplo n.º 2
0
        private void initializeGame1()
        {
            switch (StartScreen.Difficulty)
            {
                case Constants.Difficulties.Novice: difficultyConstants = new NoviceConstants(); break ;
                case Constants.Difficulties.Advanced: difficultyConstants = new AdvancedConstants(); break;
                case Constants.Difficulties.Xtreme: difficultyConstants = new XtremeConstants(); break;

            }
            //camera = new FreeCamera(this, new Vector3(0, 0, 0), 0, 0, 0 , 0);
            //camera = new FreeCamera(new Vector3(400, 600, 400), MathHelper.ToRadians(45), MathHelper.ToRadians(-30), GraphicsDevice);
            camera = new ChaseCamera(this, Constants.CAMERA_POSITION, Constants.CAMERA_TARGET, Vector3.Zero);
            terrain = new Terrain(this, camera, Content.Load<Texture2D>("terrain"), Constants.TERRAIN_CELL_SIZE,
                Constants.TERRAIN_HEIGHT, Content.Load<Texture2D>("grass"), Constants.TERRAIN_TEXTURE_TILING, new Vector3(1, -1, 0));

            player = initializePlayer();
            sky = intitializeSky();

            weapon = new Weapon(this, player, Content.Load<Model>("model//WeaponMachineGun"),
                new Unit(this, Vector3.Zero, Vector3.Zero, Vector3.One));
            bullets = new BulletsManager(this);
            scoreBoard = new ScoreBoard(this);
            monsters = new MonstersManager(this);
               firstAidManger = new FirstAidManager(this);

            stateManager = new StateManager(this);
            audioManager = new AudioManager(this);

            //CDrawableComponent test = new CDrawableComponent(this,
            //    new Unit(this, new Vector3(0, 80, 0), Vector3.Zero, Vector3.One * .5f),
            //    new CModel(this, Content.Load<Model>(@"model/First Aid Kit2")));
        }