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

26 lines
626 B
C#
Raw Normal View History

2024-08-17 19:53:16 +00:00
using Godot;
using KeepersCompound.TMV.UI;
namespace KeepersCompound.TMV;
public partial class Model : Node3D
{
public override void _Ready()
{
2024-09-05 18:44:19 +00:00
var resourceSelector = GetNode<Control>("%ResourceSelector") as ResourceSelector;
resourceSelector.ResourceSelected += BuildModel;
2024-08-17 19:53:16 +00:00
}
public void BuildModel(string campaignName, string modelPath)
2024-08-17 19:53:16 +00:00
{
foreach (var node in GetChildren())
{
node.QueueFree();
}
2024-09-19 20:16:07 +00:00
Context.Instance.SetCampaign(campaignName);
2024-09-08 12:24:10 +00:00
var model = Context.Instance.ModelLoader.Load(modelPath);
AddChild(model);
2024-08-17 19:53:16 +00:00
}
}