PowerQuest 0.19.4
|
Characters: Contains functions for manipluating Characters. Usually accessed with the C. prefix. Eg. C.Bob.FaceLeft();
For example:
Inherits IQuestClickableInterface.
Properties | |
string | Description [get, set] |
Gets/Sets the name shown to players. | |
string | ScriptName [get] |
The name used in scripts. | |
MonoBehaviour | Instance [get] |
Access to the actual game object component in the scene. | |
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. | |
IRoom | LastRoom [get] |
Returns the last room visited before the current one. | |
Vector2 | Position [get, set] |
The location of the character. Eg: C.Player.Position = new Vector2(10,20); or C.Dave.Position = Point.UnderTree; | |
Vector2 | TargetPosition [get] |
The positiont the character is currently at, or walking towards. | |
float | Baseline [get, set] |
The position of the character's baseline (for sorting). This is local to the player, usually zero is at their feet. To get the player's baseline in world space do float baseline = Plr.Baseline - Plr.Position.y; | |
Vector2 | WalkSpeed [get, set] |
The speed the character walks horizontally and vertically. Eg: C.Player.WalkSpeed = new Vector2(10,20); | |
bool | TurnBeforeWalking [get, set] |
Whether character turns before walking. | |
bool | TurnBeforeFacing [get, set] |
Whether character turns before facing (eg: with C.Player.FaceLeft();. | |
float | TurnSpeedFPS [get, set] |
How fast characters turn (turning-frames-per-second) | |
bool | AdjustSpeedWithScaling [get, set] |
Whether the walk speed adjusts to match the size of th character when scaled by regions. | |
Vector2 | SolidSize [get, set] |
Gets/sets the character's blocking width and height. | |
bool | UseSpriteAsHotspot [get, set] |
Gets/sets whether the character uses it's sprite as it's hotspot, instead of a collider specified in the inspector. | |
eFace | Facing [get, set] |
The enumerated direction the character is facing. Useful when you want to set a character's face direction without them turning. | |
bool | Clickable [get, set] |
Gets or Sets whether clicking on the object triggers an event. | |
bool | Visible [get, set] |
Gets or sets whether the character visible flag is set. | |
bool | VisibleInRoom [get] |
Gets whether the character is actually visible and in the current room. Same as (C.Fred.Visible && C.Fred.Room != null && C.Fred.Room == R.Current) | |
bool | Solid [get, set] |
Gets/sets whether the character can be walked through by other characters. If this is set to true, then the character is solid and will block the path of other characters. If this is set to false, then the character acts like a hologram, and other characters can walk straight through him. | |
bool | Moveable [get, set] |
Gets or sets whether the character can move/walk. If false, WalkTo commands are ignored. | |
bool | Walking [get] |
Gets a value indicating whether this ICharacter is currently walking. | |
bool | Talking [get] |
Gets a value indicating whether this ICharacter is currently talking. | |
bool | Animating [get] |
Gets a value indicating whether this ICharacter is playing an animation from PlayAnimation() , or Animation = "someAnim" NOT a regular Idle, walk or Talk anim. | |
bool | IsPlayer [get] |
Whether this instance is the current player. | |
Color | TextColour [get, set] |
Gets or sets the text colour for the character's speech text. | |
Vector2 | TextPositionOverride [get, set] |
Gets or sets the position the player's dialog text will be shown (in world space). If set to zero, the default will be used (Displayed above the character sprite). | |
Vector2 | TextPositionOffset [get, set] |
Distance that dialog text is offset from the top of the sprite, added to the global one set in PowerQuest settings. Will flip with the character. Defaults is zero. | |
string | AnimIdle [get, set] |
Gets or sets the idle animation of the character. | |
string | AnimWalk [get, set] |
Gets or sets the walk animation of the character. | |
string | AnimTalk [get, set] |
Gets or sets the talk animation of the character. | |
string | AnimMouth [get, set] |
Gets or sets the lipsync mouth animation of the character, attached to a node. | |
string | AnimPrefix [get, set] |
If an AnimPrefix is set, when an animation is played, the system will check if an anim exists with this prefix, before falling back to the regular anim. | |
string | Cursor [get, set] |
Gets or sets the cursor to show when hovering over the object. If empty, default active cursor will be used. | |
bool | UseRegionTinting [get, set] |
Gets or sets a value indicating whether this ICharacter use region tinting. | |
bool | UseRegionScaling [get, set] |
Gets or sets a value indicating whether this ICharacter use region scaling. | |
bool | FirstUse [get] |
Returns true the first time the player "uses" the object. | |
bool | FirstLook [get] |
Returns true the first time the player "looked" at the object. | |
int | UseCount [get] |
Returns the number of times player has "used" at the object. 0 when it's the first click on the object. | |
int | LookCount [get] |
Returns the number of times player has "looked" at the object. 0 when it's the first click on the object. | |
Vector2 | WalkToPoint [get, set] |
Gets or sets the walk to point. | |
Vector2 | LookAtPoint [get, set] |
Gets or sets the look at point. | |
string | Animation [get, set] |
Gets or sets an override animation on the character. Until StopAnimation() is called, this will play, and AnimIdle,AnimTalk,AnimWalk will all be ignored. This is the equivalent of calling PlayAnimationBG() with pauseAtEnd set to true. | |
string | FootstepSound [get, set] |
Gets/Sets name of the sound used for footsteps for this character. Add "Footstep" event in the anim editor (with "Anim prefix" ticked) | |
bool | AntiGlide [get, set] |
Gets/Sets Anti-Glide option. When enabled, the character waits for an animation frame before moving, otherwise they "glide" smoothly across the ground. | |
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. | |
IInventory | ActiveInventory [get, set] |
Gets or sets the active inventory (item that's currently selected/being used) | |
string | ActiveInventoryName [get, set] |
Gets or sets the active inventory (item that's currently selected/being used) | |
bool | HasActiveInventory [get] |
Returns true if there's any active inventory (item that's currently selected/being used) | |
Character | Data [get] |
Access to the base class with extra functionality used by the PowerQuest. | |
Public Member Functions | |||||||
void | SetPosition (float x, float y, eFace face=eFace.None) | ||||||
Set the location of the character, with an optional 'facing' direction. | |||||||
void | SetPosition (Vector2 position, eFace face=eFace.None) | ||||||
Set the location of the character, with an optional 'facing' direction. | |||||||
void | SetPosition (IQuestClickableInterface atClickable, eFace face=eFace.None) | ||||||
Set the location of the character to the walk to point of a prop/hotspot/character, with an optional 'facing' direction. | |||||||
void | ResetWalkSpeed () | ||||||
Resets walk speed to original default from the inspector. So you can set the WalkSpeed property, and easily go back to the original. | |||||||
void | SetTextPosition (Vector2 worldPosition) | ||||||
Sets the character's text position in world space. | |||||||
void | SetTextPosition (float worldPosX, float worldPosY) | ||||||
Sets the character's text position in world space. | |||||||
void | LockTextPosition () | ||||||
Sets the text position to stay in its current position, even if character moves or is hidden. | |||||||
void | ResetTextPosition () | ||||||
Resets the text position again after a call to SetTextPosition or LockTextPosition. | |||||||
Coroutine | WalkTo (float x, float y, bool anywhere=false) | ||||||
Make the character walk to a position in game coords. | |||||||
Coroutine | WalkTo (Vector2 pos, bool anywhere=false) | ||||||
Make the character walk to a position in game coords. | |||||||
Coroutine | WalkTo (IQuestClickableInterface clickable, bool anywhere=false) | ||||||
Make the character walk to the walk-to-point of a clickable object. (characters, props, hotspots, etc) | |||||||
void | WalkToBG (float x, float y, bool anywhere=false, eFace thenFace=eFace.None) | ||||||
Make the character walk to a position in game coords without halting the script. | |||||||
void | WalkToBG (Vector2 pos, bool anywhere=false, eFace thenFace=eFace.None) | ||||||
Make the character walk to a position in game coords without halting the script. | |||||||
void | WalkToBG (IQuestClickableInterface clickable, bool anywhere=false, eFace thenFace=eFace.None) | ||||||
Make the character walk to the walk-to-point of a clickable object without halting the script. | |||||||
Coroutine | WalkToClicked (bool anywhere=false) | ||||||
Make the character walk to the walk-to-point of the last object clicked on. In QuestScripts you can use the shortcut WalkToClicked | |||||||
void | WalkToBG (float x, float y, eFace thenFace) | ||||||
Make the character walk to a position in game coords without halting the script, then face the passed in direction. | |||||||
void | WalkToBG (Vector2 pos, eFace thenFace) | ||||||
Make the character walk to a position in game coords without halting the script, then face the passed in direction. | |||||||
void | WalkToBG (IQuestClickableInterface clickable, eFace thenFace) | ||||||
Make the character walk to the walk-to-point of a clickable object without halting the script, then face the passed in direction. | |||||||
void | StopWalking () | ||||||
Stop the character walking or moving. Also clears any waypoints. | |||||||
void | AddWaypoint (float x, float y, eFace thenFace=eFace.None) | ||||||
Tells the character to move to a location directly, after it has finished its current move. Ignores walkable areas. | |||||||
void | AddWaypoint (Vector2 pos, eFace thenFace=eFace.None) | ||||||
Tells the character to walk to a point directly, after it has finished its current move. Ignores walkable areas. | |||||||
Coroutine | MoveTo (float x, float y, bool anywhere=false) | ||||||
Make the character move to a position in game coords without playing their walk animation. | |||||||
Coroutine | MoveTo (Vector2 pos, bool anywhere=false) | ||||||
Make the character move to a position in game coords without playing their walk animation. | |||||||
Coroutine | MoveTo (IQuestClickableInterface clickable, bool anywhere=false) | ||||||
Make the character move to the walk-to-point of a clickable object. Their Walk animation will NOT be played. | |||||||
void | MoveToBG (float x, float y, bool anywhere=false) | ||||||
Make the character move to a position in game coords without halting the script. Their Walk animation will NOT be played. | |||||||
void | MoveToBG (Vector2 pos, bool anywhere=false) | ||||||
Make the character move to a position in game coords without halting the script. Their Walk animation will NOT be played. | |||||||
void | MoveToBG (IQuestClickableInterface clickable, bool anywhere=false) | ||||||
Make the character move to the walk-to-point of a clickable object without halting the script. Their Walk animation will NOT be played. | |||||||
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. | |||||||
void | ChangeRoomBG (IRoom room) | ||||||
Moves the character to another room. If the player character is moved, the scene will change to the new room. | |||||||
void | Show (bool clickable) | ||||||
Obsolete: Set's visible & clickable (Same as Enable(bool clickable) ), and changes them to the current room (if they weren't there already) | |||||||
void | Show (Vector2 pos=new Vector2(), eFace facing=eFace.None) | ||||||
Shows the character, moving them to current room, and forcing Visible to true. You can optionally pass in a position or face direction. If not passed no change will be made. The Enable() function is similar, but doesn't set Visible to true, or move them to the current room. | |||||||
void | Show (float posX, float posy, eFace facing=eFace.None) | ||||||
Shows the character, moving them to current room, and forcing Visible to true. You can optionally pass in a position or face direction. If not passed no change will be made. The Enable() function is similar, but doesn't set Visible to true, or move them to the current room. | |||||||
void | Show (eFace facing) | ||||||
Shows the character, moving them to current room, and forcing Visible to true. You can optionally pass in a position or face direction. If not passed no change will be made. The Enable() function is similar, but doesn't set Visible to true, or move them to the current room. | |||||||
void | Hide () | ||||||
Note- leaving this as an extention for now until I work out how much use it gets Shows the character, moving them to current room, and forcing Visible to true. The character will be positioned at the Walk To of the passed in prop/hotspot/character, and optionally a face direction. The Enable() function is similar, but doesn't set Visible to true, or move them to the current room. Eg: C.Plr.Show(H.Door, eFace.Right);. | |||||||
void | Enable () | ||||||
Enables the character again after a call to Disable() or Hide() . Does NOT move them to the current room, or set Visible like Show() does. | |||||||
void | Enable (bool clickable) | ||||||
Obsolete: Set's visible & clickable, and changes them to the current room (if they weren't there already) | |||||||
void | Disable () | ||||||
Disables the character until Enable() is called. Saves you setting Visible, Clickable, Solid all to false. | |||||||
Coroutine | Face (eFace direction, bool instant=false) | ||||||
Faces character in a direction. Turning, unless instant is false. | |||||||
Coroutine | Face (IQuestClickable clickable, bool instant=false) | ||||||
Faces character towards the look-at-point of a clickable (character, prop, hotspot) | |||||||
Coroutine | Face (IQuestClickableInterface clickable, bool instant=false) | ||||||
Faces character towards the look-at-point of a clickable (character, prop, hotspot) | |||||||
Coroutine | FaceDown (bool instant=false) | ||||||
Faces character down (towards camera) | |||||||
Coroutine | FaceUp (bool instant=false) | ||||||
Faces character up (away from camera) | |||||||
Coroutine | FaceLeft (bool instant=false) | ||||||
Faces character left. | |||||||
Coroutine | FaceRight (bool instant=false) | ||||||
Faces character right. | |||||||
Coroutine | FaceUpRight (bool instant=false) | ||||||
Faces character a specified direction. | |||||||
Coroutine | FaceUpLeft (bool instant=false) | ||||||
Faces character a specified direction. | |||||||
Coroutine | FaceDownRight (bool instant=false) | ||||||
Faces character a specified direction. | |||||||
Coroutine | FaceDownLeft (bool instant=false) | ||||||
Faces character a specified direction. | |||||||
Coroutine | Face (float x, float y, bool instant=false) | ||||||
Faces character towards a position in on screen coords. | |||||||
Coroutine | Face (Vector2 location, bool instant=false) | ||||||
Faces character towards a position in on screen coords. | |||||||
Coroutine | FaceClicked (bool instant=false) | ||||||
Faces character towards the look-at-point of the last object clicked on. | |||||||
Coroutine | FaceAway (bool instant=false) | ||||||
Faces character in opposite direction to current. | |||||||
Coroutine | FaceDirection (Vector2 directionV2, bool instant=false) | ||||||
Faces character in a direction. | |||||||
void | FaceBG (eFace direction, bool instant=false) | ||||||
Faces character in a direction. Turning, unless instant is false. Does NOT halt script. | |||||||
void | FaceBG (IQuestClickable clickable, bool instant=false) | ||||||
Faces character towards the look-at-point of a clickable (character, prop, hotspot). Does NOT halt script. | |||||||
void | FaceBG (IQuestClickableInterface clickable, bool instant=false) | ||||||
Faces character towards the look-at-point of a clickable (character, prop, hotspot). Does NOT halt script. | |||||||
void | FaceDownBG (bool instant=false) | ||||||
Faces character down (towards camera). Does NOT halt script. | |||||||
void | FaceUpBG (bool instant=false) | ||||||
Faces character up (away from camera). Does NOT halt script. | |||||||
void | FaceLeftBG (bool instant=false) | ||||||
Faces character left. Does NOT halt script. | |||||||
void | FaceRightBG (bool instant=false) | ||||||
Faces character right. Does NOT halt script. | |||||||
void | FaceUpRightBG (bool instant=false) | ||||||
Faces character a specified direction. Does NOT halt script. | |||||||
void | FaceUpLeftBG (bool instant=false) | ||||||
Faces character a specified direction. Does NOT halt script. | |||||||
void | FaceDownRightBG (bool instant=false) | ||||||
Faces character a specified direction. Does NOT halt script. | |||||||
void | FaceDownLeftBG (bool instant=false) | ||||||
Faces character a specified direction. Does NOT halt script. | |||||||
void | FaceBG (float x, float y, bool instant=false) | ||||||
Faces character towards a position in on screen coords. Does NOT halt script. | |||||||
void | FaceBG (Vector2 location, bool instant=false) | ||||||
Faces character towards a position in on screen coords. Does NOT halt script. | |||||||
void | FaceClickedBG (bool instant=false) | ||||||
Faces character towards the look-at-point of the last object clicked on. Does NOT halt script. | |||||||
void | FaceAwayBG (bool instant=false) | ||||||
Faces character in opposite direction to current. Does NOT halt script. | |||||||
void | FaceDirectionBG (Vector2 directionV2, bool instant=false) | ||||||
Faces character in a direction. Does NOT halt script. | |||||||
void | StartFacingCharacter (ICharacter character, float minWaitTime=0.2f, float maxWaitTime=0.4f) | ||||||
Causes the character to face another character, and continue to turn to face them if either character moves.
| |||||||
void | StopFacingCharacter () | ||||||
Stops the chracter facing another after a call to StartFacingCharacter() | |||||||
Coroutine | Say (string dialog, int id=-1) | ||||||
Make chracter speak a line of dialog. eg. C.Barney.Say("Hello"); Note that in QuestScript window you can just type Barney: Hello | |||||||
Coroutine | SayBG (string dialog, int id=-1) | ||||||
Make chracter speak a line of dialog, without halting the script. eg. C.Barney.SayBG("Some dialog I'm saying in the background"); | |||||||
void | CancelSay () | ||||||
Cancel any current dialog the character's speaking. | |||||||
Coroutine | SayNoSkip (string dialog, int id=-1) | ||||||
Start character saying something, unskippable. Useful in background conversations. | |||||||
Coroutine | PlayAnimation (string animName) | ||||||
Play an animation on the character. Will return to idle after animation ends. | |||||||
void | PlayAnimationBG (string animName, bool pauseAtEnd=false) | ||||||
Play an animation on the character without halting the script. Will return to idle after animation ends, unless pauseAtEnd is true. | |||||||
void | PauseAnimation () | ||||||
void | ResumeAnimation () | ||||||
void | StopAnimation () | ||||||
void | SkipTransition () | ||||||
Stops any transition or turning animation, skipping to the end. | |||||||
void | AddAnimationTrigger (string triggerName, bool removeAfterTriggering, System.Action action) | ||||||
Adds a function to be called on an animation event here. Eg: to play a sound or effect on an animation tag. | |||||||
void | RemoveAnimationTrigger (string triggerName) | ||||||
Removes an existing animation trigger. | |||||||
Coroutine | WaitForAnimTrigger (string eventName) | ||||||
Waits until an Event/Tag in the current animation is reached. | |||||||
Coroutine | WaitForTransition (bool skippable=false) | ||||||
Waits until a character has finished their transition and/or turning animation. | |||||||
Coroutine | WaitForIdle (bool skippable=false) | ||||||
Waits until a character is idle. ie: Not Walking,Talking,Animating,Turning, or Transitioning. | |||||||
float | GetInventoryItemCount () | ||||||
Returns total number of inventory items that he player has. | |||||||
float | GetInventoryQuantity (string itemName) | ||||||
Gets the number of a particular inventory item the player has. | |||||||
bool | HasInventory (string itemName) | ||||||
Returns true if the player has the specified inventory item. | |||||||
bool | GetEverHadInventory (string itemName) | ||||||
Returns true if the player has, or ever had the specified inventory item. | |||||||
void | AddInventory (string itemName, float quantity=1) | ||||||
Adds an item to the player's inventory. | |||||||
void | RemoveInventory (string itemName, float quantity=1) | ||||||
Removes an item from the player's inventory. | |||||||
float | GetInventoryQuantity (IInventory item) | ||||||
Gets the number of a particular inventory item the player has. | |||||||
bool | HasInventory (IInventory item) | ||||||
Returns true if the player has the specified inventory item. | |||||||
bool | GetEverHadInventory (IInventory item) | ||||||
Returns true if the player has, or ever had the specified inventory item. | |||||||
void | AddInventory (IInventory item, float quantity=1) | ||||||
Adds an item to the player's inventory. | |||||||
void | RemoveInventory (IInventory item, float quantity=1) | ||||||
Removes an item from the player's inventory. | |||||||
void | ClearInventory () | ||||||
Remove all inventory items from the player. | |||||||
void | ReplaceInventory (IInventory oldItem, IInventory newItem) | ||||||
Replaces an inventory item with another (keeping the same slot position) | |||||||
T | GetScript< T > () | ||||||
PowerQuest internal function: 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;. | |||||||
|
getset |
Gets/Sets the name shown to players.
|
get |
The name used in scripts.
|
get |
Access to the actual game object component in the scene.
|
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.
|
get |
Returns the last room visited before the current one.
|
getset |
The location of the character. Eg: C.Player.Position = new Vector2(10,20);
or C.Dave.Position = Point.UnderTree;
|
get |
The positiont the character is currently at, or walking towards.
|
getset |
The position of the character's baseline (for sorting). This is local to the player, usually zero is at their feet. To get the player's baseline in world space do float baseline = Plr.Baseline - Plr.Position.y;
|
getset |
The speed the character walks horizontally and vertically. Eg: C.Player.WalkSpeed = new Vector2(10,20);
|
getset |
Whether character turns before walking.
|
getset |
Whether character turns before facing (eg: with C.Player.FaceLeft();.
|
getset |
How fast characters turn (turning-frames-per-second)
|
getset |
Whether the walk speed adjusts to match the size of th character when scaled by regions.
|
getset |
Gets/sets the character's blocking width and height.
The solid size determines how large of a blocking rectangle the character exerts to stop other characters walking through it. If this is set to 0,0 (the default), then the blocking rectangle is automatically calculated to be the character's width, and 5 pixels high. You can manually change the setting by entering a blocking height in pixels, which is the size of walkable area that the character effectively removes by standing on it.
|
getset |
Gets/sets whether the character uses it's sprite as it's hotspot, instead of a collider specified in the inspector.
|
getset |
The enumerated direction the character is facing. Useful when you want to set a character's face direction without them turning.
Example:
If Dave is facing right, immediately change him to be facing up-left if ( C.Dave.Facing == eFace.Right ) C.Dave.Facing = eFace.UpLeft;
|
getset |
Gets or Sets whether clicking on the object triggers an event.
|
getset |
Gets or sets whether the character visible flag is set.
|
get |
Gets whether the character is actually visible and in the current room. Same as (C.Fred.Visible && C.Fred.Room != null && C.Fred.Room == R.Current)
|
getset |
Gets/sets whether the character can be walked through by other characters. If this is set to true, then the character is solid and will block the path of other characters. If this is set to false, then the character acts like a hologram, and other characters can walk straight through him.
|
getset |
Gets or sets whether the character can move/walk. If false, WalkTo commands are ignored.
|
get |
Gets a value indicating whether this ICharacter is currently walking.
|
get |
Gets a value indicating whether this ICharacter is currently talking.
|
get |
Gets a value indicating whether this ICharacter is playing an animation from PlayAnimation()
, or Animation = "someAnim"
NOT a regular Idle, walk or Talk anim.
|
get |
Whether this instance is the current player.
|
getset |
Gets or sets the text colour for the character's speech text.
|
getset |
Gets or sets the position the player's dialog text will be shown (in world space). If set to zero, the default will be used (Displayed above the character sprite).
|
getset |
Distance that dialog text is offset from the top of the sprite, added to the global one set in PowerQuest settings. Will flip with the character. Defaults is zero.
|
getset |
Gets or sets the idle animation of the character.
|
getset |
Gets or sets the walk animation of the character.
|
getset |
Gets or sets the talk animation of the character.
|
getset |
Gets or sets the lipsync mouth animation of the character, attached to a node.
|
getset |
If an AnimPrefix is set, when an animation is played, the system will check if an anim exists with this prefix, before falling back to the regular anim.
Eg. if prefix is 'Angry', then, when a 'Walk' anim is played, it'll first check if there's an 'AngryWalk' anim.
|
getset |
Gets or sets the cursor to show when hovering over the object. If empty, default active cursor will be used.
|
getset |
Gets or sets a value indicating whether this ICharacter use region tinting.
true
if use region tinting; otherwise, false
.
|
getset |
Gets or sets a value indicating whether this ICharacter use region scaling.
true
if use region scaling; otherwise, false
.
|
get |
Returns true the first time the player "uses" the object.
|
get |
Returns true the first time the player "looked" at the object.
|
get |
Returns the number of times player has "used" at the object. 0 when it's the first click on the object.
|
get |
Returns the number of times player has "looked" at the object. 0 when it's the first click on the object.
|
getset |
Gets or sets the walk to point.
Note that this is an offset from the character's position:
Vector2 actualWalkToPos = C.Barney.WalkToPoint + C.Barney.Position;
C.Barney.WalkToPoint = Points.BarneyNewWalkTo - C.Barney.Position;
|
getset |
Gets or sets the look at point.
Note that this is an offset from the character's position:
Vector2 actualLookAtPos = C.Barney.LookAtPoint + C.Barney.Position;
C.Barney.LookAtPoint = Points.BarneyNewLookAt - C.Barney.Position;
|
getset |
Gets or sets an override animation on the character. Until StopAnimation() is called, this will play, and AnimIdle,AnimTalk,AnimWalk will all be ignored. This is the equivalent of calling PlayAnimationBG() with pauseAtEnd set to true.
|
getset |
Gets/Sets name of the sound used for footsteps for this character. Add "Footstep" event in the anim editor (with "Anim prefix" ticked)
|
getset |
Gets/Sets Anti-Glide option. When enabled, the character waits for an animation frame before moving, otherwise they "glide" smoothly across the ground.
|
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.
|
getset |
Gets or sets the active inventory (item that's currently selected/being used)
|
getset |
Gets or sets the active inventory (item that's currently selected/being used)
|
get |
Returns true if there's any active inventory (item that's currently selected/being used)
|
get |
Access to the base class with extra functionality used by the PowerQuest.
void SetPosition | ( | float | x, |
float | y, | ||
eFace | face = eFace.None ) |
Set the location of the character, with an optional 'facing' direction.
Eg C.Dave.SetPosition(12,34);
or C.Barney.SetPosition(43,21,eFace.Right);
. Tip: Move your cursor over the scene window and press Ctrl+M to copy the coordinates to the clipboard. Then paste them into this function!
void SetPosition | ( | Vector2 | position, |
eFace | face = eFace.None ) |
void SetPosition | ( | IQuestClickableInterface | atClickable, |
eFace | face = eFace.None ) |
void ResetWalkSpeed | ( | ) |
Resets walk speed to original default from the inspector. So you can set the WalkSpeed property, and easily go back to the original.
void SetTextPosition | ( | Vector2 | worldPosition | ) |
Sets the character's text position in world space.
void SetTextPosition | ( | float | worldPosX, |
float | worldPosY ) |
Sets the character's text position in world space.
void LockTextPosition | ( | ) |
Sets the text position to stay in its current position, even if character moves or is hidden.
void ResetTextPosition | ( | ) |
Resets the text position again after a call to SetTextPosition or LockTextPosition.
Coroutine WalkTo | ( | float | x, |
float | y, | ||
bool | anywhere = false ) |
Make the character walk to a position in game coords.
If 'anywhere' is true, the character will ignore walkable areas
There are a few different WalkTo functions to serve different needs. eg: C.Dave.WalkTo(12,34);
, C.Dave.WalkTo(Points.IntoSky, true);,
C.Dave.WalkTo(C.Barney);, or the quest script command
WalkToClicked`
Coroutine WalkTo | ( | Vector2 | pos, |
bool | anywhere = false ) |
Make the character walk to a position in game coords.
If 'anywhere' is true, the character will ignore walkable areas
There are a few different WalkTo functions to serve different needs. eg: C.Dave.WalkTo(12,34);
, C.Dave.WalkTo(Points.IntoSky, true);,
C.Dave.WalkTo(C.Barney);, or the quest script command
WalkToClicked`
Coroutine WalkTo | ( | IQuestClickableInterface | clickable, |
bool | anywhere = false ) |
Make the character walk to the walk-to-point of a clickable object. (characters, props, hotspots, etc)
If 'anywhere' is true, the character will ignore walkable areas
There are a few different WalkTo functions to serve different needs. eg: C.Dave.WalkTo(12,34);
, C.Dave.WalkTo(Points.IntoSky, true);,
C.Dave.WalkTo(C.Barney);, or the quest script command
WalkToClicked`
void WalkToBG | ( | float | x, |
float | y, | ||
bool | anywhere = false, | ||
eFace | thenFace = eFace.None ) |
Make the character walk to a position in game coords without halting the script.
eg: C.Dave.WalkToBG(12,34);
or C.Barney.WalkToBG(43,21,false,eFace.Left);
If 'anywhere' is true, the character will ignore walkable areas If 'thenFace' is specified, the character will face that direction once they finish walking
void WalkToBG | ( | Vector2 | pos, |
bool | anywhere = false, | ||
eFace | thenFace = eFace.None ) |
Make the character walk to a position in game coords without halting the script.
If 'anywhere' is true, the character will ignore walkable areas If 'thenFace' is specified, the character will face that direction once they finish walking
void WalkToBG | ( | IQuestClickableInterface | clickable, |
bool | anywhere = false, | ||
eFace | thenFace = eFace.None ) |
Make the character walk to the walk-to-point of a clickable object without halting the script.
Coroutine WalkToClicked | ( | bool | anywhere = false | ) |
Make the character walk to the walk-to-point of the last object clicked on. In QuestScripts you can use the shortcut WalkToClicked
void WalkToBG | ( | float | x, |
float | y, | ||
eFace | thenFace ) |
Make the character walk to a position in game coords without halting the script, then face the passed in direction.
eg: C.Barney.WalkToBG(43,21,eFace.Left);
void WalkToBG | ( | Vector2 | pos, |
eFace | thenFace ) |
Make the character walk to a position in game coords without halting the script, then face the passed in direction.
void WalkToBG | ( | IQuestClickableInterface | clickable, |
eFace | thenFace ) |
Make the character walk to the walk-to-point of a clickable object without halting the script, then face the passed in direction.
eg. `Plr.WalkToBG( H.Door, eFace.UpRight );
void StopWalking | ( | ) |
Stop the character walking or moving. Also clears any waypoints.
void AddWaypoint | ( | float | x, |
float | y, | ||
eFace | thenFace = eFace.None ) |
Tells the character to move to a location directly, after it has finished its current move. Ignores walkable areas.
This function allows you to queue up a series of moves for the character to make, if you want them to take a preset path around the screen. Note that any moves made with this command ignore walkable areas.
This is useful for situations when you might want a townsperson to wander onto the screen from one side, take a preset route around it and leave again.
If thenFace
is specified, the character will face that direction once they finish walking
Example:
C.Barney.WalkTo(160, 100); C.Barney.AddWaypoint(50, 150); C.Barney.AddWaypoint(50, 50, eFace.Right);
Tells character Barney to first of all walk to the centre of the screen normally (obeying walkable areas), then move to the bottom left corner and then top left corner afterwards, then face right.
void AddWaypoint | ( | Vector2 | pos, |
eFace | thenFace = eFace.None ) |
Tells the character to walk to a point directly, after it has finished its current move. Ignores walkable areas.
This function allows you to queue up a series of moves for the character to make, if you want them to take a preset path around the screen. Note that any moves made with this command ignore walkable areas.
This is useful for situations when you might want a townsperson to wander onto the screen from one side, take a preset route around it and leave again.
If thenFace
is specified, the character will face that direction once they finish walking
Example:
C.Barney.WalkTo(Points.Center); C.Barney.AddWaypoint(Points.BotLeft); C.Barney.AddWaypoint(Points.TopLeft, eFace.Right);
Tells character Barney to first of all walk to the centre of the screen normally (obeying walkable areas), then move to the bottom left corner and then top left corner afterwards, Then face right.
Coroutine MoveTo | ( | float | x, |
float | y, | ||
bool | anywhere = false ) |
Make the character move to a position in game coords without playing their walk animation.
If 'anywhere' is true, the character will ignore walkable areas
This is the same as WalkTo()
, except that the character won't face the direction they're moving, and won't play their walk animation. In the majority of cases you should use WalkTo()
eg: C.Dave.MoveTo(12,34);
, C.Dave.MoveTo(Points.IntoSky, true);
.
Coroutine MoveTo | ( | Vector2 | pos, |
bool | anywhere = false ) |
Make the character move to a position in game coords without playing their walk animation.
If 'anywhere' is true, the character will ignore walkable areas
This is the same as WalkTo()
, except that the character won't face the direction they're moving, and won't play their walk animation. In the majority of cases you should use WalkTo()
eg: C.Dave.MoveToBG(12,34);
, C.Dave.MoveToBG(Points.IntoSky, true);
.
Coroutine MoveTo | ( | IQuestClickableInterface | clickable, |
bool | anywhere = false ) |
Make the character move to the walk-to-point of a clickable object. Their Walk animation will NOT be played.
If 'anywhere' is true, the character will ignore walkable areas
This is the same as WalkTo()
, except that the character won't face the direction they're moving, and won't play their walk animation. In the majority of cases you should use WalkTo()
eg: C.Dave.MoveToBG(12,34);
, C.Dave.MoveToBG(Points.IntoSky, true);
.
void MoveToBG | ( | float | x, |
float | y, | ||
bool | anywhere = false ) |
Make the character move to a position in game coords without halting the script. Their Walk animation will NOT be played.
This is the same as WalkToBG()
, except that the character won't face the direction they're moving, and won't play their walk animation. In the majority of cases you should use WalkTo()
eg: C.Dave.MoveToBG(12,34);
, C.Dave.MoveToBG(Points.IntoSky, true);
If 'anywhere' is true, the character will ignore walkable areas
void MoveToBG | ( | Vector2 | pos, |
bool | anywhere = false ) |
Make the character move to a position in game coords without halting the script. Their Walk animation will NOT be played.
This is the same as WalkToBG()
, except that the character won't face the direction they're moving, and won't play their walk animation. In the majority of cases you should use WalkTo()
If 'anywhere' is true, the character will ignore walkable areas
void MoveToBG | ( | IQuestClickableInterface | clickable, |
bool | anywhere = false ) |
Make the character move to the walk-to-point of a clickable object without halting the script. Their Walk animation will NOT be played.
This is the same as WalkToBG()
, except that the character won't face the direction they're moving, and won't play their walk animation. In the majority of cases you should use WalkTo()
If 'anywhere' is true, the character will ignore walkable areas
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.
void ChangeRoomBG | ( | IRoom | room | ) |
Moves the character to another room. If the player character is moved, the scene will change to the new room.
void Show | ( | bool | clickable | ) |
Obsolete: Set's visible & clickable (Same as Enable(bool clickable)
), and changes them to the current room (if they weren't there already)
void Show | ( | Vector2 | pos = new Vector2(), |
eFace | facing = eFace.None ) |
Shows the character, moving them to current room, and forcing Visible to true. You can optionally pass in a position or face direction. If not passed no change will be made. The Enable() function is similar, but doesn't set Visible to true, or move them to the current room.
void Show | ( | float | posX, |
float | posy, | ||
eFace | facing = eFace.None ) |
Shows the character, moving them to current room, and forcing Visible to true. You can optionally pass in a position or face direction. If not passed no change will be made. The Enable() function is similar, but doesn't set Visible to true, or move them to the current room.
void Show | ( | eFace | facing | ) |
Shows the character, moving them to current room, and forcing Visible to true. You can optionally pass in a position or face direction. If not passed no change will be made. The Enable() function is similar, but doesn't set Visible to true, or move them to the current room.
void Hide | ( | ) |
Note- leaving this as an extention for now until I work out how much use it gets Shows the character, moving them to current room, and forcing Visible to true. The character will be positioned at the Walk To of the passed in prop/hotspot/character, and optionally a face direction. The Enable() function is similar, but doesn't set Visible to true, or move them to the current room. Eg: C.Plr.Show(H.Door, eFace.Right);.
void Enable | ( | ) |
void Enable | ( | bool | clickable | ) |
Obsolete: Set's visible & clickable, and changes them to the current room (if they weren't there already)
void Disable | ( | ) |
Coroutine Face | ( | eFace | direction, |
bool | instant = false ) |
Faces character in a direction. Turning, unless instant is false.
Coroutine Face | ( | IQuestClickable | clickable, |
bool | instant = false ) |
Faces character towards the look-at-point of a clickable (character, prop, hotspot)
Coroutine Face | ( | IQuestClickableInterface | clickable, |
bool | instant = false ) |
Faces character towards the look-at-point of a clickable (character, prop, hotspot)
Coroutine FaceDown | ( | bool | instant = false | ) |
Faces character down (towards camera)
Coroutine FaceUp | ( | bool | instant = false | ) |
Faces character up (away from camera)
Coroutine FaceLeft | ( | bool | instant = false | ) |
Faces character left.
Coroutine FaceRight | ( | bool | instant = false | ) |
Faces character right.
Coroutine FaceUpRight | ( | bool | instant = false | ) |
Faces character a specified direction.
Coroutine FaceUpLeft | ( | bool | instant = false | ) |
Faces character a specified direction.
Coroutine FaceDownRight | ( | bool | instant = false | ) |
Faces character a specified direction.
Coroutine FaceDownLeft | ( | bool | instant = false | ) |
Faces character a specified direction.
Coroutine Face | ( | float | x, |
float | y, | ||
bool | instant = false ) |
Faces character towards a position in on screen coords.
Coroutine Face | ( | Vector2 | location, |
bool | instant = false ) |
Faces character towards a position in on screen coords.
Coroutine FaceClicked | ( | bool | instant = false | ) |
Faces character towards the look-at-point of the last object clicked on.
Coroutine FaceAway | ( | bool | instant = false | ) |
Faces character in opposite direction to current.
Coroutine FaceDirection | ( | Vector2 | directionV2, |
bool | instant = false ) |
Faces character in a direction.
void FaceBG | ( | eFace | direction, |
bool | instant = false ) |
Faces character in a direction. Turning, unless instant is false. Does NOT halt script.
void FaceBG | ( | IQuestClickable | clickable, |
bool | instant = false ) |
Faces character towards the look-at-point of a clickable (character, prop, hotspot). Does NOT halt script.
void FaceBG | ( | IQuestClickableInterface | clickable, |
bool | instant = false ) |
Faces character towards the look-at-point of a clickable (character, prop, hotspot). Does NOT halt script.
void FaceDownBG | ( | bool | instant = false | ) |
Faces character down (towards camera). Does NOT halt script.
void FaceUpBG | ( | bool | instant = false | ) |
Faces character up (away from camera). Does NOT halt script.
void FaceLeftBG | ( | bool | instant = false | ) |
Faces character left. Does NOT halt script.
void FaceRightBG | ( | bool | instant = false | ) |
Faces character right. Does NOT halt script.
void FaceUpRightBG | ( | bool | instant = false | ) |
Faces character a specified direction. Does NOT halt script.
void FaceUpLeftBG | ( | bool | instant = false | ) |
Faces character a specified direction. Does NOT halt script.
void FaceDownRightBG | ( | bool | instant = false | ) |
Faces character a specified direction. Does NOT halt script.
void FaceDownLeftBG | ( | bool | instant = false | ) |
Faces character a specified direction. Does NOT halt script.
void FaceBG | ( | float | x, |
float | y, | ||
bool | instant = false ) |
Faces character towards a position in on screen coords. Does NOT halt script.
void FaceBG | ( | Vector2 | location, |
bool | instant = false ) |
Faces character towards a position in on screen coords. Does NOT halt script.
void FaceClickedBG | ( | bool | instant = false | ) |
Faces character towards the look-at-point of the last object clicked on. Does NOT halt script.
void FaceAwayBG | ( | bool | instant = false | ) |
Faces character in opposite direction to current. Does NOT halt script.
void FaceDirectionBG | ( | Vector2 | directionV2, |
bool | instant = false ) |
Faces character in a direction. Does NOT halt script.
void StartFacingCharacter | ( | ICharacter | character, |
float | minWaitTime = 0.2f, | ||
float | maxWaitTime = 0.4f ) |
Causes the character to face another character, and continue to turn to face them if either character moves.
character | The character to face |
minWaitTime | The minimum time delay before they'll turn to face the other character. Default 0.2 seconds. |
maxWaitTime | The maximum time delay before they'll turn to face the other character. Default 0.4 seconds. |
StopFacingCharacter();
void StopFacingCharacter | ( | ) |
Stops the chracter facing another after a call to StartFacingCharacter()
Coroutine Say | ( | string | dialog, |
int | id = -1 ) |
Make chracter speak a line of dialog. eg. C.Barney.Say("Hello");
Note that in QuestScript window you can just type Barney: Hello
Coroutine SayBG | ( | string | dialog, |
int | id = -1 ) |
Make chracter speak a line of dialog, without halting the script. eg. C.Barney.SayBG("Some dialog I'm saying in the background");
void CancelSay | ( | ) |
Cancel any current dialog the character's speaking.
Coroutine SayNoSkip | ( | string | dialog, |
int | id = -1 ) |
Start character saying something, unskippable. Useful in background conversations.
Coroutine PlayAnimation | ( | string | animName | ) |
Play an animation on the character. Will return to idle after animation ends.
void PlayAnimationBG | ( | string | animName, |
bool | pauseAtEnd = false ) |
Play an animation on the character without halting the script. Will return to idle after animation ends, unless pauseAtEnd is true.
If pauseAtEnd is true, the character will stay on the last frame until StopAnimation() is called. Otherwise they will return to idle once the animation has finished playing
void SkipTransition | ( | ) |
Stops any transition or turning animation, skipping to the end.
void AddAnimationTrigger | ( | string | triggerName, |
bool | removeAfterTriggering, | ||
System.Action | action ) |
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") );
void RemoveAnimationTrigger | ( | string | triggerName | ) |
Removes an existing animation trigger.
Coroutine WaitForAnimTrigger | ( | string | eventName | ) |
Waits until an Event/Tag in the current animation is reached.
Usage:
C.Player.WaitForAnimTrigger("Shoot");
.Example: Using it to play a sound and shake the screen at the time in an animation when the player shoots a gun:
C.Dave.PlayAnimationBG("AimAndFireGun"); C.Dave.WaitForAnimTrigger("Shoot"); Audio.Play("Bang"); Camera.Shake(); Barney: Ouch!
Coroutine WaitForTransition | ( | bool | skippable = false | ) |
Waits until a character has finished their transition and/or turning animation.
Coroutine WaitForIdle | ( | bool | skippable = false | ) |
Waits until a character is idle. ie: Not Walking,Talking,Animating,Turning, or Transitioning.
float GetInventoryItemCount | ( | ) |
Returns total number of inventory items that he player has.
float GetInventoryQuantity | ( | string | itemName | ) |
Gets the number of a particular inventory item the player has.
itemName | Name of the inventory item |
bool HasInventory | ( | string | itemName | ) |
Returns true if the player has the specified inventory item.
bool GetEverHadInventory | ( | string | itemName | ) |
Returns true if the player has, or ever had the specified inventory item.
void AddInventory | ( | string | itemName, |
float | quantity = 1 ) |
Adds an item to the player's inventory.
itemName | Name of the inventory item. |
quantity | The quantity of the item to add. |
void RemoveInventory | ( | string | itemName, |
float | quantity = 1 ) |
Removes an item from the player's inventory.
itemName | The name of the inventory item to remove. |
quantity | Quantity of the item to remove. |
float GetInventoryQuantity | ( | IInventory | item | ) |
Gets the number of a particular inventory item the player has.
item | The inventory item to check |
bool HasInventory | ( | IInventory | item | ) |
Returns true if the player has the specified inventory item.
bool GetEverHadInventory | ( | IInventory | item | ) |
Returns true if the player has, or ever had the specified inventory item.
void AddInventory | ( | IInventory | item, |
float | quantity = 1 ) |
Adds an item to the player's inventory.
item | The inventory item to add. |
quantity | The number of the item to add. |
void RemoveInventory | ( | IInventory | item, |
float | quantity = 1 ) |
Removes an item from the player's inventory.
item | The item to remove. |
quantity | Quantity of the item to remove. |
void ClearInventory | ( | ) |
Remove all inventory items from the player.
void ReplaceInventory | ( | IInventory | oldItem, |
IInventory | newItem ) |
Replaces an inventory item with another (keeping the same slot position)
T GetScript< T > | ( | ) |
PowerQuest internal function: 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;.
T | : | CharacterScript<T> |