![]() |
PowerQuest 0.20.12
|
Prop: Contains functions and data for manipluating Props in rooms. Eg.
P.GoldKey.Hide();
P.Ball.MoveTo(10,20,5);
P.Door.PlayAnimation("SlamShut");
P.Door.Animation = "Closed";
Inherits IQuestClickableInterface.
Properties | |
| string | Description [get, set] |
| Gets/Sets the description text shown to players when they hover the mouse over the object. | |
| string | ScriptName [get] |
| The name used in scripts. | |
| MonoBehaviour | Instance [get] |
| Access to the actual game object component in the scene. | |
| bool | Visible [get, set] |
| Gets or sets whether the object is visible. | |
| bool | Clickable [get, set] |
| Gets or Sets whether clicking on the object triggers an event. | |
| Vector2 | Position [get, set] |
| The location of the prop. | |
| bool | Moving [get] |
| Returns true while the prop is moving. | |
| float | Baseline [get, set] |
| Gets or sets the baseline used for sorting. | |
| Vector2 | WalkToPoint [get, set] |
| Gets or sets the walk to point. | |
| Vector2 | LookAtPoint [get, set] |
| Gets or sets the look at point. | |
| 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 | 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. | |
| string | Animation [get, set] |
| The prop's default Sprite or looping Animation, change this to change the visuals of the prop. NB: To play a one-shot animation on a prop, use PlayAnimation() or PlayAnimationBG(). After it finishes, the prop will return to using the sprite/animation specified here. | |
| bool | Animating [get] |
| Whether an animation triggered by PlayAnimation() is currently playing. Note- this does not include animations set using the Animation property. | |
| UnityEngine.Video.VideoPlayer | VideoPlayer [get] |
| Gets the prop's VideoPlayer component (if it has one). This can be used to pause/resume/stop video playback. | |
| float | Alpha [get, set] |
| Gets/Sets the transparency of the prop. (0.0f being fully transparent, 1.0f being fully opaque.) | |
| Prop | Data [get] |
| Access to the base class with extra functionality used by the PowerQuest. | |
Public Member Functions | |
| void | SetPosition (float x, float y) |
| Set the location of the prop. | |
| void | SetPosition (Vector2 position) |
| Set the location of the prop. | |
| Coroutine | MoveTo (float x, float y, float speed, eEaseCurve curve=eEaseCurve.None) |
| Move the prop over time. | |
| Coroutine | MoveTo (Vector2 toPos, float speed, eEaseCurve curve=eEaseCurve.None) |
| Move the prop over time. | |
| void | MoveToBG (Vector2 toPos, float speed, eEaseCurve curve=eEaseCurve.None) |
| Move the prop over time, non-blocking. | |
| void | Show (bool clickable=true) |
Set's visible & clickable (Same as Enable()) | |
| void | Hide () |
Set's invisible & non-clickable (Same as Disable()) | |
| void | Enable (bool clickable=true) |
| Set's visible & clickable. | |
| void | Disable () |
| Set's invisible & non-clickable. | |
| Coroutine | PlayAnimation (string animName) |
| Plays an animation on the prop, overriding whatever the current prop's 'Animation' property is set to until complete. | |
| void | PlayAnimationBG (string animName) |
| Plays an animation on the prop. Will return to playing Animation once it ends (Non-blocking) | |
| void | StopAnimation () |
| Stops an animation played from PlayAnimationBG(). The prop will return to it's default sprite or Animation. | |
| void | PauseAnimation () |
| Pauses the currently playing animation. Only works for animations played with PlayAnimationBG() | |
| void | ResumeAnimation () |
| Resumes playing the current animation after PauseAnimation() was called. | |
| Coroutine | PlayVideo (float skippableAfterTime=-1) |
| Starts video playback if the prop has a video component. Returns once the video has completed, or on mouse click if skippableAfterTime is greater than zero. | |
| void | PlayVideoBG () |
| Starts video playback if the prop has a video component. | |
| 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 | Fade (float start, float end, float duration, eEaseCurve curve=eEaseCurve.Smooth) |
| Fade the sprite's alpha (0.0f being fully transparent, 1.0f being fully opaque.) | |
| void | FadeBG (float start, float end, float duration, eEaseCurve curve=eEaseCurve.Smooth) |
| Fade the sprite's alpha (non-blocking). (0.0f being fully transparent, 1.0f being fully opaque.) | |
| Coroutine | DoInteract () |
| Runs the prop's "OnInteract" function from another script, the same as if you clicked on it. Blocks until finished. | |
| Coroutine | DoLookAt () |
| Runs the prop's "OnLookAt" function from another script, the same as if you clicked on it. Blocks until finished. | |
| Coroutine | DoUseInv (IInventory item) |
| Runs the prop's "OnUseInv" function from another script, the same as if you clicked on it. Blocks until finished. | |
|
getset |
Gets/Sets the description text shown to players when they hover the mouse over the object.
For example:
|
get |
The name used in scripts.
|
get |
Access to the actual game object component in the scene.
|
getset |
Gets or sets whether the object is visible.
|
getset |
Gets or Sets whether clicking on the object triggers an event.
|
getset |
The location of the prop.
|
get |
Returns true while the prop is moving.
|
getset |
Gets or sets the baseline used for sorting.
|
getset |
Gets or sets the walk to point.
|
getset |
Gets or sets the look at point.
|
getset |
Gets or sets the cursor to show when hovering over the object. If empty, default active cursor will be used.
|
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 |
The prop's default Sprite or looping Animation, change this to change the visuals of the prop. NB: To play a one-shot animation on a prop, use PlayAnimation() or PlayAnimationBG(). After it finishes, the prop will return to using the sprite/animation specified here.
|
get |
Whether an animation triggered by PlayAnimation() is currently playing. Note- this does not include animations set using the Animation property.
|
get |
Gets the prop's VideoPlayer component (if it has one). This can be used to pause/resume/stop video playback.
|
getset |
Gets/Sets the transparency of the prop. (0.0f being fully transparent, 1.0f being fully opaque.)
eg.
|
get |
Access to the base class with extra functionality used by the PowerQuest.
| void SetPosition | ( | float | x, |
| float | y ) |
Set the location of the prop.
| void SetPosition | ( | Vector2 | position | ) |
Set the location of the prop.
| Coroutine MoveTo | ( | float | x, |
| float | y, | ||
| float | speed, | ||
| eEaseCurve | curve = eEaseCurve.None ) |
Move the prop over time.
| Coroutine MoveTo | ( | Vector2 | toPos, |
| float | speed, | ||
| eEaseCurve | curve = eEaseCurve.None ) |
Move the prop over time.
| void MoveToBG | ( | Vector2 | toPos, |
| float | speed, | ||
| eEaseCurve | curve = eEaseCurve.None ) |
Move the prop over time, non-blocking.
| void Show | ( | bool | clickable = true | ) |
| Coroutine PlayAnimation | ( | string | animName | ) |
Plays an animation on the prop, overriding whatever the current prop's 'Animation' property is set to until complete.
NB: Animation play/pause/resume/stop stuff doesn't get saved. If you want to permanently change anim, set the Animation property
For example- If a door's Animation is set to "closed", play an "opening" animation, then change it's 'animation' to "open"
| void PlayAnimationBG | ( | string | animName | ) |
Plays an animation on the prop. Will return to playing Animation once it ends (Non-blocking)
NB: Animation play/pause/resume/stop stuff doesn't get saved. If you want to permanently change anim, set the Animation property
For example- If a door's Animation is set to "closed", play an "opening" animation and change it's 'animation' to "open".
| void StopAnimation | ( | ) |
Stops an animation played from PlayAnimationBG(). The prop will return to it's default sprite or Animation.
For example- Set a flag's default animation to "Still". Start a background "Flap" animation, wait a second, then stop it to return to the "Still" animation.
| void PauseAnimation | ( | ) |
Pauses the currently playing animation. Only works for animations played with PlayAnimationBG()
| void ResumeAnimation | ( | ) |
Resumes playing the current animation after PauseAnimation() was called.
| Coroutine PlayVideo | ( | float | skippableAfterTime = -1 | ) |
Starts video playback if the prop has a video component. Returns once the video has completed, or on mouse click if skippableAfterTime is greater than zero.
NB: Video playback position isn't currently saved
| void PlayVideoBG | ( | ) |
Starts video playback if the prop has a video component.
| 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 with the name you want (eg: "boom") Then add the trigger with the same name Prop("dynamite").AddAnimationTrigger( "boom", true, ()=>Audio.PlaySound("explode") );
Note: Usually it's easier to use WaitForAnimationTrigger instead
| void RemoveAnimationTrigger | ( | string | triggerName | ) |
Removes an existing animation trigger.
| Coroutine WaitForAnimTrigger | ( | string | eventName | ) |
Waits until an Event/Tag in the current animation is reached.
For example Add an event to the animation with the name you want (eg: "Boom")
Then use this code plays an animation in the background and waits for the anim event "Boom" before going to the next line
| Coroutine Fade | ( | float | start, |
| float | end, | ||
| float | duration, | ||
| eEaseCurve | curve = eEaseCurve.Smooth ) |
Fade the sprite's alpha (0.0f being fully transparent, 1.0f being fully opaque.)
| void FadeBG | ( | float | start, |
| float | end, | ||
| float | duration, | ||
| eEaseCurve | curve = eEaseCurve.Smooth ) |
Fade the sprite's alpha (non-blocking). (0.0f being fully transparent, 1.0f being fully opaque.)
| Coroutine DoInteract | ( | ) |
Runs the prop's "OnInteract" function from another script, the same as if you clicked on it. Blocks until finished.
| Coroutine DoLookAt | ( | ) |
Runs the prop's "OnLookAt" function from another script, the same as if you clicked on it. Blocks until finished.
| Coroutine DoUseInv | ( | IInventory | item | ) |
Runs the prop's "OnUseInv" function from another script, the same as if you clicked on it. Blocks until finished.