當前位置: 首頁>>代碼示例>>C#>>正文


C# Engine.Game類代碼示例

本文整理匯總了C#中SiliconStudio.Xenko.Engine.Game的典型用法代碼示例。如果您正苦於以下問題:C# Game類的具體用法?C# Game怎麽用?C# Game使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Game類屬於SiliconStudio.Xenko.Engine命名空間,在下文中一共展示了Game類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: TestAddRemoveListenerImpl

        private void TestAddRemoveListenerImpl(Game game)
        {
            var audio = game.Audio;
            var notAddedToEntityListener = new AudioListenerComponent();
            var addedToEntityListener = new AudioListenerComponent();

            // Add a listenerComponent not present in the entity system yet and check that it is correctly added to the AudioSystem internal data structures
            Assert.DoesNotThrow(() => audio.AddListener(notAddedToEntityListener), "Adding a listener not present in the entity system failed");
            Assert.IsTrue(audio.Listeners.ContainsKey(notAddedToEntityListener), "The list of listeners of AudioSystem does not contains the notAddedToEntityListener.");

            // Add a listenerComponent already present in the entity system and check that it is correctly added to the AudioSystem internal data structures
            var entity = new Entity("Test");
            entity.Add(addedToEntityListener);
            throw new NotImplementedException("TODO: UPDATE TO USE Scene and Graphics Composer"); 
            //game.Entities.Add(entity);
            Assert.DoesNotThrow(() => audio.AddListener(addedToEntityListener), "Adding a listener present in the entity system failed");
            Assert.IsTrue(audio.Listeners.ContainsKey(addedToEntityListener), "The list of listeners of AudioSystem does not contains the addedToEntityListener.");

            // Add a listenerComponent already added to audio System and check that it does not crash
            Assert.DoesNotThrow(()=>audio.AddListener(addedToEntityListener), "Adding a listener already added to the audio system failed.");

            // Remove the listeners from the AudioSystem and check that they are removed from internal data structures.
            Assert.DoesNotThrow(() => audio.RemoveListener(notAddedToEntityListener), "Removing an listener not present in the entity system failed.");
            Assert.IsFalse(audio.Listeners.ContainsKey(notAddedToEntityListener), "The list of listeners of AudioSystem still contains the notAddedToEntityListener.");
            Assert.DoesNotThrow(() => audio.RemoveListener(addedToEntityListener), "Removing an listener present in the entity system fails");
            Assert.IsFalse(audio.Listeners.ContainsKey(addedToEntityListener), "The list of listeners of AudioSystem still contains the addedToEntityListener.");

            // Remove a listener not present in the AudioSystem anymore and check the thrown exception
            Assert.Throws<ArgumentException>(() => audio.RemoveListener(addedToEntityListener), "Removing the a non-existing listener did not throw ArgumentException.");
        }
開發者ID:h78hy78yhoi8j,項目名稱:xenko,代碼行數:30,代碼來源:TestAudioSystem.cs

示例2: OneLoopTurnActionAftUpdate

            public void OneLoopTurnActionAftUpdate(Game game)
            {
                oneLoopTurnActionAftUpdate?.Invoke(game, loopCount, loopCountSum);

                ++loopCount;
                loopCountSum += loopCount;
            }
開發者ID:Kryptos-FR,項目名稱:xenko-reloaded,代碼行數:7,代碼來源:TestUtilities.cs

示例3: Main

 static void Main(string[] args)
 {
     using (var game = new Game())
     {
         game.Run();
     }
 }
開發者ID:cg123,項目名稱:xenko,代碼行數:7,代碼來源:SimpleParticlesApp.cs

示例4: CheckTextureFormat

 private static void CheckTextureFormat(Game game, string textureUrl, AlphaFormat expectedFormat)
 {
     var expectedPixelFormat = PlaformAndAlphaToPixelFormats[Tuple.Create(Platform.Type, expectedFormat)];
     var texture = game.Asset.Load<Texture>(textureUrl);
     Assert.AreEqual(expectedPixelFormat, texture.Format);
     game.Asset.Unload(texture);
 }
開發者ID:hsabaleuski,項目名稱:paradox,代碼行數:7,代碼來源:AutoAlphaTests.cs

示例5: TestScriptAudioAccessImpl

 private static void TestScriptAudioAccessImpl(Game game)
 {
     using (var script = new ScriptClass(game.Services))
     {
         Assert.DoesNotThrow(() => script.AccessAudioService(), "Access to the audio service failed.");
         Assert.IsTrue(script.AudioServiceNotNull(), "The Audio service is null.");
     }
 }
開發者ID:h78hy78yhoi8j,項目名稱:xenko,代碼行數:8,代碼來源:TestScriptContext.cs

示例6: TestInitializeAudioEngine

 private void TestInitializeAudioEngine(Game game)
 {
     var audio = game.Audio;
     AudioEngine audioEngine = null;
     Assert.DoesNotThrow(()=>audioEngine = audio.AudioEngine, "Failed to get the AudioEngine");
     Assert.IsNotNull(audioEngine, "The audio engine is null");
     Assert.IsFalse(audioEngine.IsDisposed, "The audio engine is disposed");
 }
