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

Adds personality traits to a GameObject. More...

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

Public Member Functions

void FindResources ()
 Finds a faction database if it's unassigned, first looking on a FactionManager and failing that the first FactionDatabase it finds.
 
float GetTrait (string traitName)
 Gets a trait value by name.
 
void OnDrawGizmos ()
 

Static Public Member Functions

static void Copy (float[] source, ref float[] dest)
 Deep copies a source array into a destination array.
 
static float[] Allocate (int count)
 Allocates an array of a specified size.
 
static float[] Allocate (int count, bool initialize)
 Allocates an array of a specified size.
 
static void Initialize (float[] traits)
 Initializes an array to zero.
 
static float Alignment (float[] a, float[] b)
 Computes the "alignment" of two sets of values, which is close their values are.
 

Public Attributes

FactionDatabase factionDatabase
 An editor-time-only reference to the FactionDatabase, to be used only by the editor to get the presets list for the Traits custom editor.
 
float[] traits = new float[0]
 The personality traits.
 

Detailed Description

Adds personality traits to a GameObject.

This isn't necessary if the GameObject has a FactionMember but may be useful for other GameObjects such as items and locations.

This class also provides utility methods to work with trait arrays.

Member Function Documentation

◆ Alignment()

static float PixelCrushers.LoveHate.Traits.Alignment ( float[]  a,
float[]  b 
)
inlinestatic

Computes the "alignment" of two sets of values, which is close their values are.

Returns
A value in the range 0 to 1 indicating how well the values align, where 0 indicates maximum opposites and 1 indicates complete alignment.
Parameters
aThe first set of values.
bThe second set of values. Both arrays should be the same length.

◆ Allocate() [1/2]

static float[] PixelCrushers.LoveHate.Traits.Allocate ( int  count)
inlinestatic

Allocates an array of a specified size.

Parameters
countCount.

◆ Allocate() [2/2]

static float[] PixelCrushers.LoveHate.Traits.Allocate ( int  count,
bool  initialize 
)
inlinestatic

Allocates an array of a specified size.

Parameters
countCount.

///

Parameters
initializeSet true to initialize the array to zero.

◆ Copy()

static void PixelCrushers.LoveHate.Traits.Copy ( float[]  source,
ref float[]  dest 
)
inlinestatic

Deep copies a source array into a destination array.

Parameters
sourceSource.
destDestination.

◆ FindResources()

void PixelCrushers.LoveHate.Traits.FindResources ( )
inline

Finds a faction database if it's unassigned, first looking on a FactionManager and failing that the first FactionDatabase it finds.

◆ GetTrait()

float PixelCrushers.LoveHate.Traits.GetTrait ( string  traitName)
inline

Gets a trait value by name.

Returns
The trait value.
Parameters
traitNameThe trait name.

◆ Initialize()

static void PixelCrushers.LoveHate.Traits.Initialize ( float[]  traits)
inlinestatic

Initializes an array to zero.

Parameters
traitsTraits

◆ OnDrawGizmos()

void PixelCrushers.LoveHate.Traits.OnDrawGizmos ( )
inline

Member Data Documentation

◆ factionDatabase

FactionDatabase PixelCrushers.LoveHate.Traits.factionDatabase

An editor-time-only reference to the FactionDatabase, to be used only by the editor to get the presets list for the Traits custom editor.

◆ traits

float [] PixelCrushers.LoveHate.Traits.traits = new float[0]

The personality traits.


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