using Godot; using System; using System.Collections.Generic; using Core; using Models; public partial class CampusController : Node2D { private Control _taskContainer; private Control _logContainer; private Button _taskToggle; private Button _logToggle; [Export] public PackedScene StudentScene { get; set; } [Export] public int StudentCount { get; set; } = 5; [Export] public float CoverageStep { get; set; } = 48.0f; [Export] public int MaxCoveragePoints { get; set; } = 200; [Export] public string BehaviorConfigPath { get; set; } = "res://resources/definitions/campus_behavior.json"; [Export] public int RandomSeed { get; set; } = 0; [Export] public int AssignedTaskChancePercent { get; set; } = 60; [Export] public float RoundDurationSeconds { get; set; } = 30.0f; [Export] public float AgentMoveSpeed { get; set; } = 90.0f; [Export] public float GridCellSize { get; set; } = 8.0f; [Export] public float GridWalkableTolerance { get; set; } = 2.0f; [Export] public bool DebugGridEnabled { get; set; } [Export] public Key DebugGridToggleKey { get; set; } = Key.G; [Export] public bool DebugLogGrid { get; set; } private NavigationRegion2D _navigationRegion; private Node2D _studentsRoot; private TopBar _topBar; private RichTextLabel _logLabel; private DebugGridOverlay _debugGridOverlay; private readonly List _coveragePoints = new(); private readonly List _behaviorAgents = new(); private readonly CampusBehaviorWorld _behaviorWorld = new(); private readonly CampusLocationRegistry _locationRegistry = new(); private CampusBehaviorConfig _behaviorConfig; private GameContentDatabase _contentDatabase; private List _archetypeIds = new(); private List _roleIds = new(); private List _traitIds = new(); private List _disciplineIds = new(); private Random _random; private float _roundElapsed; private int _roundIndex; private bool _roundActive; private bool _spawnPending = true; private bool _navBakePending = false; private bool _navBakeReady = false; private Rid _navBakeMap = new(); private uint _navBakeIterationId = 0; private AStarGrid2D _astarGrid; private Rect2I _astarRegion; private int _astarMapIteration; private Rid _astarMap; private const int GridSearchRadius = 6; // Called when the node enters the scene tree for the first time. public override void _Ready() { SetProcessUnhandledInput(true); _taskContainer = GetNode("Task"); _logContainer = GetNode("Log"); // Path to buttons based on scene structure _taskToggle = GetNode