Esempio n. 1
0
        public override void Dispose()
        {
#if DEBUG
            DebugEffect.Dispose();
#endif
            GameConsole.CleanUp();
            base.Dispose();
        }
Esempio n. 2
0
        //Default Utopia Init method.
        private void NormalInit()
        {
            #region Debug Components
#if DEBUG
            _axis = new Axis(this, 10);         // Use to display the X,Y,Z axis
            GameComponents.Add(_axis);
            DebugEffect.Init(this);             // Default Effect used by debug componant (will be shared)
#endif
            #endregion

            _clock = new GameClock.Clock(this, 120, GameClock.GameTimeMode.Automatic, (float)Math.PI * 1f, InputHandler);     // Clock creation, manage Utopia time
            GameComponents.Add(_clock);

            ICamera camera = new FirstPersonCamera(this); // Create a firstPersonCAmera viewer

            TerraCubeProfile.InitCubeProfiles();          // Init the cube factory

            WorldFocus = (IWorldFocus)camera;             //Set the World Focus on my Camera

            //Create an entity, link to camera to it.
            _player = new Entities.Living.Player(this, "s33m3", camera, InputHandler,
                                                 new DVector3((TerraWorld.Worldsize.X / 2.0) + TerraWorld.WorldStartUpX, 90, (TerraWorld.Worldsize.Z / 2.0f) + TerraWorld.WorldStartUpZ),
                                                 new Vector3(0.5f, 1.9f, 0.5f),
                                                 5f, 30f, 10f)
            {
                Mode = Entities.Living.LivingEntityMode.FreeFirstPerson     //Defaulted to "Flying" mode
            };
            GameComponents.Add(_player);

            //Attached the Player to the camera =+> The player will be used as Camera Holder !
            camera.CameraPlugin = _player; //The camera is using the _player to get it's world positions and parameters, so the _player updates must be done BEFORE the camera !
            GameComponents.Add(camera);

            _universe = new Univers.Universe(this, _clock, _player, "S33m3's World");
            GameComponents.Add(_universe);

            _fps = new FPS(this);
            GameComponents.Add(_fps);

            _gui = new Sprites2D.GUI(this);
            GameComponents.Add(_gui);

            _debugInfo           = new DebugInfo(this);
            _debugInfo.Activated = true;
            _debugInfo.SetComponants(_fps, _clock, _universe, _player);
            GameComponents.Add(_debugInfo);

            GameConsole.Initialize(this);

            //Set Default Camera !
            base.ActivCamera = camera;
        }