2023-10-05 18:17:48 +02:00
|
|
|
using Godot;
|
2023-10-14 21:54:06 +02:00
|
|
|
using Godot.Collections;
|
2023-10-05 18:17:48 +02:00
|
|
|
|
|
|
|
public class WorldView : Spatial
|
|
|
|
{
|
|
|
|
// ui elements
|
|
|
|
|
|
|
|
// scene nodes
|
|
|
|
|
|
|
|
// resources
|
|
|
|
|
|
|
|
// exports
|
|
|
|
[Export] public NodePath World;
|
|
|
|
[Export] public Vector2 ViewCenterPlaneCoord;
|
|
|
|
|
|
|
|
// signals
|
|
|
|
// delegate void OnCoordClicked(Vector2 world_pos);
|
|
|
|
|
|
|
|
// other members
|
|
|
|
private World _world;
|
|
|
|
|
|
|
|
// Called when the node enters the scene tree for the first time.
|
|
|
|
public override void _Ready()
|
|
|
|
{
|
|
|
|
_world = GetNode<World>(World);
|
2023-10-14 21:54:06 +02:00
|
|
|
|
|
|
|
_world.Connect("OnTilesChanged", this, nameof(HandleWorldTileChange));
|
2023-10-05 18:17:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public override void _Process(float delta)
|
|
|
|
{
|
|
|
|
}
|
2023-10-14 21:54:06 +02:00
|
|
|
|
|
|
|
private void HandleWorldTileChange(Array<Vector2> removedChunkIndices, Array<Vector2> addedChunkIndices)
|
|
|
|
{
|
|
|
|
|
|
|
|
GD.Print("Removed Chunks " + removedChunkIndices.Count);
|
|
|
|
GD.Print("Added Chunks " + addedChunkIndices.Count);
|
|
|
|
}
|
2023-10-05 18:17:48 +02:00
|
|
|
}
|