Class XURelation
Defines a behaviour between relationnal objets.
Their types must be defined as fields and decorated with ObjectPatternAttribute.
Prototype relations and cloned relations (executed in XURealization) stand out.
Assembly: Xareus.Relations.Unity.dll
Syntax
[DisallowMultipleComponent]
[OverrideClass("Xareus.Relations.Relation", "Xareus.Relations")]
[OverrideClass("FIVE.Relations.Relation,FIVE.Relations")]
public abstract class XURelation : IdentifiableBehaviour, IRelation
Fields
OnRelationExecuted
Called with the given ResultCallback of the Run(Action)
Declaration
public static Action<XURelation> OnRelationExecuted
Field Value
Examples
You can listen to this event from anywhere using the following example:
private void OnEnable()
{
XURelation.OnRelationExecuted += OnRelationExecuted;
}
private void OnDisable()
{
XURelation.OnRelationExecuted -= OnRelationExecuted;
}
private void OnRelationExecuted(XURelation relation)
{
Debug.Log($"OnRelationExecuted event received from {relation.id}");
}
idXuObjectPatternMap
Maps the object patterns of this relation with their identifier.
Declaration
protected Dictionary<string, XUObjectPattern> idXuObjectPatternMap
Field Value
registered
Declaration
[HideInInspector]
protected bool registered
Field Value
Properties
IdXuObjectPatternMap
Maps the object patterns of this relation with their identifier.
Declaration
public IReadOnlyDictionary<string, XUObjectPattern> IdXuObjectPatternMap { get; }
Property Value
InRealization
If this instance is used in a realization
Declaration
public bool InRealization { get; set; }
Property Value
Name
Declaration
public string Name { get; set; }
Property Value
ObjectPatterns
Declaration
public HashSet<ObjectPattern> ObjectPatterns { get; set; }
Property Value
RegisteredRelations
Gets all relations that are registered in the relation engine
Declaration
public static IEnumerable<IRelation> RegisteredRelations { get; }
Property Value
Relation
The Xareus relation corresponding to this Relation
Declaration
public IRelation Relation { get; }
Property Value
RelationNameToXuRelationMap
Maps relations names to their corresponding XURelation.
Declaration
public static IReadOnlyDictionary<string, XURelation> RelationNameToXuRelationMap { get; }
Property Value
RelationToXuRelationMap
Declaration
[Obsolete("Relations are now equivalent, you can remove the usage of this property")]
public static IReadOnlyDictionary<IRelation, XURelation> RelationToXuRelationMap { get; }
Property Value
XuRelationToRelationMap
Declaration
[Obsolete("Relations are now equivalent, you can remove the usage of this property")]
public static IReadOnlyDictionary<XURelation, IRelation> XuRelationToRelationMap { get; }
Property Value
relationNameUfRelationMap
Declaration
[Obsolete("Use RelationNameToXuRelationMap instead.")]
public static IReadOnlyDictionary<string, XURelation> relationNameUfRelationMap { get; }
Property Value
relationUfRelationMap
Declaration
[Obsolete("Relations are now equivalent, you can remove the usage of this property")]
public static IReadOnlyDictionary<IRelation, XURelation> relationUfRelationMap { get; }
Property Value
ufRelationRelationMap
Declaration
[Obsolete("Relations are now equivalent, you can remove the usage of this property")]
public static IReadOnlyDictionary<XURelation, IRelation> ufRelationRelationMap { get; }
Property Value
Methods
Awake()
Declaration
protected override void Awake()
Overrides
GetCoreRelation(XURelation)
Get a core Xareus relation from its Unity Counterpart
Declaration
[Obsolete("Relations are now equivalent, you can remove the usage of this method")]
public static IRelation GetCoreRelation(XURelation xuRelation)
Parameters
Returns
GetXuRelation(string)
Get a relation from its Id
Declaration
public static XURelation GetXuRelation(string id)
Parameters
Type |
Name |
Description |
string |
id |
|
Returns
GetXuRelation(IRelation)
Get a Unity relation from its Xareus Core counterpart
Declaration
[Obsolete("Relations are now equivalent, you can remove the usage of this method")]
public static XURelation GetXuRelation(IRelation relation)
Parameters
Returns
IsRunnable()
Determines whether the behaviour is runnable.
Declaration
public abstract bool IsRunnable()
Returns
Type |
Description |
bool |
true whether the behaviour is runnable; false otherwise
|
OnEnable()
Declaration
protected virtual void OnEnable()
Register()
Declaration
RelationsToXuRelations(IEnumerable<IRelation>)
Converts a collection of Xareus Core relations to their XURelation counterparts
Declaration
[Obsolete("Relations are now equivalent, you can remove the usage of this method")]
public static IEnumerable<XURelation> RelationsToXuRelations(IEnumerable<IRelation> relations)
Parameters
Returns
Run(Action)
Declaration
public abstract void Run(Action resultCallback)
Parameters
Type |
Name |
Description |
Action |
resultCallback |
Returns on completion.
|
Stop()
Stops a running behaviour.
Does nothing whether it is not running.
Declaration
public virtual void Stop()
ToString()
Declaration
public override string ToString()
Returns
Overrides
UnityEngine.Object.ToString()
TryGetCoreRelation(XURelation, out IRelation)
Get a Xareus Core relation from its Unity Counterpart
Declaration
[Obsolete("Relations are now equivalent, you can remove the usage of this method")]
public static void TryGetCoreRelation(XURelation xuRelation, out IRelation relation)
Parameters
TryGetXuRelation(string, out XURelation)
Get a relation from its Id
Declaration
public static void TryGetXuRelation(string id, out XURelation xuRelation)
Parameters
TryGetXuRelation(IRelation, out XURelation)
Get a Unity relation from its Xareus Core counterpart
Declaration
[Obsolete("Relations are now equivalent, you can remove the usage of this method")]
public static void TryGetXuRelation(IRelation relation, out XURelation xuRelation)
Parameters
Unregister()
unregisters the current relation
Declaration
XuRelationsToRelations(IEnumerable<XURelation>)
Declaration
[Obsolete("Relations are now equivalent, you can remove the usage of this method")]
public static IEnumerable<IRelation> XuRelationsToRelations(IEnumerable<XURelation> xuRelations)
Parameters
Returns
Implements