開發者ID:h78hy78yhoi8j,項目名稱:xenko,代碼行數:8,代碼來源:TestAudioSystem.cs

示例7: EntityPositionUpdate

        private void EntityPositionUpdate(Game game, int loopCount, int loopCountSum)
        {
            rootSubEntity1.Transform.Position += new Vector3(loopCount, 2 * loopCount, 3 * loopCount);
            rootSubEntity2.Transform.Position += new Vector3(loopCount, 2 * loopCount, 3 * loopCount);

            listComp1Entity.Transform.Position += new Vector3(loopCount, 2 * loopCount, 3 * loopCount);
            listComp2Entity.Transform.Position -= new Vector3(loopCount, 2 * loopCount, 3 * loopCount);
        }
開發者ID:Kryptos-FR,項目名稱:xenko-reloaded,代碼行數:8,代碼來源:TestAudioListenerProcessor.cs

示例8: OneLoopTurnActionAftUpdate

            public void OneLoopTurnActionAftUpdate(Game game)
            {
                if (oneLoopTurnActionAftUpdate != null)
                    oneLoopTurnActionAftUpdate(game, loopCount, loopCountSum);

                ++loopCount;
                loopCountSum += loopCount;
            }
開發者ID:cg123,項目名稱:xenko,代碼行數:8,代碼來源:TestUtilities.cs

示例9: TestSoundMusicLoadingImpl

 private static void TestSoundMusicLoadingImpl(Game game)
 {
     SoundMusic sound = null;
     Assert.DoesNotThrow(() => sound = game.Content.Load<SoundMusic>("EffectBip"), "Failed to load the SoundMusic.");
     Assert.IsNotNull(sound, "The SoundMusic loaded is null.");
     sound.Play();
     // Should hear the sound here.
 }
開發者ID:cg123,項目名稱:xenko,代碼行數:8,代碼來源:TestAssetLoading.cs

示例10: Main

 static void Main(string[] args)
 {
     // Profiler.EnableAll();
     using (game = new Game())
     {
         game.GraphicsDeviceManager.DeviceCreated += GraphicsDeviceManager_DeviceCreated;
         game.Run();
     }
 }
開發者ID:EmptyKeys,項目名稱:UI_Examples,代碼行數:9,代碼來源:BasicUI_XenkoApp.cs

示例11: LiveAssemblyReloader

 public LiveAssemblyReloader(Game game, AssemblyContainer assemblyContainer, List<Assembly> assembliesToUnregister, List<Assembly> assembliesToRegister)
 {
     if (game != null)
         this.entities.AddRange(game.SceneSystem.SceneInstance);
     this.game = game;
     this.assemblyContainer = assemblyContainer;
     this.assembliesToUnregister = assembliesToUnregister;
     this.assembliesToRegister = assembliesToRegister;
 }
開發者ID:h78hy78yhoi8j,項目名稱:xenko,代碼行數:9,代碼來源:LiveAssemblyReloader.cs

示例12: TestSoundMusicLoadingImpl

 private static void TestSoundMusicLoadingImpl(Game game)
 {
     Sound sound = null;
     Assert.DoesNotThrow(() => sound = game.Content.Load<Sound>("EffectBip"), "Failed to load the SoundMusic.");
     Assert.IsNotNull(sound, "The SoundMusic loaded is null.");
     testInstance = sound.CreateInstance(game.Audio.AudioEngine.DefaultListener);
     testInstance.Play();
     // Should hear the sound here.
 }
開發者ID:Kryptos-FR,項目名稱:xenko-reloaded,代碼行數:9,代碼來源:TestAssetLoading.cs

示例13: TestAccessToAudio

 public void TestAccessToAudio()
 {
     using (var game = new Game())
     {
         AudioSystem audioInterface = null;
         Assert.DoesNotThrow(()=>audioInterface = game.Audio, "Failed to get the audio interface");
         Assert.IsNotNull(audioInterface, "The audio interface supplied is null");
     }
 }
開發者ID:h78hy78yhoi8j,項目名稱:xenko,代碼行數:9,代碼來源:TestGame.cs

示例14: Start

        public override void Start()
        {
            IsRunning = true;

            UIGame = (Game)Services.GetServiceAs<IGame>();

            AdjustVirtualResolution(this, EventArgs.Empty);
            Game.Window.ClientSizeChanged += AdjustVirtualResolution;

            CreateScene();
        }
開發者ID:Kryptos-FR,項目名稱:xenko-reloaded,代碼行數:11,代碼來源:UISceneBase.cs

示例15: TestAddAudioSysThenEntitySysSetup

        private void TestAddAudioSysThenEntitySysSetup(Game game)
        {
            var audio = game.Audio;

            BuildEntityHierarchy();
            CreateAndComponentToEntities();

            audio.AddListener(listComp1);
            audio.AddListener(listComp2);

            listComp2Entity.Transform.RotationEulerXYZ = new Vector3((float)Math.PI/2,0,0);
        }
開發者ID:Kryptos-FR,項目名稱:xenko-reloaded,代碼行數:12,代碼來源:TestAudioListenerProcessor.cs


注:本文中的SiliconStudio.Xenko.Engine.Game類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。