A faction member is a GameObject that's a member of a faction. More...
Public Member Functions | |
bool | FindResources () |
virtual void | SwitchFaction (int newFactionID) |
Switches to a new faction. | |
virtual void | ResetAll () |
Resets PAD and memory. | |
void | OnLOD (int level) |
virtual void | StartMemoryCleanup () |
virtual void | StopMemoryCleanup () |
virtual void | CleanMemory () |
virtual void | ForgetDeed (Guid deedGuid) |
Removes a rumor from memory. | |
virtual void | ForgetDeed (int actorFactionID, int targetFactionID, string deedTag) |
Removes a rumor from memory. | |
virtual bool | KnowsAboutDeed (Guid deedGuid) |
Checks if this faction contains a memory of a deed identified by its deed GUID. | |
virtual bool | KnowsAboutDeed (int actorFactionID, int targetFactionID, string deedTag) |
Checks if this faction contains a memory of a deed done by an actor to a target identified by a deed tag. | |
virtual bool | FindOldRumor (Rumor newRumor, out Rumor oldRumor) |
Looks for an existing similar rumor in memory. | |
virtual void | AddRumorToMemory (Rumor rumor) |
Adds a rumor to short-term and long-term memory. | |
virtual void | AddRumorToMemory (Rumor rumor, List< Rumor > memory) |
Adds a rumor to a memory list. | |
virtual void | ModifyPAD (float happinessChange, float pleasureChange, float arousalChange, float dominanceChange) |
virtual void | SetPersonalAffinity (int subjectFactionID, float affinity) |
Sets the personal affinity to a subject. | |
virtual void | SetPersonalAffinity (string subjectFactionName, float affinity) |
Sets the personal affinity to a subject. | |
virtual void | ModifyPersonalAffinity (int subjectFactionID, float affinityChange) |
Modifies (increments or decrements) the personal affinity to a subject. | |
virtual void | ModifyPersonalAffinity (string subjectFactionName, float affinityChange) |
Modifies (increments or decrements) the personal affinity to a subject. | |
virtual bool | FindPersonalAffinity (int subjectFactionID, out float affinity) |
Finds the personal affinity to a subject. | |
virtual bool | FindAffinity (int subjectFactionID, out float affinity) |
Finds the affinity to a subject, either personal affinity or using parent faction affinities. | |
virtual float | GetAffinity (int subjectFactionID) |
Gets the affinity to a subject, either personal affinity or using parent faction affinities. | |
virtual float | GetAffinity (FactionMember subject) |
Gets the affinity to a subject, either personal affinity or using parent faction affinities. | |
virtual float | GetAffinity (string subjectFactionName) |
Gets the affinity to a subject, either personal affinity or using parent faction affinities. | |
virtual void | WitnessDeed (Deed deed, FactionMember actor, bool requiresSight, Dimension dimension=Dimension.Is3D) |
Witnesses a deed. | |
bool | DefaultCanSee (FactionMember actor, Dimension dimension) |
GameObject | Raycast (Transform me, Transform other, LayerMask layerMask, Dimension dimension) |
Runs a raycast from the faction member to an actor to determine if vision is clear or blocked. | |
virtual void | ShareRumors (FactionMember other) |
Shares rumors with a member of some faction. | |
void | DefaultShareRumor (Rumor rumor, FactionMember other) |
Default method for sharing a rumor, which simply tells the recipient to evaluate it. | |
float | DefaultGetTrustInSource (FactionMember source) |
Returns the trust [-100,+100] that the faction member has in rumors reported by a source. | |
float | DefaultGetTraitAlignment (float[] traits) |
Returns a value [0,+1] that indicates how well the specifies traits align with the faction member's personality traits. | |
Rumor | DefaultEvaluateRumor (Rumor rumor, FactionMember source) |
Evaluates a rumor and updates the faction's state. | |
virtual void | ModifyPersonality (float[] traits, float multiplier) |
Modifies the faction's personality traits by the specified trait values and multiplier. | |
float | DefaultGetPowerLevel () |
The default power level function, which simply returns 1. | |
virtual string | SerializeToString () |
Serializes the faction member's data to a string. | |
virtual void | DeserializeFromString (string s) |
Deserializes the faction member's data from a string. | |
void | OnDrawGizmos () |
Draw a Love/Hate faction member gizmo based on the faction's color. | |
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 | |
FactionManager | factionManager |
A reference to the FactionManager that will manage the FactionDatabase containing the Faction that this member belongs to. | |
FactionDatabase | factionDatabase |
An editor-time-only reference to the FactionDatabase, to be used only by the editor to provide a popup list for the user to set factionID. | |
int | factionID = 0 |
The faction this member belongs to. | |
Pad | pad = new Pad() |
The current Pleasure-Arousal-Dominance model emotional state. | |
float | impressionability = 0 |
Specifies how easily the faction member's personality traits change based on the traits of deeds committed by friends. | |
float | traitAlignmentImportance = 50 |
Specifies how much trait alignment impacts rumor evaluation. | |
float | arousalImportance = 50 |
Specifies how much arousal impacts rumor evaluation. | |
float | deedImpactThreshold = 5 |
Only acknowledge deeds whose impact is above this threshold. | |
AnimationCurve | acclimatizationCurve |
Specifies how quickly the impact of repeated deeds drops off. | |
AnimationCurve | powerDifferenceCurve |
Specifies how much the difference in power levels affects the dominance experienced by aggressive actions. | |
int | maxMemories = 50 |
The max memories to store. | |
float | shortTermMemoryDuration = 300 |
The short term memory duration. | |
float | longTermMemoryDuration = 3600 |
The long term memory duration. | |
float | memoryCleanupFrequency = 2 |
The frequency in seconds at which to remove old memories. | |
bool | sortMemories = false |
If true memories are sorted in ascending order of their subjective magnitude. | |
List< Rumor > | shortTermMemory = new List<Rumor>() |
List< Rumor > | longTermMemory = new List<Rumor>() |
Transform | eyes = null |
The transform to raycast from for perception checks. | |
LayerMask | sightLayerMask = 1 |
The sight layer mask used for perception checks. | |
bool | sharePlayerAffinityWithRumors = true |
When sharing rumors with another, also share this faction member's affinity to the player. | |
bool | debugEvalFunc = false |
Set true to log details about rumor evaluation. | |
CanSeeDelegate | CanSee = null |
Assign this delegate to override the default perception check method, which does a simple raycast. | |
ShareRumorDelegate | ShareRumor = null |
Assign this delegate to override the default rumor sharing method, which simply passes the rumor to EvaluateRumor. | |
EvaluateRumorDelegate | EvaluateRumor = null |
Assign this delegate to override the default rumor evaluation function. | |
GetTrustInSourceDelegate | GetTrustInSource = null |
Assign this delegate to override the default function that computes trust [-100,+100] in the source of a rumor. | |
GetTraitAlignmentDelegate | GetTraitAlignment = null |
Assign this delegate to override the default function that computes how well a specified set of trait values aligns with the faction member's faction traits. | |
GetPowerLevelDelegate | GetPowerLevel = null |
Assign this delegate to override the default power level check, which simply returns 1 . | |
GetPowerLevelDelegate | GetSelfPerceivedPowerLevel = null |
Assign this delegate to override the default self-perceived power level check, which simply returns 1 . | |
ComputeDominanceDelegate | ComputeDominance = null |
Protected Member Functions | |
virtual void | Awake () |
virtual void | Start () |
virtual Faction | GetMyFaction () |
FactionManager | GetRuntimeFactionManager () |
virtual void | OnEnable () |
virtual void | OnDisable () |
bool | AffinityNotFound (out float affinity) |
virtual bool | IsDeedInNoRepeatDuration (Deed deed) |
Checks if a deed is within the no-repeat time frame, in which case it should be ignored. | |
Protected Attributes | |
bool | m_started = false |
Properties | |
Faction | faction [get] |
Gets the faction. | |
string | factionName [get] |
Gets the faction name. | |
FactionManager | runtimeFactionManager [get] |
Gets the runtime faction manager. | |
A faction member is a GameObject that's a member of a faction.
This script handles functionality tied to the member such as PAD emotional state, witnessing deeds, and sharing rumors.
|
inlinevirtual |
Adds a rumor to short-term and long-term memory.
This method is public to expose it to delegates that override the default rumor evaluation function.
rumor | Rumor to add. |
|
inlinevirtual |
Adds a rumor to a memory list.
This method is public to expose it to delegates that override the default rumor evaluation function.
rumor | Rumor to add. |
memory | Memory list to add rumor to. |
|
inlineprotected |
|
inlineprotectedvirtual |
Reimplemented in PixelCrushers.LoveHate.ORKFrameworkSupport.OrkFactionMember.
|
inlinevirtual |
|
inline |
|
inline |
Evaluates a rumor and updates the faction's state.
null
). If it's a repeat deed, returns the existing rumor.rumor | Rumor. |
source | Source. |
|
inline |
The default power level function, which simply returns 1.
|
inline |
Returns a value [0,+1] that indicates how well the specifies traits align with the faction member's personality traits.
traits | The traits to compare against the faction member's personality traits. |
|
inline |
Returns the trust [-100,+100] that the faction member has in rumors reported by a source.
source | Source. |
|
inline |
Default method for sharing a rumor, which simply tells the recipient to evaluate it.
rumor | A rumor to share. |
other | A member of a faction. Recipient who receives the shared rumor. |
|
inlinevirtual |
Deserializes the faction member's data from a string.
This string must have been generated by SerializeToString. This method replaces the faction member's current data with the serialized data in the strnig.
s | Seralized data. |
|
inlinevirtual |
Finds the affinity to a subject, either personal affinity or using parent faction affinities.
true
, if affinity was found, false
otherwise.subjectFactionID | Subject faction ID. |
affinity | Affinity. |
|
inlinevirtual |
Looks for an existing similar rumor in memory.
true
, if old rumor was found, false
otherwise.newRumor | New rumor. |
oldRumor | Old rumor. |
|
inlinevirtual |
Finds the personal affinity to a subject.
true
, if personal affinity was found, false
otherwise.subjectFactionID | Subject faction ID. |
affinity | Affinity. |
|
inline |
|
inlinevirtual |
Removes a rumor from memory.
deedGuid | Deed GUID. |
|
inlinevirtual |
Removes a rumor from memory.
actorFactionID | Actor faction ID. |
targetFactionID | Target faction ID. |
deedTag | Deed tag. |
|
inlinevirtual |
Gets the affinity to a subject, either personal affinity or using parent faction affinities.
subject | Subject. |
|
inlinevirtual |
Gets the affinity to a subject, either personal affinity or using parent faction affinities.
subjectFactionID | Subject faction ID. |
|
inlinevirtual |
Gets the affinity to a subject, either personal affinity or using parent faction affinities.
subjectFactionName | Subject faction name. |
|
inlineprotectedvirtual |
|
inlineprotected |
|
inlineprotectedvirtual |
Checks if a deed is within the no-repeat time frame, in which case it should be ignored.
|
inlinevirtual |
Checks if this faction contains a memory of a deed identified by its deed GUID.
true
, if the faction member contains a memory of the deed, false
otherwise.deedGuid | Deed GUID. |
|
inlinevirtual |
Checks if this faction contains a memory of a deed done by an actor to a target identified by a deed tag.
true
, if the faction member contains a memory of the deed, false
otherwise.actorFactionID | Actor faction ID. |
targetFactionID | Target faction ID. |
deedTag | Deed tag. |
|
inlinevirtual |
|
inlinevirtual |
Modifies (increments or decrements) the personal affinity to a subject.
subjectFactionID | Subject faction ID. |
affinityChange | Affinity change. |
|
inlinevirtual |
Modifies (increments or decrements) the personal affinity to a subject.
subjectFactionName | Subject faction name. |
affinityChange | Affinity change. |
|
inlinevirtual |
Modifies the faction's personality traits by the specified trait values and multiplier.
The DefaultEvaluateRumor method calls ModifyPersonality when the faction member is impressionable and witnesses a deed committed by an actor for which it has positive affinity.
traits | |
multiplier | Multiple the trait values by this. Typically less than 1 to scale the trait values down. |
|
inlineprotectedvirtual |
|
inline |
Draw a Love/Hate faction member gizmo based on the faction's color.
|
inlineprotectedvirtual |
|
inline |
|
inline |
Runs a raycast from the faction member to an actor to determine if vision is clear or blocked.
This method is public to expose it to delegates that might need it when overriding default functionality.
me | This faction member's eyes transform. |
other | The transform of the actor we're trying to witness. |
layerMask | The raycast layermask. |
dimension | The dimension in which to run the raycast. |
|
inlinevirtual |
Resets PAD and memory.
|
inlinevirtual |
Serializes the faction member's data to a string.
|
inlinevirtual |
Sets the personal affinity to a subject.
subjectFactionID | Subject faction ID. |
affinity | Affinity. |
|
inlinevirtual |
Sets the personal affinity to a subject.
subjectFactionName | Subject faction name. |
affinity | Affinity. |
|
inlinevirtual |
Shares rumors with a member of some faction.
Also shares affinity to the player.
other | A member of a faction. Recipient who receives this member's rumors. |
|
inlineprotectedvirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
Switches to a new faction.
It may be more appropriate in many cases to add or delete a parent faction rather than changing the member's own faction.
newFactionID | Faction ID of the member's new faction. |
|
inlinevirtual |
Witnesses a deed.
deed | Deed. |
actor | Actor who committed deed. |
requiresSight | If true , must be able to see actor to witness deed. |
dimension | Specifies how to determine line of sight (2D or 3D). |
minAffinityEffect | Evaluating this deed will never cause faction's affinity to go below this value. |
maxAffinityEffect | Evaluating this deed will never cause faction's affinity to go below above value. |
noRepeatDelay | Faction members will ignore deeds that are repeated within this time frame. |
|
inlinestatic |
For optional UtopiaWorx Zone Controller integration.
|
inlinestatic |
For optional UtopiaWorx Zone Controller integration.
AnimationCurve PixelCrushers.LoveHate.FactionMember.acclimatizationCurve |
Specifies how quickly the impact of repeated deeds drops off.
float PixelCrushers.LoveHate.FactionMember.arousalImportance = 50 |
Specifies how much arousal impacts rumor evaluation.
A value of 100 means it can double the impact if the faction member's arousal is at maximum.
CanSeeDelegate PixelCrushers.LoveHate.FactionMember.CanSee = null |
Assign this delegate to override the default perception check method, which does a simple raycast.
ComputeDominanceDelegate PixelCrushers.LoveHate.FactionMember.ComputeDominance = null |
bool PixelCrushers.LoveHate.FactionMember.debugEvalFunc = false |
Set true
to log details about rumor evaluation.
float PixelCrushers.LoveHate.FactionMember.deedImpactThreshold = 5 |
Only acknowledge deeds whose impact is above this threshold.
EvaluateRumorDelegate PixelCrushers.LoveHate.FactionMember.EvaluateRumor = null |
Assign this delegate to override the default rumor evaluation function.
Transform PixelCrushers.LoveHate.FactionMember.eyes = null |
The transform to raycast from for perception checks.
If null
this GameObject is used.
FactionDatabase PixelCrushers.LoveHate.FactionMember.factionDatabase |
An editor-time-only reference to the FactionDatabase, to be used only by the editor to provide a popup list for the user to set factionID.
To access the FactionDatabase at runtime, go through factionManager.
int PixelCrushers.LoveHate.FactionMember.factionID = 0 |
The faction this member belongs to.
FactionManager PixelCrushers.LoveHate.FactionMember.factionManager |
A reference to the FactionManager that will manage the FactionDatabase containing the Faction that this member belongs to.
GetPowerLevelDelegate PixelCrushers.LoveHate.FactionMember.GetPowerLevel = null |
Assign this delegate to override the default power level check, which simply returns 1
.
GetPowerLevelDelegate PixelCrushers.LoveHate.FactionMember.GetSelfPerceivedPowerLevel = null |
Assign this delegate to override the default self-perceived power level check, which simply returns 1
.
This is a separate method from GetPowerLevel to allow factions to think they're stronger or weaker than they really are.
GetTraitAlignmentDelegate PixelCrushers.LoveHate.FactionMember.GetTraitAlignment = null |
Assign this delegate to override the default function that computes how well a specified set of trait values aligns with the faction member's faction traits.
GetTrustInSourceDelegate PixelCrushers.LoveHate.FactionMember.GetTrustInSource = null |
Assign this delegate to override the default function that computes trust [-100,+100] in the source of a rumor.
The default returns the affinity to the source, or +100 if the source is self.
float PixelCrushers.LoveHate.FactionMember.impressionability = 0 |
Specifies how easily the faction member's personality traits change based on the traits of deeds committed by friends.
Zero means they don't change.
float PixelCrushers.LoveHate.FactionMember.longTermMemoryDuration = 3600 |
The long term memory duration.
Rumors are shared from long term memory.
|
protected |
int PixelCrushers.LoveHate.FactionMember.maxMemories = 50 |
The max memories to store.
Older memories are dropped if over the limit.
float PixelCrushers.LoveHate.FactionMember.memoryCleanupFrequency = 2 |
The frequency in seconds at which to remove old memories.
This frequency applies to level of detail (LOD) 0. Higher LOD values will decrease the frequency.
The current Pleasure-Arousal-Dominance model emotional state.
AnimationCurve PixelCrushers.LoveHate.FactionMember.powerDifferenceCurve |
Specifies how much the difference in power levels affects the dominance experienced by aggressive actions.
bool PixelCrushers.LoveHate.FactionMember.sharePlayerAffinityWithRumors = true |
When sharing rumors with another, also share this faction member's affinity to the player.
ShareRumorDelegate PixelCrushers.LoveHate.FactionMember.ShareRumor = null |
Assign this delegate to override the default rumor sharing method, which simply passes the rumor to EvaluateRumor.
float PixelCrushers.LoveHate.FactionMember.shortTermMemoryDuration = 300 |
The short term memory duration.
Short term memory affects the faction's PAD.
LayerMask PixelCrushers.LoveHate.FactionMember.sightLayerMask = 1 |
The sight layer mask used for perception checks.
bool PixelCrushers.LoveHate.FactionMember.sortMemories = false |
If true
memories are sorted in ascending order of their subjective magnitude.
float PixelCrushers.LoveHate.FactionMember.traitAlignmentImportance = 50 |
Specifies how much trait alignment impacts rumor evaluation.
A value of 100 means it can double the impact if the deed's traits align perfectly with the faction member's.
|
get |
Gets the faction.
The faction.
|
get |
Gets the faction name.
|
get |
Gets the runtime faction manager.
The runtime faction manager.