GodotComponentTest/scenes/WorldView.cs

40 lines
918 B
C#
Raw Normal View History

using Godot;
using Godot.Collections;
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);
_world.Connect("OnTilesChanged", this, nameof(HandleWorldTileChange));
}
public override void _Process(float delta)
{
}
private void HandleWorldTileChange(Array<Vector2> removedChunkIndices, Array<Vector2> addedChunkIndices)
{
GD.Print("Removed Chunks " + removedChunkIndices.Count);
GD.Print("Added Chunks " + addedChunkIndices.Count);
}
}