Loading...
Searching...
No Matches
PixelCrushers.LoveHate.FactionManager Class Reference

Coordinates data exchange between factions. More...

Inheritance diagram for PixelCrushers.LoveHate.FactionManager:
Collaboration diagram for PixelCrushers.LoveHate.FactionManager:

Public Member Functions

virtual void ResetAll ()
 Resets faction database and all registered faction members.
 
Faction GetFaction (int factionID)
 Looks up a faction by its ID.
 
Faction GetFactionSilent (int factionID)
 Looks up a faction by its ID.
 
Faction GetFaction (int factionID, bool silent)
 Looks up a faction by its ID.
 
Faction GetFaction (string factionName)
 Looks up a faction by its name.
 
int GetFactionID (string factionName)
 Looks up a faction ID by its name.
 
void RegisterFactionMember (FactionMember member)
 Registers a faction member.
 
void UnregisterFactionMember (FactionMember member)
 Unregisters a faction member.
 
bool FactionHasAncestor (int factionID, int ancestorID)
 Checks if a faction has an ancestor (parent, grandparent, etc.)
 
bool FactionHasDirectParent (int factionID, int parentID)
 Checks if a faction has a direct parent.
 
void AddFactionParent (int factionID, int parentID)
 Adds a parent to a faction.
 
void RemoveFactionParent (int factionID, int parentID, bool inheritRelationships)
 Removes a parent from a faction.
 
bool FindPersonalAffinity (int judgeFactionID, int subjectFactionID, out float affinity)
 Finds this faction's personal affinity for another faction.
 
bool FindAffinity (int judgeFactionID, int subjectFactionID, out float affinity)
 Finds the affinity of a judging faction to a subject faction.
 
float GetAffinity (int judgeFactionID, int subjectFactionID)
 Gets the affinity of a judging faction to a subject faction.
 
float GetAffinity (string judgeFactionName, string subjectFactionName)
 Gets a judge's affinity to a subject using their faction names.
 
void SetPersonalAffinity (int judgeFactionID, int subjectFactionID, float affinity)
 Sets this faction's personal affinity to another faction.
 
void SetPersonalAffinity (string judgeFactionName, string subjectFactionName, float affinity)
 Sets a judge's personal affinity to a subject using their faction names.
 
void ModifyPersonalAffinity (int judgeFactionID, int subjectFactionID, float affinityChange)
 Modifies (increments or decrements) a judge's personal affinity to a subject using their faction IDs.
 
void ModifyPersonalAffinity (string judgeFactionName, string subjectFactionName, float affinityChange)
 Modifies (increments or decrements) a judge's personal affinity to a subject using their faction names.
 
void ShareAffinity (int judgeFactionID, int otherFactionID, int subjectFactionID)
 If the faction has personal affinity for a subject and the other doesn't, this gives the other an affinity for the subject based on the other's affinity for this faction.
 
void CommitDeed (FactionMember actor, Deed deed, bool requiresSight, Dimension dimension, float radius)
 Informs factions that a deed was committed.
 
void CommitDeed (FactionMember actor, Deed deed, bool requiresSight)
 Commits the deed.
 
string SerializeToString ()
 
void DeserializeFromString (string s)
 

Static Public Member Functions

static List< string > ZonePluginActivator ()
 For optional UtopiaWorx Zone Controller integration.
 
static List< string > ZonePluginActivatorMethods ()
 For optional UtopiaWorx Zone Controller integration.
 

Public Attributes

FactionDatabase factionDatabase
 The faction database managed by this faction manager.
 
int witnessesPerUpdate = 60
 When a deed is committed, process this many potential witnesses each Update.
 
bool canWitnessSelf = false
 Faction members can witness their own deeds.
 
bool allowOnlyOneFactionManager = false
 If a faction manager already exists when this one tries to start, destroy this one instead.
 
bool debug
 Tick to log activity to the console.
 

Protected Member Functions

virtual void Awake ()
 
virtual void Start ()
 

Properties

Dictionary< int, Factionfactions [get]
 
Dictionary< Faction, List< FactionMember > > members [get]
 
static FactionManager instance [get, set]
 

Detailed Description

Coordinates data exchange between factions.

If your scene has any faction members, it must have a faction manager.

Member Function Documentation

◆ AddFactionParent()

void PixelCrushers.LoveHate.FactionManager.AddFactionParent ( int  factionID,
int  parentID 
)
inline

Adds a parent to a faction.

Parameters
factionIDFaction ID.
parentIDParent ID.

◆ Awake()

virtual void PixelCrushers.LoveHate.FactionManager.Awake ( )
inlineprotectedvirtual

◆ CommitDeed() [1/2]

void PixelCrushers.LoveHate.FactionManager.CommitDeed ( FactionMember  actor,
Deed  deed,
bool  requiresSight 
)
inline

