예제 #1
0
        public Physics(Game game, Player player, ContentManager Content, TanksOnAHeightmap.GameBase.Shapes.Terrain terrain, Space space)
        {
            Cannon = new Cannon(game, player.tank);
            CannonBallManager = new CannonBallManager(game);
            EnemyCannon.playerTank = player.tank;

            healthManager = new HealthManager(game, space);
            this.Content = Content;
            this.Components = game.Components;
            this.game = game;
            this.player = player;
            this.tank = player.tank;
            this.terrain = terrain;
            this.space = space;
        }
예제 #2
0
        private void start()
        {
            badGuys = new Enemy[NUMBER_OF_ENEMYS];


            player = new Player(this, Content, graphics, UnitTypes.PlayerType.TankPlayer);
            player.tank.setPosition(player.tank.Orientation.Translation + new Vector3(300, 0, 150));
            player.WorldTrees = trees;
            #region  Constructor Physic
            space = new Space();
            EnemyCannonBall.EnemyCannonBallCollisionGroup = new CollisionGroup();
            Enemy.EnemyTankCollisionGroup = new CollisionGroup();
            Physic = new Physics(this, player, Content, terrain, space);
            player.phisics = Physic;
            #endregion

            Vector3 temp;
            Components.Add(terrain);
            for (int i = 0; i < badGuys.Length; i++)
            {
                temp = new Vector3(((float)rand.NextDouble() - 0.5f) * 512 * 8, 0, ((float)rand.NextDouble() - 0.5f) * 512 * 8);
                badGuys[i] = new Enemy(this, Content, graphics, UnitTypes.EnemyType.TankEnemy, space, temp);
                badGuys[i].tank.setPosition(temp);
                badGuys[i].Player = player;
                badGuys[i].State = Enemy.EnemyState.Wander;
                badGuys[i].WorldTrees = trees;
                badGuys[i].phisics = Physic;
                badGuys[i].healthManager = Physic.healthManager;
                //badGuys[i].DrawOrder = 102;
                Components.Add(badGuys[i]);
            }
            player.EnemyList = badGuys;


            //tank.DrawOrder = 100;
            player.DrawOrder = 101;

            // Register the particle system components.
            //Components.Add(tank);


            Components.Add(player);
            Components.Add(explosionParticles);
            Components.Add(explosionSmokeParticles);
            Components.Add(projectileTrailParticles);
            for (int i = 0; i < trees.Length; i++)
            {
                trees[i].DrawOrder = 102;
                Components.Add(trees[i]);
            }
            // Game Screen
            //Components.Add(new GameScreen(this, player));
            gameScreen = new GameScreen(this, player);
            Components.Add(gameScreen);
        }