thief-mission-viewer/project/code/TMV/Model.cs

26 lines
626 B
C#

using Godot;
using KeepersCompound.TMV.UI;
namespace KeepersCompound.TMV;
public partial class Model : Node3D
{
public override void _Ready()
{
var resourceSelector = GetNode<Control>("%ResourceSelector") as ResourceSelector;
resourceSelector.ResourceSelected += BuildModel;
}
public void BuildModel(string campaignName, string modelPath)
{
foreach (var node in GetChildren())
{
node.QueueFree();
}
Context.Instance.SetCampaign(campaignName);
var model = Context.Instance.ModelLoader.Load(modelPath);
AddChild(model);
}
}