Commits the deed.

This version has no distance restrictions.

Parameters
actorActor.
deedDeed.
requiresSightIf set to true requires sight.

◆ CommitDeed() [2/2]

void PixelCrushers.LoveHate.FactionManager.CommitDeed ( FactionMember  actor,
Deed  deed,
bool  requiresSight,
Dimension  dimension,
float  radius 
)
inline

Informs factions that a deed was committed.

Parameters
actorFactionMember who committed the deed.
deedDeed.
requiresSightIf true, the deed must be seen to be witnessed.
dimensionThe world space dimension to use for radius checks.
radiusMax distance from position that factions can witness the deed (0=anywhere).

◆ DeserializeFromString()

void PixelCrushers.LoveHate.FactionManager.DeserializeFromString ( string  s)
inline

◆ FactionHasAncestor()

bool PixelCrushers.LoveHate.FactionManager.FactionHasAncestor ( int  factionID,
int  ancestorID 
)
inline

Checks if a faction has an ancestor (parent, grandparent, etc.)

Returns
true, if has ancestor, false otherwise.
Parameters
factionIDFaction ID.
ancestorIDAncestor ID.

◆ FactionHasDirectParent()

bool PixelCrushers.LoveHate.FactionManager.FactionHasDirectParent ( int  factionID,
int  parentID 
)
inline

Checks if a faction has a direct parent.

Returns
true, if has direct parent, false otherwise.
Parameters
factionIDFaction ID.
parentIDParent ID.

◆ FindAffinity()

bool PixelCrushers.LoveHate.FactionManager.FindAffinity ( int  judgeFactionID,
int  subjectFactionID,
out float  affinity 
)
inline

Finds the affinity of a judging faction to a subject faction.

Returns
true, if affinity was found, false otherwise.
Parameters
judgeFactionIDJudge faction ID.
subjectFactionIDSubject faction ID.
affinityAffinity of judge to subject.

◆ FindPersonalAffinity()

bool PixelCrushers.LoveHate.FactionManager.FindPersonalAffinity ( int  judgeFactionID,
int  subjectFactionID,
out float  affinity 
)
inline

Finds this faction's personal affinity for another faction.

Doesn't check parents.

Returns
true if personal affinity was found, false otherwise.
Parameters
subjectFactionIDThe other faction ID.
affinityAffinity of this faction to the subject.

◆ GetAffinity() [1/2]

float PixelCrushers.LoveHate.FactionManager.GetAffinity ( int  judgeFactionID,
int  subjectFactionID 
)
inline

Gets the affinity of a judging faction to a subject faction.

Returns
The affinity.
Parameters
judgeFactionIDJudge faction ID.
subjectFactionIDSubject faction ID.

◆ GetAffinity() [2/2]

float PixelCrushers.LoveHate.FactionManager.GetAffinity ( string  judgeFactionName,
string  subjectFactionName 
)
inline

Gets a judge's affinity to a subject using their faction names.

Returns
The affinity.
Parameters
judgeFactionNameJudge faction name.
subjectFactionNameSubject faction name.

◆ GetFaction() [1/3]

Faction PixelCrushers.LoveHate.FactionManager.GetFaction ( int  factionID)
inline

Looks up a faction by its ID.

Returns
The faction.
Parameters
factionIDFaction ID.

◆ GetFaction() [2/3]

Faction PixelCrushers.LoveHate.FactionManager.GetFaction ( int  factionID,
bool  silent 
)
inline

Looks up a faction by its ID.

Returns
The faction.
Parameters
factionIDFaction ID.
silentIf set to true, don't log warnings.

◆ GetFaction() [3/3]

Faction PixelCrushers.LoveHate.FactionManager.GetFaction ( string  factionName)
inline

Looks up a faction by its name.

Returns
The faction.
Parameters
factionNameFaction name.

◆ GetFactionID()

int PixelCrushers.LoveHate.FactionManager.GetFactionID ( string  factionName)
inline

Looks up a faction ID by its name.

Returns
The faction ID.
Parameters
factionNameFaction name.

◆ GetFactionSilent()

Faction PixelCrushers.LoveHate.FactionManager.GetFactionSilent ( int  factionID)
inline

Looks up a faction by its ID.

Doesn't log any warning messages.

Returns
The faction.
Parameters
factionIDFaction ID.

◆ ModifyPersonalAffinity() [1/2]

void PixelCrushers.LoveHate.FactionManager.ModifyPersonalAffinity ( int  judgeFactionID,
int  subjectFactionID,
float  affinityChange 
)
inline

Modifies (increments or decrements) a judge's personal affinity to a subject using their faction IDs.

