当前位置: 首页>>代码示例>>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;未经允许,请勿转载。