本文整理汇总了C#中GameEngine类的典型用法代码示例。如果您正苦于以下问题:C# GameEngine类的具体用法?C# GameEngine怎么用?C# GameEngine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GameEngine类属于命名空间,在下文中一共展示了GameEngine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
using (var game = new GameEngine())
{
game.Run();
}
}
示例2: TestWeights
// Runs expectimax searches to test the weights of the chromosome
private double TestWeights()
{
double total = 0;
ConcurrentBag<double> subTotals = new ConcurrentBag<double>();
Parallel.For(0, NUM_THREADS, j =>
{
double subtotal = 0;
for (int i = 0; i < NUM_TESTS / NUM_THREADS; i++)
{
GameEngine gameEngine = new GameEngine();
Expectimax expectimax = new Expectimax(gameEngine, 2);
State end = expectimax.RunStar1WithUnlikelyPruning(false, chromosome);
double points = end.Points;
subtotal += points;
}
subTotals.Add(subtotal);
});
foreach (double sub in subTotals)
{
total += sub;
}
num_tests += NUM_TESTS;
return total;
}
示例3: PlayerNameState
public PlayerNameState(GameEngine engine, MainMenuState ms)
{
eng = engine;
mouse = eng.Mouse;
savedGameStates = new Stack<XmlNodeList>();
savedGameChoices = new Stack<string>();
_ms = ms;
Assembly assembly = Assembly.GetExecutingAssembly();
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
lookat = new Vector3(0, 0, 2);
eye = new Vector3(0, 0, 5);
_old_state = OpenTK.Input.Keyboard.GetState(); // Get the current state of the keyboard
eng.StateTextureManager.LoadTexture("menu", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.menu.png"));
menu = eng.StateTextureManager.GetTexture("menu");
saveFont = QFont.FromQFontFile("Fonts/myHappySans.qfont", new QFontLoaderConfiguration(true));
saveFont.Options.DropShadowActive = true;
start_x = saveFont.Measure("Name: ").Width;
//title = QFont.FromQFontFile("myHappySans.qfont", new QFontLoaderConfiguration(true));
title = QFont.FromQFontFile("Fonts/myRock.qfont", new QFontLoaderConfiguration(true));
title.Options.DropShadowActive = true;
name = "";
numOfButtons = savedGameChoices.Count - 1;
}
示例4: TradeManager
public TradeManager(GameState gamestate, GameEngine ge)
{
this.gamestate = gamestate;
gameengine = ge;
this.numProposedTrades = 0;
this.numSuccessfulTrades = 0;
}
示例5: Init
public override void Init(GameEngine game)
{
base.Init(game);
List<SFML.Graphics.Text> protptypeLabel = new List<SFML.Graphics.Text>();
List<Type> prototypeStates = new List<Type>();
Assembly assembly = Assembly.GetExecutingAssembly();
Type[] classes = assembly.GetTypes();
int i =0;
foreach (Type t in classes)
{
if (t.BaseType.Name.Equals("IPrototype"))
{
SFML.Graphics.Text text = new SFML.Graphics.Text(i+". :"+t.Name);
text.Position = new SFML.Window.Vector2f(50, 20 + i * 30);
protptypeLabel.Add(text);
prototypeStates.Add(t);
i++;
}
}
_prototypeLabels = protptypeLabel.ToArray<SFML.Graphics.Text>();
_prototypeStates = prototypeStates.ToArray<Type>();
}
示例6: StartGame
public void StartGame()
{
//this.simpleSound.Stop();
KeyboardController keyboardController = new KeyboardController();
GameEngine game = new GameEngine(keyboardController);
game.Run();
}
示例7: Main
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main(string[] args)
{
using (GameEngine game = new GameEngine(800, 640, true))
{
game.Run();
}
}
示例8: OpenTKWindow
public OpenTKWindow(GameEngine engine)
: base(800, 600, new GraphicsMode(32, 24, 0, 2), "ORTS.Test")
{
VSync = VSyncMode.Off;
Views= new ConcurrentDictionary<Type,IGameObjectView>();
this.Engine = engine;
this.Engine.Bus.OfType<LoadObjectView>().Subscribe(m => Views.TryAdd(m.GameObjectType,m.View));
KeyMap map = new KeyMap();
Keyboard.KeyDown += (object sender, KeyboardKeyEventArgs e) => {
this.Engine.Bus.Add(new KeyDown(this.Engine.Timer.LastTickTime, map.Do(e.Key)));
};
Keyboard.KeyUp += (object sender, KeyboardKeyEventArgs e) => {
this.Engine.Bus.Add(new KeyUp(this.Engine.Timer.LastTickTime, map.Do(e.Key)));
};
Mouse.WheelChanged += (object sender, MouseWheelEventArgs e) => {
camera.Translate(new Vect3(0,0,-e.DeltaPrecise));
};
engine.Bus.Add(new GraphicsLoadedMessage(engine.Timer.LastTickTime));
camera = new Camera();
camera.Translate(new Vect3(0, 0, 30));
}
示例9: PauseMenuState
// End Fonts
public PauseMenuState(GameEngine engine, MainMenuState menustate)
{
eng = engine;
menu = menustate;
lookat = new Vector3(0, 0, 2);
eye = new Vector3(0, 0, 5);
// _p1 = eng.StateTextureManager.GetTexture("p1");
// _p2 = eng.StateTextureManager.GetTexture("p2");
// _p3 = eng.StateTextureManager.GetTexture("p3");
// _p4 = eng.StateTextureManager.GetTexture("p4");
// QFont
Assembly assembly = Assembly.GetExecutingAssembly();
eng.StateTextureManager.LoadTexture("menu", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.menu.png"));
bg = eng.StateTextureManager.GetTexture("menu");
_buttons = new List<String>();
_buttons.Add("Continue??");
_buttons.Add("Main Menu");
_buttons.Add("Quit");
button = QFont.FromQFontFile("Fonts/myHappySans.qfont", new QFontLoaderConfiguration(true));
button.Options.DropShadowActive = true;
//title = QFont.FromQFontFile("myHappySans.qfont", new QFontLoaderConfiguration(true));
title = QFont.FromQFontFile("Fonts/myRock.qfont", new QFontLoaderConfiguration(true));
title.Options.DropShadowActive = false;
buttonHighlight = QFont.FromQFontFile("Fonts/myHappySans2.qfont", new QFontLoaderConfiguration(true));
buttonHighlight.Options.DropShadowActive = true;
//QFont.CreateTextureFontFiles("Fonts/Rock.TTF", 48, "myRock"); // Use this to create new Fonts that you will texture
// End QFonts
// Set the current image to be displayed at 0 which is the first in the sequence
curFrame = 0.0;
}
示例10: Update
public override void Update(GameTime gameTime, GameEngine.TeeEngine engine)
{
if (Entity.IntersectsWith(this, "Body", Target, "Body", gameTime))
{
// Target is hit
if (Target is NPC)
{
NPC target = (NPC)Target;
target.OnHit(this, Damage, gameTime, engine);
}
engine.RemoveEntity(this);
}
else
{
double distance = Vector2.Distance(Pos, MoveTo);
if (distance < 10)
{
// TODO check for attack succeeding
engine.RemoveEntity(this);
}
else
{
Pos.X += (float)(Math.Cos(_moveAngle) * Speed);
Pos.Y += (float)(Math.Sin(_moveAngle) * Speed);
}
}
}
示例11: LoadScreenState
public LoadScreenState(GameEngine engine, PlayState playstate, int lvl)
{
eng = engine;
this.playstate = playstate;
this.lvl = lvl;
doneLoading = false;
lookat = new Vector3(0, 0, 2);
eye = new Vector3(0, 0, 5);
screens = new Texture[8];
for(int i = 0; i < 8; i++) {
screens[i] = eng.StateTextureManager.GetTexture("load" + (i + 1));
}
// Set the current image to be displayed at 0 which is the first in the sequence
curFrame = 0.0;
//Free up any old textures so we have more VRAM available to load new stuff
for(int i = SpriteSheet.allSprites.Count - 1; i >= 0; i-- ) {
SpriteSheet.allSprites[i].releaseTexture();
}
foreach(int i in SpriteSheet.texIDsToRemove) {
GL.DeleteTexture(i);
}
SpriteSheet.texIDsToRemove.Clear();
GC.Collect();
//Start loading in separate thread
Thread loaderThread = new Thread(new ThreadStart(loadLevel));
loaderThread.Start();
}
示例12: LevelSelect
public LevelSelect(GameEngine engine) : base(engine)
{
eng = engine;
savedGameStates = new Stack<XmlNodeList>();
savedGameChoices = new Stack<string>();
mouse = eng.Mouse;
// Load all the textures
eng.StateTextureManager.RenderSetup();
Assembly assembly = Assembly.GetExecutingAssembly();
eng.StateTextureManager.LoadTexture("menu", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.menu.png"));
menu = eng.StateTextureManager.GetTexture("menu");
eng.StateTextureManager.LoadTexture("arrow", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.arrow.png"));
arrow = eng.StateTextureManager.GetTexture("arrow");
eng.StateTextureManager.LoadTexture("load", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_loadlevel.png"));
load_nopress = eng.StateTextureManager.GetTexture("load");
eng.StateTextureManager.LoadTexture("loadpress", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_loadlevel_hover.png"));
load_press = eng.StateTextureManager.GetTexture("loadpress");
eng.StateTextureManager.LoadTexture("quit", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_exit.png"));
quit_nopress = eng.StateTextureManager.GetTexture("quit");
eng.StateTextureManager.LoadTexture("quitpress", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_exit_hover.png"));
quit_press = eng.StateTextureManager.GetTexture("quitpress");
eng.StateTextureManager.LoadTexture("play", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_play.png"));
play_nopress = eng.StateTextureManager.GetTexture("play");
eng.StateTextureManager.LoadTexture("playpress", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_play_hover.png"));
play_press = eng.StateTextureManager.GetTexture("playpress");
eng.StateTextureManager.LoadTexture("ld", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_leveldesign.png"));
ld_nopress = eng.StateTextureManager.GetTexture("ld");
eng.StateTextureManager.LoadTexture("ldpress", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_leveldesign_hover.png"));
ld_press = eng.StateTextureManager.GetTexture("ldpress");
musicFile = new AudioFile(assembly.GetManifestResourceStream("U5Designs.Resources.Sound.Retribution.ogg"));
musicFile.Play();
// Setup saved game data
SavedGameDataSetup();
// Display available saved game states
DisplayAvailableSaves();
// Clear the color to work with the SplashScreen so it doesn't white out
GL.ClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
lookat = new Vector3(0, 0, 2);
eye = new Vector3(0, 0, 5);
_old_state = OpenTK.Input.Keyboard.GetState(); // Get the current state of the keyboard
arX = -150.0f;
b1Y = 0.0f;
b2Y = -100.0f;
b3Y = -200.0f;
b4Y = -250.0f;
// TEST //
enterdown = false;
LoadSavedState(1);
}
示例13: SetUp
public void SetUp()
{
var gameEngine = new GameEngine(Substitute.For<ITileSetFactory>());
gamePlayViewModel = new GamePlayViewModel(gameEngine);
gamePlayViewModel.StartNewGameCommand.Execute(null);
}
示例14: GameSky
public GameSky(GameEngine game, GameCamera camera, string resource, string effect)
: base(game)
{
this.camera = camera;
this.resource = resource;
Loaded = false;
}
示例15: SetupGamer
private void SetupGamer()
{
this.player = new Gamer();
var form = new GameForm();
IRenderer renderer = new GuiRenderer(form);
IInputHandlerer handler = new GuiInputHandlerer();
this.engine = new GameEngine(renderer, handler);
}