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