Formatting of Game.cs.

WorldChunkRefactoring
Martin Felis 2023-08-28 14:01:09 +02:00
parent 76a7abf22f
commit 64e7db9800
1 changed files with 8 additions and 7 deletions

View File

@ -114,7 +114,8 @@ public class Game : Spatial
_streamContainer.Connect("TileHovered", this, nameof(OnTileHovered));
_tileWorld.Connect("WorldGenerated", this, nameof(OnWorldGenerated));
_generateWorldButton.Connect("pressed", this, nameof(OnGenerateButton));
_player.TaskQueueComponent.Connect("StartInteraction", _interactionSystem, nameof(_interactionSystem.OnStartInteraction));
_player.TaskQueueComponent.Connect("StartInteraction", _interactionSystem,
nameof(_interactionSystem.OnStartInteraction));
_player.Connect("GoldCountChanged", this, nameof(OnGoldCountChanged));
// register entity events
@ -259,7 +260,7 @@ public class Game : Spatial
{
_player.InteractionComponent.EmitSignal("InteractionEnd");
}
_player.TaskQueueComponent.Reset();
_player.TaskQueueComponent.Queue.Enqueue(new TaskQueueComponent.NavigationTask(
new NavigationComponent.NavigationPoint(tile.GlobalTranslation)));
@ -273,7 +274,7 @@ public class Game : Spatial
_mouseWorldLabel.Text = highlightTransform.origin.ToString();
_mouseTileOffsetLabel.Text = tile.OffsetCoords.ToString();
_mouseTileCubeLabel.Text = tile.Cell.CubeCoords.ToString();
_player.Navigation.FindPath(_player, _player.GlobalTranslation, tile.GlobalTranslation);
}
@ -303,7 +304,7 @@ public class Game : Spatial
playerStartTransform.basis.Quat());
_goldCountLabel.Text = "0";
foreach (Spatial entity in GetNode("Entities").GetChildren())
{
Transform entityTransform = entity.Transform;
@ -320,14 +321,14 @@ public class Game : Spatial
GD.Print("Using new map. Size: " + (int)_tileWorld.ColormapImage.GetSize().x);
_goldCountLabel.Text = "0";
UpdateWorldTextures();
_streamContainer.OnWorldGenerated();
// Reset player transform to offset 0,0 and at current height
ResetGameState();
// Connect all signals of the generated world
foreach (Node node in _tileWorld.Entities.GetChildren())
{
@ -341,7 +342,7 @@ public class Game : Spatial
private void UpdateWorldTextures()
{
GD.Print("Updating World textures");
ImageTexture newWorldTexture = new ImageTexture();
newWorldTexture.CreateFromImage(_tileWorld.ColormapImage,
(uint)(Texture.FlagsEnum.Mipmaps | Texture.FlagsEnum.Repeat));