mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-16 14:03:47 +00:00
Interface default functions
This commit is contained in:
parent
7566b0891c
commit
5e357e1a96
4 changed files with 75 additions and 25 deletions
42
3D/TrenchBroom/EntityScripts/Triggers/ITargetable.cs
Normal file
42
3D/TrenchBroom/EntityScripts/Triggers/ITargetable.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue