本文整理汇总了C#中Microsoft.Xna.Framework.GameTime类的典型用法代码示例。如果您正苦于以下问题:C# GameTime类的具体用法?C# GameTime怎么用?C# GameTime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GameTime类属于Microsoft.Xna.Framework命名空间,在下文中一共展示了GameTime类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Update
public void Update(GameTime gameTime)
{
if (powerup == null)
{
if (remaining < 0)
{
remaining = rand.NextDouble() * 10 + 10;
lock (phyWorld)
powerup = (Powerup)Activator.CreateInstance(
types[rand.Next(0, types.Length)], phyWorld, gameplay, rand);
powerup.LoadContent(content);
}
else
remaining -= gameTime.ElapsedGameTime.TotalSeconds;
}
else
{
if (powerup.IsActive)
powerup.Update();
else
{
phyWorld.RemoveBody(powerup);
powerup = null;
}
}
}
开发者ID:hassanselim0,项目名称:Microsoft-Surface-Base-Defense-Game,代码行数:26,代码来源:PowerupManager.cs
示例2: Draw
public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch)
{
if (sprite != null && visible)
{
spriteBatch.Draw(sprite, position, null, Color.White, 0, Vector2.Zero, new Vector2(1, spriteScale), SpriteEffects.None, 0);
}
}
开发者ID:Chartle,项目名称:Gameprogrammeren-Practica,代码行数:7,代码来源:GameObject.cs
示例3: Update
protected override void Update(GameTime gameTime)
{
float time = (float)gameTime.ElapsedGameTime.TotalMilliseconds;
map.Update(time);
base.Update(gameTime);
}
开发者ID:eriksk,项目名称:OGMaps,代码行数:7,代码来源:Game1.cs
示例4: Draw
protected override void Draw(GameTime gameTime)
{
base.Draw(gameTime);
this.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied);
this.spriteBatch.DrawString(this.font, "", new Vector2(1f, 1f), Color.White, 0f, Vector2.Zero, (float)1f, SpriteEffects.None, 1f);
this.spriteBatch.End();
}
开发者ID:Riketta,项目名称:TerraDev,代码行数:7,代码来源:InjectedMain.cs
示例5: Draw
/// <summary>
/// Draws the menu.
/// </summary>
public override void Draw(GameTime gameTime)
{
SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, camera.Transform);
// Draw the menu title.
if (titleTexture == null)
spriteBatch.DrawString(ScreenManager.GameContent.gameFont, titleString,
titlePosition, Color.White * TransitionAlpha, 0, Vector2.Zero,
titleSize / ScreenManager.GameContent.gameFontSize,
SpriteEffects.None, 0);
else
spriteBatch.Draw(titleTexture, titlePosition, Color.White * TransitionAlpha);
// Draw each menu entry in turn.
for (int i = 0; i < menuEntries.Count; i++)
{
MenuEntry menuEntry = menuEntries[i];
bool isSelected = IsActive && (i == selectedEntry);
menuEntry.Draw(isSelected, gameTime);
}
spriteBatch.End();
}
开发者ID:BitSits,项目名称:BitSits-Framework-10---Push-Puzzle,代码行数:30,代码来源:MenuScreen.cs
示例6: Update
public override void Update(GameTime gameTime)
{
Position += Speed;
Angle += AngularSpeed;
Opacity -= OpacityChange;
CurrentLife += gameTime.ElapsedGameTime.Milliseconds;
}
开发者ID:vinterdo,项目名称:CryOfSpace,代码行数:7,代码来源:Particle.cs
示例7: Draw
/// <summary>
/// Allows the game component to update itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
public override void Draw(GameTime gameTime)
{
GestionSprites.Begin();
GestionSprites.DrawString(Font,TexteÀAfficher, Position, CouleurTexte,0,Origine,Échelle, SpriteEffects.None,1f);
GestionSprites.End();
base.Draw(gameTime);
}
开发者ID:HazWard,项目名称:Tank3D,代码行数:11,代码来源:TexteCentré.cs
示例8: Draw
public override void Draw(GameTime gameTime)
{
Matrix world = Matrix.CreateRotationY(this.rotation) * Matrix.CreateTranslation(this.position + (Vector3.Up * height));
Matrix[] transforms = new Matrix[this.model.Bones.Count];
this.model.CopyAbsoluteBoneTransformsTo(transforms);
GraphicsDevice.BlendState = BlendState.AlphaBlend;
GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;
GraphicsDevice.DepthStencilState = DepthStencilState.Default;
foreach (ModelMesh mesh in model.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
effect.World = transforms[mesh.ParentBone.Index] * world;
effect.View = CanyonGame.Camera.View;
effect.Projection = CanyonGame.Camera.Projection;
effect.Alpha = this.alpha;
effect.EnableDefaultLighting();
effect.PreferPerPixelLighting = true;
}
mesh.Draw();
}
base.Draw(gameTime);
}
开发者ID:koenbollen,项目名称:canyon,代码行数:28,代码来源:Marker.cs
示例9: Draw
protected override void Draw(GameTime gameTime)
{
resolver.RunAllRunners();
if (runCodeForTests != null)
runCodeForTests();
resolver.RunAllPresenters();
}
开发者ID:hillwhite,项目名称:DeltaEngine,代码行数:7,代码来源:XnaGame.cs
示例10: Update
/// <summary>
/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input, and playing audio.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Update(GameTime gameTime)
{
currentstate = Keyboard.GetState();
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
Exit();
// TODO: Add your update logic here
else
{
if (currentstate.IsKeyDown(Keys.A) && !oldstate.IsKeyDown(Keys.A))
{
sounds[0].Play();
//var sd = soundEffects[0].CreateInstance();
//sd.IsLooped = false;
//sd.Play();
//sd.Dispose();
}
if (currentstate.IsKeyDown(Keys.R) && !oldstate.IsKeyDown(Keys.R)) { rd.BMS파일분석(); }
if (currentstate.IsKeyDown(Keys.Y) && !oldstate.IsKeyDown(Keys.Y)) { rd.노트시간계산();sdmgr.시간들 = rd.시간들; }
if (currentstate.IsKeyDown(Keys.S) && !oldstate.IsKeyDown(Keys.S))
{
sdmgr.Play();
//var sd = soundEffects[1].CreateInstance();
//sd.Play();
}
oldstate = currentstate;
}
base.Update(gameTime);
}
开发者ID:ProjectEli,项目名称:BMS_Eli,代码行数:38,代码来源:GameMgr.cs
示例11: Update
/// <summary>
/// Allows the game component to update itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
public override void Update(GameTime gameTime)
{
// TODO: Add your update code here
this.time += gameTime.ElapsedGameTime.Milliseconds;
if (this.time >= 1000)
{
this.time = 0;
this.s += 1;
//if (s >= 60)
//{
// s = 0;
// m += 1;
// if (m >= 60)
// h += 1;
//}
//if (h > 0)
// Console.WriteLine("時間計時:" + h + "小時" + m + "分" + s + "秒");
//else if (m > 0)
// Console.WriteLine("時間計時:" + m + "分" + s + "秒");
//else
Console.WriteLine("時間計時:" + s + "秒");
if (s > time_Max)
s = time_Max;
}
base.Update(gameTime);
}
开发者ID:YingChieh,项目名称:Throw-Fish-In,代码行数:31,代码来源:Time_Bar.cs
示例12: Update
public override void Update(GameTime gameTime)
{
base.Update(gameTime);
if (left.Clicked) this.SceneNavigator.MoveToScene(Scenes.SCENE_2);
if (right.Clicked) this.SceneNavigator.MoveToScene(Scenes.SCENE_2);
}
开发者ID:vkrajacic89,项目名称:MagiciansEscape-TVZ,代码行数:7,代码来源:Scene2Crown.cs
示例13: Draw
public void Draw(GameTime gameTime, SpriteBatch spriteBatch, Vector2 position, SpriteEffects spriteEffects)
{
if (Animation == null)
{
throw new NotSupportedException("No animation is currently playing.");
}
time += (float)gameTime.ElapsedGameTime.TotalSeconds;
while (time > Animation.frameTime)
{
time -= Animation.frameTime;
if (Animation.isLooping)
{
frameIndex = (frameIndex + 1) % Animation.FrameCount;
}
else
{
frameIndex = Math.Min(frameIndex + 1, Animation.FrameCount - 1);
}
}
Rectangle source = new Rectangle(FrameIndex * Animation.FrameWidth, 0, Animation.FrameWidth, Animation.FrameHeight);
spriteBatch.Draw(animation.texture, position, source, Color.White, 0.0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0.0f);
}
开发者ID:WINPROG20152016,项目名称:Penaranda_TapTitanXNA,代码行数:27,代码来源:AnimationPlayer.cs
示例14: Update
public override void Update(GameTime gameTime)
{
ControlManager.Update(gameTime, PlayerIndex.One);
base.Update(gameTime);
}
开发者ID:brollins90,项目名称:eotd,代码行数:7,代码来源:LoadGameScreen.cs
示例15: DrawFlagScore
public void DrawFlagScore(SpriteBatch spriteBatch, GameTime gameTime, float stoppingHeight)
{
scoreOrigin = ScoreFont.MeasureString(scoreText) / GameValues.ScoreSpriteScoreOriginOffset;
spriteBatch.DrawString(ScoreFont, scoreText, new Vector2(Position.X, Position.Y - GameValues.ScoreSpriteDrawFlagScoreYOffset), Color.White, 0, scoreOrigin, 0.4f, SpriteEffects.None, 0f);
if (Position.Y > stoppingHeight)
{
Position = new Vector2(Position.X, Position.Y - GameValues.ScoreSpriteDrawFlagScoreDropOffet);
}
else if (Position.Y <= stoppingHeight)
{
//Position.Y = stoppingHeight;
Position = new Vector2(Position.X, stoppingHeight);
if (scoreBuffer <= 0)
{
scoreBuffer = GameValues.ScoreSpriteScoreBuffer;
ScoringOn = !ScoringOn;
}
else
{
scoreBuffer--;
}
}
}
开发者ID:BoltThrower,项目名称:Super-Mario-World-1-1,代码行数:25,代码来源:ScoreSprite.cs
示例16: Draw
public virtual void Draw(SpriteBatch spriteBatch, GameTime gameTime)
{
Vector2 _position2 = new Vector2(_position.X, _position.Y + 150);
Vector2 _position3 = new Vector2(_position.X, _position.Y + 300);
if (pause)
{
spriteBatch.Draw(_texture, Vector2.Zero, Color.White);
if (jouerIn)
spriteBatch.Draw(jouer, _position, Color.Blue);
else
spriteBatch.Draw(jouer, _position, Color.White);
if (OptionIn)
spriteBatch.Draw(options, _position2, Color.Blue);
else
spriteBatch.Draw(options, _position2, Color.White);
if (QuitterIn)
spriteBatch.Draw(quitter, _position3, Color.Blue);
else
spriteBatch.Draw(quitter, _position3, Color.White);
}
}
开发者ID:GrislyMind,项目名称:Projet-Zero,代码行数:26,代码来源:MenuPause.cs
示例17: Draw
/// <summary>
/// This is called when the game should draw itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
spriteBatch.Begin();
//drawas all the objects to the game
spriteBatch.Draw(Paddle, PaddlePos, Color.White);
spriteBatch.Draw(Ball, BallPos, Color.White);
spriteBatch.DrawString(Lives, "Lives = " + Numberlives, new Vector2(020,020), Color.White);
spriteBatch.DrawString(Lives, "Score = " + score, new Vector2(580, 020), Color.White);
//draws allthe bricks on the board
foreach (var pos in BricksPos)
spriteBatch.Draw(Block, pos, Color.Turquoise);
// makes it so that if there are no more lives it displays some text to tell you
if (Numberlives <= 0)
{
spriteBatch.DrawString(Lives, "You ran out of Lives, press [Esc] to leave", new Vector2(200, 400), Color.White);
}
if (score >= 300)
{
spriteBatch.DrawString(Lives, "You won, GG press [Esc] to exit", score, new Vector2(200, 400), Color.White);
}
spriteBatch.End();
base.Draw(gameTime);
}
开发者ID:22rosco22,项目名称:BrickBreaker,代码行数:35,代码来源:Game1.cs
示例18: Draw
// Most content in this class will be here, drawn.
public override void Draw(GameTime gameTime)
{
switch (parent.currentState)
{
// Splash Screen Text
case Game1.GameState.Start:
// Main Screen Text
parent.spriteBatch.Begin();
parent.spriteBatch.Draw(logo, new Vector2(parent.Window.ClientBounds.Width / 2 - 400, -40), new Rectangle(0,0,800,300), Color.White);
parent.spriteBatch.End();
break;
// INSTRUCTION TEXT
case Game1.GameState.Instructions:
parent.spriteBatch.Begin();
parent.spriteBatch.Draw(logo, new Vector2(parent.Window.ClientBounds.Width / 2 - 400, -40), new Rectangle(0, 0, 800, 300), Color.White);
parent.spriteBatch.DrawString(parent.descriptionFont, "You've decided to adopt a hippo!\n" +
"Keep your pet hippo happy by playing minigames and earning points!\n" +
"The more points you earn, the more things you can buy!\n",
new Vector2(20, 200), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1);
parent.spriteBatch.End();
break;
}
base.Draw(gameTime);
}
开发者ID:AnthonyNeace,项目名称:xna-final-project,代码行数:27,代码来源:TextInterface.cs
示例19: Draw
/// <summary>
/// This is called when the game should draw itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Black);
spriteBatch.Begin();
base.Draw(gameTime);
spriteBatch.End();
}
开发者ID:ricardovsilva,项目名称:Basic-Physics-XNA-Engine,代码行数:11,代码来源:Game1.cs
示例20: Draw
protected override void Draw(GameTime gameTime)
{
// Clear the backbuffer
graphics.GraphicsDevice.Clear( Color.Black );
spriteBatch.Begin();
// draw the sprites
spriteBatch.Draw( background, new Rectangle(0,0,2400,1440), Color.White );
spriteBatch.Draw( earth, new Vector2 (400, 240), Color.White );
foreach(var laser in gameObjects.Lasers)
{
laser.Draw( spriteBatch );
}
foreach(var asteroid in gameObjects.Asteroids){
asteroid.Draw( spriteBatch );
}
gameObjects.Shuttle.Draw( spriteBatch );
spriteBatch.DrawString( font, score.ToString(), new Vector2 (100, 100), Color.Red );
spriteBatch.End();
base.Draw( gameTime );
}
开发者ID:urgamedev,项目名称:code-monogame,代码行数:28,代码来源:Game1.cs
注:本文中的Microsoft.Xna.Framework.GameTime类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论