コード例 #1
0
        /// <summary>
        /// Ordinary constructor.
        /// </summary>
        /// <param name="game">The main CanyonShooter game object</param>
        public Player2(ICanyonShooterGame game)
            : base(game, "PlayerElcode")
        {
            EnabledChanged += (Player2_EnabledChanged);
            hasSpaceMouse   = game.HasSpaceMouse;
            if (hasSpaceMouse)
            {
                device = ((CanyonShooterGame)game).device;
            }
            // Set player profile values
            SetModel(game.GameStates.Profil.CurrentProfil.Model);
            BankingFactor  = game.GameStates.Profil.CurrentProfil.Banking;
            DriftFactor    = game.GameStates.Profil.CurrentProfil.Drift;
            TranslationGap = game.GameStates.Profil.CurrentProfil.Translation;
            RollFactor     = game.GameStates.Profil.CurrentProfil.Rolling;
            MaxDecay       = game.GameStates.Profil.CurrentProfil.Brake;
            AutoLevel      = game.GameStates.Profil.CurrentProfil.AutoLevel;
            Health         = game.GameStates.Profil.CurrentProfil.Health;
            MinSpeed       = game.GameStates.Profil.CurrentProfil.Speed;
            Shield         = game.GameStates.Profil.CurrentProfil.Shield;
            SpeedGap       = game.GameStates.Profil.CurrentProfil.Acceleration;

            // Initialize player environment
            LocalPosition       = new Vector3(0, 0, 0);
            ConnectedToXpa      = true;
            ContactGroup        = ContactGroup.Player;
            InfluencedByGravity = false;
            this.game           = game;
            SetCamera(game);

            // Set sound listener for 3D sound
            listener = new SoundListener(game);
            game.Sounds.SoundListener = listener;
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CanyonShooterGame"/> class.
        /// </summary>
        public CanyonShooterGame(string[] args)
        {
            Args   = new Arguments(args);
            states = new GameStates(this, Components);
            config = new Config();
            graphicsDeviceManager = new GraphicsDeviceManager(this);
            content = new ContentManager(Services);

            graphics          = new Graphics(this, graphicsDeviceManager);
            this.Window.Title = " CanyonShooter";

            Intercom.Game = this;

            #region Commandline Parameter Settings:

            #region Parameter: --setShaderModel

            if (Args["setShaderModel"] == "2")
            {
                graphics.ShaderModel3SupportedOverride = true;
            }
            #endregion

            #region Parameter: --debug

            if (Args["debug"] == "1")
            {
                debugMode = true;
            }
            #endregion

            #region Parameter: --multiThreaded
            // Physik Intialisierung

            /*if (Args["multiThreaded"] != null)
             * {
             *  if(Args["multiThreaded"] == "1")
             *      physics = new Physics(this, true);
             *  else
             *  {
             *      physics = new Physics(this, false);
             *      Components.Add(physics);
             *  }
             * }
             * else*/// automatically set threading-mode
            {
                /*if (Environment.ProcessorCount > 1)
                 * {
                 *  physics = new Physics(this, true);
                 * }
                 * else*/
                {
                    physics = new Physics(this, false);
                    Components.Add(physics);
                }
            }
            #endregion

            #region Parameter: --testAudio
            // Test Audio Framework *******************************
            if (Args["testAudio"] == "1")
            {
                TestAudioPlayback test1 = new TestAudioPlayback();
                test1.SetUp(this);
                test1.TestMinigunPlayback();
                test1.TearDown();

                TestAudio3D test2 = new TestAudio3D();
                test2.SetUp(this);
                test2.TestPlayback3D();
                test2.TearDown();
            }
            #endregion

            #endregion

            // Create sound system by M.Rodriguez
            sounds = new SoundSystem(this);

            // Set global volumes by M.Rodriguez
            sounds.EffectVolume = 1.0f;
            sounds.MusicVolume  = 0.3f;

            // Initialisieren der einzelnen Komponenten:
            input      = new Input(this);
            renderer   = new Renderer(this, Components);
            effects    = new EffectFactory(this);
            highscores = new Highscores(this);

            GraphicalConsole.GetSingleton(this).RegisterObjectProperty(graphics, "Graphics", "Fullscreen");

            GraphicalConsole.GetSingleton(this).RegisterObjectProperty(renderer, "Renderer", "DrawCollisionShapes");

            GraphicalConsole.GetSingleton(this).RegisterObjectFunction(Args, "Args", "ListParameters");
            if (Args["enable3DMouse"] == "1")
            {
                hasSpaceMouse = true;
                device        = new TDxInput.Device();
            }
            states.SetStateStart();

            // states.SetStateDebugMode();
        }