SupaLidlGame/Utils/IFaction.cs

31 lines
518 B
C#
Raw Permalink Normal View History

2022-11-19 21:21:12 -08:00
using Godot;
2023-06-03 18:21:46 -07:00
namespace SupaLidlGame.Utils;
[System.Flags]
public enum FactionName
{
Player = 1,
Doc = 2,
Forest = 4,
}
2023-06-03 18:21:46 -07:00
public interface IFaction
2022-11-19 21:21:12 -08:00
{
2023-06-03 18:21:46 -07:00
/// <summary>
/// The faction index that this entity belongs to.
/// </summary>
[Export]
public FactionName Faction { get; set; }
2024-05-18 15:53:33 -07:00
public bool AlignsWith(IFaction other)
{
return (Faction & other.Faction) > 0;
}
public bool AlignsFullyWith(IFaction other)
{
return Faction == other.Faction;
}
2022-11-19 21:21:12 -08:00
}