initialize repo

This commit is contained in:
2025-08-08 15:36:09 +02:00
parent d6a2c37a5f
commit cabf13d164
92 changed files with 2160 additions and 2 deletions

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using Civilization.Core.Game;
using Godot;
namespace Civilization.GodotIntegration;
public partial class UnitRenderer : Node2D
{
[Export] public PackedScene UnitScene;
[Export] public MapRenderer MapRenderer;
private readonly Dictionary<Guid, Node2D> _unitViews = new();
public void Render(GameState state)
{
foreach (var view in _unitViews.Values) view.QueueFree();
_unitViews.Clear();
foreach (var unit in state.Units)
{
var unitNode = UnitScene.Instantiate<Node2D>();
unitNode.Position = MapRenderer.MapToWorld(unit.Position);
AddChild(unitNode);
_unitViews[unit.Id] = unitNode;
}
}
}