Предыдущая Следующая
{
if (loadAllContent)
{
ball[0].Load(content, «Content\\Models\\Soccerball»); ball[1].Load(content, «Content\\Models\\SoccerballGreen»); ball[2].Load(content, «Content\\Models\\SoccerballRed»); for (int i = 0; ball.Length > i;
{
ball[i].position.X = rand.Next(-(rand.Next(0, 60)), rand.Next(0, 60));
ball[i].position.Y = rand.Next(50, 80); ball[i].position.Z = -(rand.Next(20, 100));
}
cursor.Load(content, «Content\\Textures\\cursor»); cursor.spritePosition = new Vector2(400, 300); stadium.Load(content, «Content\\Models\\stadium stadium.position = new Vector3(0, 0, 0); background = content.Load<Texture2D>(«Content\\Textures\\hallake001»);
}
}
/// <summary>
/// Освобождаем ресурсы
/// <summary>
protected override void UnloadGraphicsContent(bool unloadAllContent)
332 Формируем трехмерную сцену
{ }
/// <summary>
/// Обновляем состояние игры /// <summary>
protected override void Update(GameTime gameTime)
{ }
/// <summary>
/// Рисуем на экране
/// <summary>
protected override void Draw(GameTime gameTime)
{
graphics.GraphicsDevice.Clear(new Color(159, 147, 207)); switch (gameState)
{
case CurentGameState.SplashScreen:
{
break;
}
case CurentGameState.MenuScreen:
{
break;
}
case CurentGameState.AboutScreen:
{
break;
}
case CurentGameState.GameScreen:
{
spriteBatch.Begin(SpriteBlendMode.AlphaBlend);
spriteBatch.Draw(background, new Vector2(0, -50), Color.White); spriteBatch.End();
graphics.GraphicsDevice.RenderState.DepthBufferEnable = true; view = Matrix.CreateLookAt(camera, Vector3.Zero, Vector3.Up); proj = Matrix.CreatePerspectiveFieldOfView(FOV, aspectRatio, nearClip, farClip); for (int i = 0; ball.Length > i;
{
world = Matrix.CreateTranslation(ball[i].position);
Небо и тучи 333
ball[i].DrawModel(world, view, proj);
}
world = Matrix.CreateTranslation(stadium.position); stadium.DrawModel(world, view, proj);
spriteBatch.Begin(SpriteBlendMode.AlphaBlend);
cursor.DrawSprite(spriteBatch);
spriteBatch.End();
break;
}
case CurentGameState.GameOverScreen: {
break;
}
case CurentGameState.VictoryScreen:
{
break;
}
}
base.Draw(gameTime);
}
/// <summary> /// Движение мячей /// <summary> void MoveBall()
{
for (int i = 0; ball.Length > i;
{
if (ball[i].position.Y < -32) {
ball[i].position.Y = ball[i].position.Y;
}
else
{
ball[i].position.Y -= ball[i].speed;
}
}
}
/// <summary> /// Прицел /// <summary> void GamePadClick() Предыдущая Следующая
|