Implement factions with bitflags instead
parent
a590aa9209
commit
96977ac79f
|
@ -5,6 +5,6 @@ namespace SupaLidlGame.BoundingBoxes;
|
|||
|
||||
public abstract partial class BoundingBox : Area2D, IFaction
|
||||
{
|
||||
[Export]
|
||||
public ushort Faction { get; set; }
|
||||
[Export(PropertyHint.Flags)]
|
||||
public FactionName Faction { get; set; }
|
||||
}
|
||||
|
|
|
@ -93,8 +93,8 @@ public partial class Character : CharacterBody2D, IFaction
|
|||
[Export]
|
||||
public BoundingBoxes.Hurtbox Hurtbox { get; set; }
|
||||
|
||||
[Export]
|
||||
public ushort Faction { get; set; }
|
||||
[Export(PropertyHint.Flags)]
|
||||
public FactionName Faction { get; set; }
|
||||
|
||||
public AnimationPlayer MovementAnimation { get; set; }
|
||||
|
||||
|
|
|
@ -573,6 +573,7 @@ Sprite = NodePath("Sprite")
|
|||
Inventory = NodePath("Inventory")
|
||||
StateMachine = NodePath("StateMachine")
|
||||
Hurtbox = NodePath("Hurtbox")
|
||||
Faction = 2
|
||||
|
||||
[node name="Stats" type="Node" parent="."]
|
||||
script = ExtResource("5_a7fiw")
|
||||
|
|
|
@ -2,13 +2,20 @@ using Godot;
|
|||
|
||||
namespace SupaLidlGame.Utils;
|
||||
|
||||
[System.Flags]
|
||||
public enum FactionName
|
||||
{
|
||||
Player = 1,
|
||||
Doc = 2,
|
||||
}
|
||||
|
||||
public interface IFaction
|
||||
{
|
||||
/// <summary>
|
||||
/// The faction index that this entity belongs to.
|
||||
/// </summary>
|
||||
[Export]
|
||||
public ushort Faction { get; set; }
|
||||
public FactionName Faction { get; set; }
|
||||
|
||||
public bool AlignsWith(IFaction other)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue