Interface default functions

This commit is contained in:
Marco 2025-09-10 11:08:47 +02:00
commit 5e357e1a96
4 changed files with 75 additions and 25 deletions

View file

@ -0,0 +1,42 @@
using System;
using Cirno.Scripts;
using Godot;
using Godot.Collections;
namespace Cirno._3D.TrenchBroom.EntityScripts.Triggers;
public interface ITargetable
{
string TargetName { get; set; }
void ApplyTargetProperties(Dictionary<string, Variant> props)
{
TargetName = props["targetname"].AsString();
}
}
public interface ITargeting
{
string Target { get; set; }
void ApplyTargetingProperties(Dictionary<string, Variant> props)
{
Target = props["target"].AsString();
}
}
public interface IActivationType
{
ActivationType ActivationType { get; set; }
void ApplyActivationTypeProperties(Dictionary<string, Variant> props)
{
if (props.TryGetValue("activationtype", out var type))
{
var t = Enum.TryParse(type.AsString(), true, out ActivationType activationType);
if (t)
{
ActivationType = activationType;
}
}
}
}