예제 #1
0
        protected override void Initialize()
        {
            FontMgr = new ResourceManager<SpriteFont>(this);
            TextureMgr = new ResourceManager<Texture2D>(this);
            ModelMgr = new ResourceManager<Model>(this);
            MusicMgr = new ResourceManager<Song>(this);
            SfxMgr = new ResourceManager<SoundEffect>(this);

            LoadAssets();

            PressStartScreen = TextureMgr.Find("startscreen");
            PressStartRectangle = new Rectangle(0, 0, Window.ClientBounds.Width, Window.ClientBounds.Height);
            Texture2D pauseTex = TextureMgr.Find("pause");
            PausedRectangle = new Rectangle((Window.ClientBounds.Width - pauseTex.Width) / 2, (Window.ClientBounds.Height - pauseTex.Height) / 2,
                                            pauseTex.Width, pauseTex.Height);

            MediaPlayer.Play(MusicMgr.Find("RenditionIntro"));

            FpsHandler = new FpsCounter(this, FPS_INTERVAL);
            InputMgr = new InputManager(this);
            ModelDisplayer = new ModelDisplay(this);
            HeadsUpDisplay = new HUD(this);

            Car = new Vehicle(this, "L200-FBX", new Vector3(80, 80, -80), 0.01f, new Vector3(0, MathHelper.Pi, 0));
            Ground = new Terrain(this, new Vector3(0, 0, 0), "colormap", "heightmap", 7.0f, 0.15f);
            GameTrack = new Track(this, Ground);

            GameCamera = Car.Camera;
            //GameCamera = new FreeCamera(this, new Vector3(0, 0, 2), Vector3.Zero, Vector3.Zero);

            Components.Add(FpsHandler);
            Components.Add(InputMgr);
            Components.Add(ModelDisplayer);
            Components.Add(GameTrack);
            Components.Add(Car); //Mettre GameCamera apres Car pour eviter les problemes

            Components.Add(GameCamera);

            //Laisser FpsDisplayer a la fin de la liste pour eviter les problemes d'affichage
            Components.Add(HeadsUpDisplay);

            base.Initialize();

            Car.Enabled = false;
            HeadsUpDisplay.ToggleChronometer();
        }
예제 #2
0
파일: Track.cs 프로젝트: abusque/racexna
 public Track(RacingGame game, Terrain ground)
     : base(game)
 {
     RaceGame = game;
     Ground = ground;
 }
예제 #3
0
        public void SetInitialHeight(Terrain terrain)
        {
            Vector3 newPos = new Vector3(Position.X, Position.Y, Position.Z);

            terrain.GetHeight(newPos, out newPos.Y);
            Position = newPos;

            World = Matrix.CreateScale(Scale) * Orientation * Matrix.CreateTranslation(Position);

            CreateSpheres();
            CreateBoxes();
        }