# JUTPSActions Lib Scripting Reference

## JUTPSAction

This class keeps references for easy alteration during actions, it itself doesn't have functions/methods to use, it just keeps this references.

| Properties   | Description             |
| ------------ | ----------------------- |
| TPSCharacter | JU Character Controller |
| anim         | Animator Controller     |
| rb           | Rigidbody               |
| coll         | Collider                |
| cam          | Camera                  |

## JUTPSAnimatedAction

See below for virtual methods you can override

| Virtual Methods          | Description                                                                                       |
| ------------------------ | ------------------------------------------------------------------------------------------------- |
| void ActionCondition()   | called every frame, override this to check conditions                                             |
| void OnActionStarted()   | override this to call some code once the action starts                                            |
| void OnActionIsPlaying() | override this to call some code while action is playing                                           |
| void OnActionEnded()     | override this to call some code once the action ends                                              |
| void OnNoAction()        | override this to call some code while action state is none                                        |
| void Update()            | Unity's update method, override if you want to use it, but keep the `base.Update();` line of code |

See below the functions that a class that inherits the JUTPSAnimatedAction class can call:

<table><thead><tr><th width="373">Virtual Methods</th><th>Description</th></tr></thead><tbody><tr><td>PlayAnimation(<mark style="color:blue;">string</mark> AnimationStateName, <mark style="color:blue;">int</mark> LayerID, <mark style="color:blue;">float</mark> normalizedTime)</td><td>Play an animation in a layer and specific time</td></tr><tr><td>SwitchAnimationLayer(<mark style="color:green;">ActionPart</mark> BodyPartLayer)</td><td>Switch target body part</td></tr><tr><td>GetCurrentAnimationLayer()</td><td>Get index of layer of the target body part </td></tr><tr><td>DisableCharacterMovement(<mark style="color:blue;">float</mark> duration = 0)</td><td>Disable character movement for a limited time</td></tr><tr><td>SetCurrentItemIndexToLastUsedItem()</td><td>Save the current item Switch ID</td></tr><tr><td>DisableItemOnHand()</td><td>Unequip item</td></tr><tr><td>EnableLastUsedItem()</td><td>Equip item with the saved item switch ID</td></tr></tbody></table>
