Minor Balancing Fixes
This commit is contained in:
@@ -3,6 +3,7 @@ using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace GameOfLife3D
|
||||
{
|
||||
@@ -13,6 +14,7 @@ namespace GameOfLife3D
|
||||
private GameOfLifeModel _gameOfLife;
|
||||
private bool paused= false;
|
||||
private Model model;
|
||||
Stopwatch watch = new();
|
||||
|
||||
Vector3 CameraTarget, CameraPosition;
|
||||
Matrix ProjectionMatrix, ViewMatrix, WorldMatrix;
|
||||
@@ -33,8 +35,8 @@ namespace GameOfLife3D
|
||||
protected override void Initialize()
|
||||
{
|
||||
// TODO: Add your initialization logic here
|
||||
_gameOfLife = new(16);
|
||||
_gameOfLife.Map.SetRandom(2);
|
||||
_gameOfLife = new(64);
|
||||
_gameOfLife.Map.SetRandom(8);
|
||||
model = Content.Load<Model>("Models/Cube");
|
||||
|
||||
CameraTarget = new(0f,0f,0f);
|
||||
@@ -61,6 +63,10 @@ namespace GameOfLife3D
|
||||
|
||||
protected override void Update(GameTime gameTime)
|
||||
{
|
||||
|
||||
watch.Restart();
|
||||
|
||||
|
||||
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
|
||||
Exit();
|
||||
|
||||
@@ -103,6 +109,11 @@ namespace GameOfLife3D
|
||||
orbit = !orbit;
|
||||
}
|
||||
|
||||
if (Keyboard.GetState().IsKeyDown(Keys.R))
|
||||
{
|
||||
_gameOfLife.Map.SetRandom(8);
|
||||
}
|
||||
|
||||
|
||||
if (orbit)
|
||||
{
|
||||
@@ -132,6 +143,8 @@ namespace GameOfLife3D
|
||||
}
|
||||
}
|
||||
// TODO: Add your update logic here
|
||||
Debug.WriteLine($"Logic took {watch.ElapsedMilliseconds}ms");
|
||||
watch.Stop();
|
||||
|
||||
base.Update(gameTime);
|
||||
|
||||
@@ -139,6 +152,8 @@ namespace GameOfLife3D
|
||||
|
||||
protected override void Draw(GameTime gameTime)
|
||||
{
|
||||
watch.Restart();
|
||||
|
||||
GraphicsDevice.Clear(Color.Black);
|
||||
foreach (var cell in _gameOfLife.Map.Cells)
|
||||
{
|
||||
@@ -167,6 +182,8 @@ namespace GameOfLife3D
|
||||
|
||||
// TODO: Add your drawing code here
|
||||
|
||||
Debug.WriteLine($"Drawing took {watch.ElapsedMilliseconds}ms");
|
||||
|
||||
base.Draw(gameTime);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user