Пример #1
0
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            var_Game = this;

            var_InputHandler = new InputHandler(this);
            var_SpriteBatch = new SpriteBatch(GraphicsDevice);

            var_GameCamera = new GameCamera(this);
            var_PlayerShip = new PlayerShip(this, Vector3.Zero, var_GameCamera);
            var_Director = new NewDirector(this, ChallengeLevel.Normal);
            var_SegmentGenerator = new SegmentGenerator(var_Game, ChallengeLevel.Normal, var_GameCamera, var_Director );
            var_Tunnel = new Tunnel(this);
            var_UI = new UI(this, var_SpriteBatch, var_PlayerShip.var_Health, var_PlayerShip.var_Bomb_Count);

            AssignSubscribers();

            base.Initialize();
        }
        public PlayerShip(ObserverGame game, Vector3 spawnPoint, GameCamera cameraIn)
            : base(game)
        {
            var_Model = game.Content.Load<Model>("Model\\StarFighter");

            sfxBoost = game.Content.Load<SoundEffect>("SFX\\boost");
            sfxBreak = game.Content.Load<SoundEffect>("SFX\\brake");
            sfxHitObstacle = game.Content.Load<SoundEffect>("SFX\\arwingHitObstacle");
            sfxSingleLaserShot = game.Content.Load<SoundEffect>("SFX\\arwingSingleLaserOneShot");
            sfxBombFired = game.Content.Load<SoundEffect>("SFX\\bombFireAndExplode");

            var_Position = spawnPoint;
            var_Previous_Position = var_Position;
            var_Velocity = 0;
            var_Axis_Of_Rotation = Vector3.Zero;
            var_Cooldown_Timer = 0;
            var_Bomb_Count = CONST_STARTING_BOMBS;
            var_Health = CONST_STARTING_HITPOINTS;
            var_Accellerate = false;

            var_Bounding_Circle = new BoundingCircle(3500);

            //var_Bounding_Region = new BoundingSphere(var_Position, 250);

            //var_Bounding_Region = new BoundingSphere(var_Position , 30);

            var_Bounding_Region = new BoundingSphere(new Vector3(var_Position.X, var_Position.Y, var_Position.Z - 560), 50);

            var_Ship_Bounding_Regions = new List<BoundingSphere>();
            //var_Ship_Bounding_Regions.Add(new BoundingSphere(var_Position, 30));

            camera = cameraIn;

            var_DrawableObjects.Add(this);

            game.Components.Add(this);
        }