本文整理汇总了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.");
}
示例2: OneLoopTurnActionAftUpdate
public void OneLoopTurnActionAftUpdate(Game game)
{
oneLoopTurnActionAftUpdate?.Invoke(game, loopCount, loopCountSum);
++loopCount;
loopCountSum += loopCount;
}
示例3: Main
static void Main(string[] args)
{
using (var game = new Game())
{
game.Run();
}
}
示例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);
}
示例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.");
}
}
示例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");
}
示例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);
}
示例8: OneLoopTurnActionAftUpdate
public void OneLoopTurnActionAftUpdate(Game game)
{
if (oneLoopTurnActionAftUpdate != null)
oneLoopTurnActionAftUpdate(game, loopCount, loopCountSum);
++loopCount;
loopCountSum += loopCount;
}
示例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.
}
示例10: Main
static void Main(string[] args)
{
// Profiler.EnableAll();
using (game = new Game())
{
game.GraphicsDeviceManager.DeviceCreated += GraphicsDeviceManager_DeviceCreated;
game.Run();
}
}
示例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;
}
示例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.
}
示例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");
}
}
示例14: Start
public override void Start()
{
IsRunning = true;
UIGame = (Game)Services.GetServiceAs<IGame>();
AdjustVirtualResolution(this, EventArgs.Empty);
Game.Window.ClientSizeChanged += AdjustVirtualResolution;
CreateScene();
}
示例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);
}