Parameters
judgeFactionIDJudge faction ID.
subjectFactionIDSubject faction ID.
affinityChangeAffinity change.

◆ ModifyPersonalAffinity() [2/2]

void PixelCrushers.LoveHate.FactionManager.ModifyPersonalAffinity ( string  judgeFactionName,
string  subjectFactionName,
float  affinityChange 
)
inline

Modifies (increments or decrements) a judge's personal affinity to a subject using their faction names.

Parameters
judgeFactionNameJudge faction name.
subjectFactionNameSubject faction name.
affinityChangeAffinity change.

◆ RegisterFactionMember()

void PixelCrushers.LoveHate.FactionManager.RegisterFactionMember ( FactionMember  member)
inline

Registers a faction member.

The faction member calls this in Start.

Parameters
memberMember.

◆ RemoveFactionParent()

void PixelCrushers.LoveHate.FactionManager.RemoveFactionParent ( int  factionID,
int  parentID,
bool  inheritRelationships 
)
inline

Removes a parent from a faction.

Parameters
factionIDFaction ID.
parentIDParent ID.
inheritRelationshipsIf set to true keep the parent's relationships if the faction doesn't already have a personal relationship.

◆ ResetAll()

virtual void PixelCrushers.LoveHate.FactionManager.ResetAll ( )
inlinevirtual

Resets faction database and all registered faction members.

◆ SerializeToString()

string PixelCrushers.LoveHate.FactionManager.SerializeToString ( )
inline

◆ SetPersonalAffinity() [1/2]

void PixelCrushers.LoveHate.FactionManager.SetPersonalAffinity ( int  judgeFactionID,
int  subjectFactionID,
float  affinity 
)
inline

Sets this faction's personal affinity to another faction.

Parameters
subjectFactionIDSubject faction ID.
affinityAffinity to the other faction.

◆ SetPersonalAffinity() [2/2]

void PixelCrushers.LoveHate.FactionManager.SetPersonalAffinity ( string  judgeFactionName,
string  subjectFactionName,
float  affinity 
)
inline

Sets a judge's personal affinity to a subject using their faction names.

Parameters
judgeFactionNameJudge faction name.
subjectFactionNameSubject faction name.
affinityAffinity.

◆ ShareAffinity()

void PixelCrushers.LoveHate.FactionManager.ShareAffinity ( int  judgeFactionID,
int  otherFactionID,
int  subjectFactionID 
)
inline

If the faction has personal affinity for a subject and the other doesn't, this gives the other an affinity for the subject based on the other's affinity for this faction.

Parameters
judgeFactionIDJudging faction ID (gives affinity).
otherFactionIDOther faction ID (maybe receives affinity).
subjectFactionIDSubject faction ID (affinity about this faction).

◆ Start()

virtual void PixelCrushers.LoveHate.FactionManager.Start ( )
inlineprotectedvirtual

◆ UnregisterFactionMember()

void PixelCrushers.LoveHate.FactionManager.UnregisterFactionMember ( FactionMember  member)
inline

Unregisters a faction member.

The faction member calls this in OnDestroy.

Parameters
memberMember.

◆ ZonePluginActivator()

static List< string > PixelCrushers.LoveHate.FactionManager.ZonePluginActivator ( )
inlinestatic

For optional UtopiaWorx Zone Controller integration.

Returns
The properties that Zone Controller can control.

◆ ZonePluginActivatorMethods()

static List< string > PixelCrushers.LoveHate.FactionManager.ZonePluginActivatorMethods ( )
inlinestatic

For optional UtopiaWorx Zone Controller integration.

Returns
The methods that Zone Controller can invoke.

Member Data Documentation

◆ allowOnlyOneFactionManager

bool PixelCrushers.LoveHate.FactionManager.allowOnlyOneFactionManager = false

If a faction manager already exists when this one tries to start, destroy this one instead.

◆ canWitnessSelf

bool PixelCrushers.LoveHate.FactionManager.canWitnessSelf = false

Faction members can witness their own deeds.

◆ debug

bool PixelCrushers.LoveHate.FactionManager.debug

Tick to log activity to the console.

◆ factionDatabase

FactionDatabase PixelCrushers.LoveHate.FactionManager.factionDatabase

The faction database managed by this faction manager.

◆ witnessesPerUpdate

int PixelCrushers.LoveHate.FactionManager.witnessesPerUpdate = 60

When a deed is committed, process this many potential witnesses each Update.

Property Documentation

◆ factions

Dictionary<int, Faction> PixelCrushers.LoveHate.FactionManager.factions
get

◆ instance

FactionManager PixelCrushers.LoveHate.FactionManager.instance
staticgetset

◆ members

Dictionary<Faction, List<FactionMember> > PixelCrushers.LoveHate.FactionManager.members
get

The documentation for this class was generated from the following file: