PowerQuest
ICharacter Interface Reference

Detailed Description

Characters: Contains functions for manipluating Characters - eg. C.Bob.FaceLeft();.

Inherits IQuestClickableInterface.

Properties

string Description [get, set]
 Gets/Sets the name shown to players. More...
 
string ScriptName [get]
 The name used in scripts. More...
 
MonoBehaviour Instance [get]
 Access to the actual game object component in the scene. More...
 
IRoom Room [get, set]
 The room the character's in. Setting this moves the character to another room. If the player character is moved, the scene will change to the new room. More...
 
IRoom LastRoom [get]
 Returns the last room visited before the current one. More...
 
Vector2 Position [get, set]
 The location of the character. More...
 
Vector2 TargetPosition [get]
 The positiont the character is currently at, or walking towards. More...
 
float Baseline [get, set]
 The position of the character's baseline (for sorting) More...
 
Vector2 WalkSpeed [get, set]
 The speed the character walks horizontally and vertically. More...
 
bool TurnBeforeWalking [get, set]
 Whether character turns before walking. More...
 
bool TurnBeforeFacing [get, set]
 Whether character turns before facing (eg: with C.Player.FaceLeft();. More...
 
float TurnSpeedFPS [get, set]
 How fast characters turn (turning-frames-per-second) More...
 
bool AdjustSpeedWithScaling [get, set]
 
eFace Facing [get, set]
 The enumerated direction the character is facing. More...
 
bool Clickable [get, set]
 Gets or Sets whether clicking on the object triggers an event. More...
 
bool Visible [get, set]
 Gets or sets whether the object is visible. More...
 
bool Moveable [get, set]
 Gets or sets whether the character can move/walk. If false, WalkTo commands are ignored. More...
 
bool Walking [get]
 Gets a value indicating whether this PowerTools.Quest.ICharacter is walking. More...
 
bool Talking [get]
 Gets a value indicating whether this PowerTools.Quest.ICharacter is talking. More...
 
bool Animating [get]
 Gets a value indicating whether this PowerTools.Quest.ICharacter is playing an animation. More...
 
bool IsPlayer [get]
 Whether this instance is the current player. More...
 
Color TextColour [get, set]
 Gets or sets the text colour for the character's speech text. More...
 
string AnimIdle [get, set]
 Gets or sets the idle animation of the character. More...
 
string AnimWalk [get, set]
 Gets or sets the walk animation of the character. More...
 
string AnimTalk [get, set]
 Gets or sets the talk animation of the character. More...
 
string AnimMouth [get, set]
 Gets or sets the lipsync mouth animation of the character, attached to a node. More...
 
string Cursor [get, set]
 Gets or sets the cursor to show when hovering over the object. If empty, default active cursor will be used. More...
 
bool UseRegionTinting [get, set]
 Gets or sets a value indicating whether this PowerTools.Quest.ICharacter use region tinting. More...
 
bool UseRegionScaling [get, set]
 Gets or sets a value indicating whether this PowerTools.Quest.ICharacter use region scaling. More...
 
bool FirstUse [get]
 Returns true the first time the player "uses" the object. More...
 
bool FirstLook [get]
 Returns true the first time the player "looked" at the object. More...
 
int UseCount [get]
 Returns the number of times player has "used" at the object. 0 when it's the first click on the object. More...
 
int LookCount [get]
 Returns the number of times player has "looked" at the object. 0 when it's the first click on the object. More...
 
Vector2 WalkToPoint [get, set]
 Gets or sets the walk to point. More...
 
Vector2 LookAtPoint [get, set]
 Gets or sets the look at point. More...
 
string FootstepSound [get, set]
 
string FootstepAltSound [get, set]
 
int ClickableColliderId [get, set]
 Players can have more than one polygon collider for clicking on. Add them in the Character Component, and set which is active with this function. More...
 
IInventory ActiveInventory [get, set]
 Gets or sets the active inventory (item that's currently selected/being used) More...
 
string ActiveInventoryName [get, set]
 Gets or sets the active inventory (item that's currently selected/being used) More...
 
bool HasActiveInventory [get]
 Returns true if there's any active inventory (item that's currently selected/being used) More...
 
Character Data [get]
 Access to the base class with extra functionality used by the PowerQuest. More...
 

Public Member Functions

void SetPosition (float x, float y)
 Set the location of the character. More...
 
void WalkToBG (float x, float y, bool anywhere=false)
 Make the character walk to a position in game coords without halting the script. More...
 
void WalkToBG (Vector2 pos, bool anywhere=false)
 Make the character walk to a position in game coords without halting the script. More...
 
void WalkToBG (IQuestClickableInterface clickable, bool anywhere=false)
 Make the character walk to the walk-to-point of a clickable object without halting the script. More...
 
Coroutine WalkTo (float x, float y, bool anywhere=false)
 Make the character walk to a position in game coords. More...
 
Coroutine WalkTo (Vector2 pos, bool anywhere=false)
 Make the character walk to a position in game coords. More...
 
Coroutine WalkTo (IQuestClickableInterface clickable, bool anywhere=false)
 Make the character walk to the walk-to-point of a clickable object. More...
 
Coroutine WalkToClicked (bool anywhere=false)
 Make the character walk to the walk-to-point of the last object clicked on. More...
 
Coroutine StopWalking ()
 
Coroutine ChangeRoom (IRoom room)
 Moves the character to another room. If the player character is moved, the scene will change to the new room and script will wait until after OnEnterRoomAfterFade finishes. More...
 
void ChangeRoomBG (IRoom room)
 Moves the character to another room. If the player character is moved, the scene will change to the new room. More...
 
void Show (bool visible=true, bool clickable=true)
 Makes character visible/clickable again. More...
 
void Hide ()
 Makes character Non-visible and non-clicable. More...
 
Coroutine Face (eFace direction, bool instant=false)
 Faces character in a direction. Turning, unless instant is false. More...
 
Coroutine Face (IQuestClickable clickable, bool instant=false)
 Faces character towards the look-at-point of a clickable (character, prop, hotspot) More...
 
Coroutine Face (IQuestClickableInterface clickable, bool instant=false)
 Faces character towards the look-at-point of a clickable (character, prop, hotspot) More...
 
Coroutine FaceDown (bool instant=false)
 Faces character down (towards camera) More...
 
Coroutine FaceUp (bool instant=false)
 Faces character up (away from camera) More...
 
Coroutine FaceLeft (bool instant=false)
 Faces character left. More...
 
Coroutine FaceRight (bool instant=false)
 Faces character right. More...
 
Coroutine Face (float x, float y, bool instant=false)
 Faces character towards a position in on screen coords. More...
 
Coroutine Face (Vector2 location, bool instant=false)
 Faces character towards a position in on screen coords. More...
 
Coroutine FaceClicked (bool instant=false)
 Faces character towards the look-at-point of the last object clicked on. More...
 
Coroutine FaceAway (bool instant=false)
 Faces character in opposite direction to current. More...
 
Coroutine FaceDirection (Vector2 directionV2, bool instant=false)
 Faces character in a direction. More...
 
Coroutine Say (string dialog, int id=-1)
 Make chracter speak a line of dialog. More...
 
Coroutine SayBG (string dialog, int id=-1)
 Make chracter speak a line of dialog, without halting the script. More...
 
Coroutine PlayAnimation (string animName)
 Play an animation on the character. Will return to idle after animation ends. More...
 
void PlayAnimationBG (string animName)
 Play an animation on the character without halting the script. More...
 
void PauseAnimation ()
 
void ResumeAnimation ()
 
void StopAnimation ()
 
void AddAnimationTrigger (string triggerName, bool removeAfterTriggering, System.Action action)
 Advanced/Experimental: Adds a function to be called on an animation event here. Eg: to play a sound or effect on an animation tag. More...
 
void RemoveAnimationTrigger (string triggerName)
 Removes an existing animation trigger. More...
 
Coroutine WaitForAnimTrigger (string eventName)
 Waits until an Event/Tag in the current animation is reached. More...
 
float GetInventoryItemCount ()
 Returns total number of inventory items. More...
 
float GetInventoryQuantity (string itemName)
 Gets the number of a particular inventory item the player has More...
 
bool HasInventory (string itemName)
 Returns true if the player has the specified inventory item. More...
 
bool GetEverHadInventory (string itemName)
 Returns true if the player has, or ever had the specified inventory item. More...
 
void AddInventory (string itemName, float quantity=1)
 Adds an item to the player's inventory More...
 
void RemoveInventory (string itemName, float quantity=1)
 Removes an item from the player's inventory. More...
 
float GetInventoryQuantity (Inventory item)
 Gets the number of a particular inventory item the player has More...
 
bool HasInventory (IInventory item)
 Returns true if the player has the specified inventory item. More...
 
bool GetEverHadInventory (Inventory item)
 Returns true if the player has, or ever had the specified inventory item. More...
 
void AddInventory (IInventory item, float quantity=1)
 Adds an item to the player's inventory More...
 
void RemoveInventory (IInventory item, float quantity=1)
 Removes an item from the player's inventory. More...
 
void ClearInventory ()
 Remove all inventory items from the player. More...
 
GetScript< T > ()
 Access to the specific quest script for the character. Pass the specific character class as the templated parameter so you can access specific members of the script. Eg: GetScript<CharacterBob>().m_saidHi = true;. More...
 

Property Documentation

◆ Description

string Description
getset

Gets/Sets the name shown to players.

◆ ScriptName

string ScriptName
get

The name used in scripts.

◆ Instance

MonoBehaviour Instance
get

Access to the actual game object component in the scene.

◆ Room

IRoom Room
getset

The room the character's in. Setting this moves the character to another room. If the player character is moved, the scene will change to the new room.

◆ LastRoom

IRoom LastRoom
get

Returns the last room visited before the current one.

◆ Position

Vector2 Position
getset

The location of the character.

◆ TargetPosition

Vector2 TargetPosition
get

The positiont the character is currently at, or walking towards.

◆ Baseline

float Baseline
getset

The position of the character's baseline (for sorting)

◆ WalkSpeed

Vector2 WalkSpeed
getset

The speed the character walks horizontally and vertically.

◆ TurnBeforeWalking

bool TurnBeforeWalking
getset

Whether character turns before walking.

◆ TurnBeforeFacing

bool TurnBeforeFacing
getset

Whether character turns before facing (eg: with C.Player.FaceLeft();.

◆ TurnSpeedFPS

float TurnSpeedFPS
getset

How fast characters turn (turning-frames-per-second)

◆ Facing

eFace Facing
getset

The enumerated direction the character is facing.

◆ Clickable

bool Clickable
getset

Gets or Sets whether clicking on the object triggers an event.

◆ Visible

bool Visible
getset

Gets or sets whether the object is visible.

◆ Moveable

bool Moveable
getset

Gets or sets whether the character can move/walk. If false, WalkTo commands are ignored.

◆ Walking

bool Walking
get

Gets a value indicating whether this PowerTools.Quest.ICharacter is walking.

true if walking; otherwise, false.

◆ Talking

bool Talking
get

Gets a value indicating whether this PowerTools.Quest.ICharacter is talking.

true if talking; otherwise, false.

◆ Animating

bool Animating
get

Gets a value indicating whether this PowerTools.Quest.ICharacter is playing an animation.

true if playing an animation (from PlayAnimation); otherwise, false.

◆ IsPlayer

bool IsPlayer
get

Whether this instance is the current player.

◆ TextColour

Color TextColour
getset

Gets or sets the text colour for the character's speech text.

◆ AnimIdle

string AnimIdle
getset

Gets or sets the idle animation of the character.

◆ AnimWalk

string AnimWalk
getset

Gets or sets the walk animation of the character.

◆ AnimTalk

string AnimTalk
getset

Gets or sets the talk animation of the character.

◆ AnimMouth

string AnimMouth
getset

Gets or sets the lipsync mouth animation of the character, attached to a node.

◆ Cursor

string Cursor
getset

Gets or sets the cursor to show when hovering over the object. If empty, default active cursor will be used.

◆ UseRegionTinting

bool UseRegionTinting
getset

Gets or sets a value indicating whether this PowerTools.Quest.ICharacter use region tinting.

true if use region tinting; otherwise, false.

◆ UseRegionScaling

bool UseRegionScaling
getset

Gets or sets a value indicating whether this PowerTools.Quest.ICharacter use region scaling.

true if use region scaling; otherwise, false.

◆ FirstUse

bool FirstUse
get

Returns true the first time the player "uses" the object.

◆ FirstLook

bool FirstLook
get

Returns true the first time the player "looked" at the object.

◆ UseCount

int UseCount
get

Returns the number of times player has "used" at the object. 0 when it's the first click on the object.

◆ LookCount

int LookCount
get

Returns the number of times player has "looked" at the object. 0 when it's the first click on the object.

◆ WalkToPoint

Vector2 WalkToPoint
getset

Gets or sets the walk to point.

◆ LookAtPoint

Vector2 LookAtPoint
getset

Gets or sets the look at point.

◆ ClickableColliderId

int ClickableColliderId
getset

Players can have more than one polygon collider for clicking on. Add them in the Character Component, and set which is active with this function.

◆ ActiveInventory

IInventory ActiveInventory
getset

Gets or sets the active inventory (item that's currently selected/being used)

◆ ActiveInventoryName

string ActiveInventoryName
getset

Gets or sets the active inventory (item that's currently selected/being used)

◆ HasActiveInventory

bool HasActiveInventory
get

Returns true if there's any active inventory (item that's currently selected/being used)

◆ Data

Character Data
get

Access to the base class with extra functionality used by the PowerQuest.

Member Function Documentation

◆ SetPosition()

void SetPosition ( float  x,
float  y 
)

Set the location of the character.

◆ WalkToBG() [1/3]

void WalkToBG ( float  x,
float  y,
bool  anywhere = false 
)

Make the character walk to a position in game coords without halting the script.

◆ WalkToBG() [2/3]

void WalkToBG ( Vector2  pos,
bool  anywhere = false 
)

Make the character walk to a position in game coords without halting the script.

◆ WalkToBG() [3/3]

void WalkToBG ( IQuestClickableInterface  clickable,
bool  anywhere = false 
)

Make the character walk to the walk-to-point of a clickable object without halting the script.

◆ WalkTo() [1/3]

Coroutine WalkTo ( float  x,
float  y,
bool  anywhere = false 
)

Make the character walk to a position in game coords.

◆ WalkTo() [2/3]

Coroutine WalkTo ( Vector2  pos,
bool  anywhere = false 
)

Make the character walk to a position in game coords.

◆ WalkTo() [3/3]

Coroutine WalkTo ( IQuestClickableInterface  clickable,
bool  anywhere = false 
)

Make the character walk to the walk-to-point of a clickable object.

◆ WalkToClicked()

Coroutine WalkToClicked ( bool  anywhere = false)

Make the character walk to the walk-to-point of the last object clicked on.

◆ ChangeRoom()

Coroutine ChangeRoom ( IRoom  room)

Moves the character to another room. If the player character is moved, the scene will change to the new room and script will wait until after OnEnterRoomAfterFade finishes.

◆ ChangeRoomBG()

void ChangeRoomBG ( IRoom  room)

Moves the character to another room. If the player character is moved, the scene will change to the new room.

◆ Show()

void Show ( bool  visible = true,
bool  clickable = true 
)

Makes character visible/clickable again.

◆ Hide()

void Hide ( )

Makes character Non-visible and non-clicable.

◆ Face() [1/5]

Coroutine Face ( eFace  direction,
bool  instant = false 
)

Faces character in a direction. Turning, unless instant is false.

◆ Face() [2/5]

Coroutine Face ( IQuestClickable  clickable,
bool  instant = false 
)

Faces character towards the look-at-point of a clickable (character, prop, hotspot)

◆ Face() [3/5]

Coroutine Face ( IQuestClickableInterface  clickable,
bool  instant = false 
)

Faces character towards the look-at-point of a clickable (character, prop, hotspot)

◆ FaceDown()

Coroutine FaceDown ( bool  instant = false)

Faces character down (towards camera)

◆ FaceUp()

Coroutine FaceUp ( bool  instant = false)

Faces character up (away from camera)

◆ FaceLeft()

Coroutine FaceLeft ( bool  instant = false)

Faces character left.

◆ FaceRight()

Coroutine FaceRight ( bool  instant = false)

Faces character right.

◆ Face() [4/5]

Coroutine Face ( float  x,
float  y,
bool  instant = false 
)

Faces character towards a position in on screen coords.

◆ Face() [5/5]

Coroutine Face ( Vector2  location,
bool  instant = false 
)

Faces character towards a position in on screen coords.

◆ FaceClicked()

Coroutine FaceClicked ( bool  instant = false)

Faces character towards the look-at-point of the last object clicked on.

◆ FaceAway()

Coroutine FaceAway ( bool  instant = false)

Faces character in opposite direction to current.

◆ FaceDirection()

Coroutine FaceDirection ( Vector2  directionV2,
bool  instant = false 
)

Faces character in a direction.

◆ Say()

Coroutine Say ( string  dialog,
int  id = -1 
)

Make chracter speak a line of dialog.

◆ SayBG()

Coroutine SayBG ( string  dialog,
int  id = -1 
)

Make chracter speak a line of dialog, without halting the script.

◆ PlayAnimation()

Coroutine PlayAnimation ( string  animName)

Play an animation on the character. Will return to idle after animation ends.

◆ PlayAnimationBG()

void PlayAnimationBG ( string  animName)

Play an animation on the character without halting the script.

◆ AddAnimationTrigger()

void AddAnimationTrigger ( string  triggerName,
bool  removeAfterTriggering,
System.Action  action 
)

Advanced/Experimental: Adds a function to be called on an animation event here. Eg: to play a sound or effect on an animation tag.

Usage: Add an event to the anim called "Trigger" with a string matching the tag you want (eg: "Shoot") Then call C.Player.AddAnimationTrigger( "Shoot", true, ()=>Audio.PlaySound("Gunshot") );

◆ RemoveAnimationTrigger()

void RemoveAnimationTrigger ( string  triggerName)

Removes an existing animation trigger.

◆ WaitForAnimTrigger()

Coroutine WaitForAnimTrigger ( string  eventName)

Waits until an Event/Tag in the current animation is reached.

Usage: Add an event to the anim called "Trigger" with a string matching the tag you want (eg: "Shoot") Then call yield return C.Player.WaitForAnimTrigger("Shoot");

◆ GetInventoryItemCount()

float GetInventoryItemCount ( )

Returns total number of inventory items.

◆ GetInventoryQuantity() [1/2]

float GetInventoryQuantity ( string  itemName)

Gets the number of a particular inventory item the player has

Returns
The inventory quantity.
Parameters
itemNameName of the inventory item

◆ HasInventory() [1/2]

bool HasInventory ( string  itemName)

Returns true if the player has the specified inventory item.

◆ GetEverHadInventory() [1/2]

bool GetEverHadInventory ( string  itemName)

Returns true if the player has, or ever had the specified inventory item.

◆ AddInventory() [1/2]

void AddInventory ( string  itemName,
float  quantity = 1 
)

Adds an item to the player's inventory

Parameters
itemNameName of the inventory item.
quantityThe quantity of the item to add.

◆ RemoveInventory() [1/2]

void RemoveInventory ( string  itemName,
float  quantity = 1 
)

Removes an item from the player's inventory.

Parameters
itemNameThe name of the inventory item to remove.
quantityQuantity of the item to remove.

◆ GetInventoryQuantity() [2/2]

float GetInventoryQuantity ( Inventory  item)

Gets the number of a particular inventory item the player has

Returns
The inventory quantity.
Parameters
itemThe inventory item to check

◆ HasInventory() [2/2]

bool HasInventory ( IInventory  item)

Returns true if the player has the specified inventory item.

◆ GetEverHadInventory() [2/2]

bool GetEverHadInventory ( Inventory  item)

Returns true if the player has, or ever had the specified inventory item.

◆ AddInventory() [2/2]

void AddInventory ( IInventory  item,
float  quantity = 1 
)

Adds an item to the player's inventory

Parameters
itemThe inventory item to add.
quantityThe number of the item to add.

◆ RemoveInventory() [2/2]

void RemoveInventory ( IInventory  item,
float  quantity = 1 
)

Removes an item from the player's inventory.

Parameters
itemThe item to remove.
quantityQuantity of the item to remove.

◆ ClearInventory()

void ClearInventory ( )

Remove all inventory items from the player.

◆ GetScript< T >()

T GetScript< T > ( )

Access to the specific quest script for the character. Pass the specific character class as the templated parameter so you can access specific members of the script. Eg: GetScript<CharacterBob>().m_saidHi = true;.

Type Constraints
T :CharacterScript<T>