The base class for all plyGame related character controllers. More...
Inherits plyGame.Targetable, and plyGame.IPersistable.
Inherited by plyGame.NPCController, and plyGame.PlayerBaseController.
Public Types | |
enum | ValidInteractTargets { FriendlyActor = (1 << 0), NeutralActor = (1 << 1), HostileActor = (1 << 2), RPGObject = (1 << 3) } |
![]() | |
enum | Type { Type.Character = 1, Type.Object = 2, Type.Item = 4, Type.Unknown = 1024 } |
The targetable types More... | |
Public Member Functions | |
void | Save (string key) |
void | Load (string key) |
void | DeleteSaveData (string key) |
void | DisablePersistence () |
void | SelectTarget (GameObject go) |
Called when a target is selected. et the selected target. If null or passed object is not a Targetable, then the selected target will be cleared. You should call base.SelectTarget() if you override this. More... | |
virtual void | SelectTarget (Targetable t) |
Called when a target is selected. If null then the selected target will be cleared. You should call base.SelectTarget() if you override this. More... | |
virtual void | ClearTarget () |
Called when the target is cleared. You should call base.ClearTarget() if you override this. More... | |
virtual void | SetTargetInteract (GameObject go) |
The gameObject as target interact. The character will try to move to it and face it before the Interact related events are triggered. More... | |
virtual void | SetTargetInteract (Targetable t) |
The character will try to move to it and face it before the Interact related events are triggered. More... | |
virtual void | StopInteract () |
Trigger event on currently active interact More... | |
override Type | TargetableType () |
You will not need to override this in a base class as it already returns Type.Character. More... | |
override object | DataObject () |
You will not need to override this in a base class as it already returns actor (as data object). More... | |
virtual bool | MovementControlAllowed () |
Return true if the character may accept input to generate movement More... | |
virtual bool | IsPlayer () |
Derived class must override this to tell plyGame if this controller (Character) is a player character controller or non-player character (NPC). More... | |
virtual void | EnableControl (bool en) |
Enable or Disable Input (or AI in case of NPCs). Call base.EnableControl() if you override this. More... | |
virtual void | OnDeath () |
Called when the character is killed. Call base.Death() if you override this. More... | |
virtual void | SetMoveSpeed (float speed) |
Set the movement speed of the character More... | |
virtual void | SetTurnSpeed (float speed) |
Set the turn speed of the character More... | |
virtual float | MoveSpeed () |
Return the current move speed being used. This defaults to returning moveSpeed but some controllers might override this if they have other movement speed types, for example running during a chase. More... | |
virtual float | TurnSpeed () |
Return the current turn speed being used. This defaults to returning turnSpeed but some controllers might override this if they have other movement speed types, for example running during a chase. More... | |
virtual bool | Grounded () |
Is the character touching the floor/ ground? More... | |
virtual Vector3 | Velocity () |
Character's current velocity More... | |
virtual Vector3 | Movement () |
The calculated move vector. Needed by animation controllers that controls root motion, like the basic mecanim controller. More... | |
virtual bool | RequestFaceDirection (Vector3 direction, float delayAfter) |
Turn the character to face in direction. Return false if this character controller do not accept requests to turn. Actor uses this to ask the character to look in direction it needs to perform a skill. The delayAfter determine how long the character will face the target direction, after reaching it and before returning to viewing in direction it is moving (if moving). More... | |
virtual bool | RequestLookAt (Vector3 position, float delayAfter) |
Turn the character to face the target location (position). Return false if this character controller do not accept requests to turn. Actor uses this to ask the character to look in a direction to perform skill. The delayAfter determine how long the character will face the target direction, after reaching it and before returning to viewing in direction is is moving (if moving). More... | |
virtual bool | RequestMoveTo (Vector3 position, bool useFasterMovement) |
Move the character to position. Return false if this character controller do not accept requests to move. Actor uses this to ask the character to move, for example when it needs the character to move closer to selected target or to perform a skill. More... | |
virtual void | Stop () |
Ask character to stop moving and/ or turning More... | |
virtual void | StopAll () |
Ask character to stop. Removing queued targets and stop moving. More... | |
![]() | |
virtual bool | MustFaceToInteract () |
Override to to specify when facing the object is not needed to interact with it. Default is True. More... | |
Public Attributes | |
bool | persistenceOn = false |
bool | persistSpeed = true |
float | moveSpeed = 5.0f |
How fast the character should be moving when moving (or max speed it can reach) | |
float | turnSpeed = 10.0f |
How fast the character can turn when turning (or max turn speed) | |
float | maxInteractDistance = 2f |
max distance this character can be from something to interact with it | |
ValidInteractTargets | validInteractTarget = (ValidInteractTargets.FriendlyActor | ValidInteractTargets.NeutralActor | ValidInteractTargets.RPGObject) |
ResultCallback | onJump |
Assign to this a delegate to respond to the character jumping. LegacyAnimControl for example hooks into this so it knows when to play the jump clip. | |
GeneralCallback | onDeath |
Assign to this a delegate to respond to the character dying. LegacyAnimControl for example hooks into this so it knows when to play the death clip. | |
![]() | |
GeneralCallback | onDestroy |
Assign to this a delegate to respond to this object being destroyed. | |
Protected Member Functions | |
void | Awake () |
void | Start () |
void | LateUpdate () |
![]() | |
void | OnDestroy () |
Properties | |
Targetable | selectedTarget [get, set] |
This character's currently selected Targetable object. For player controllers this would be what the player clicked on (characters, items and objects) last and for NPCs this would be what the AI selected (only other characters) More... | |
Targetable | queuedInteract [get, set] |
The object queued to be interacted with once character is in range and facing it. More... | |
bool | Interacting [get] |
True while the character is "interacting" with something. StopInteract() must be called to stop it. More... | |
Actor | actor [get, set] |
The Actor component of the character More... | |
Transform | _tr [get, set] |
The Transform component of the character More... | |
bool | hint_DoNotMove [get, set] |
If set then the character should not move. Normally set by actor when a skill being used do not allow movement. More... | |
bool | controlEnabled [get, set] |
Is control of the character enabled? Player characters should not accept input and an NPC's I should be off when this is false. More... | |
The base class for all plyGame related character controllers.
|
virtual |
Called when the target is cleared. You should call base.ClearTarget() if you override this.
|
virtual |
You will not need to override this in a base class as it already returns actor (as data object).
Reimplemented from plyGame.Targetable.
|
virtual |
Enable or Disable Input (or AI in case of NPCs). Call base.EnableControl() if you override this.
|
virtual |
Is the character touching the floor/ ground?
|
virtual |
Derived class must override this to tell plyGame if this controller (Character) is a player character controller or non-player character (NPC).
Reimplemented in plyGame.PlayerBaseController.
|
virtual |
The calculated move vector. Needed by animation controllers that controls root motion, like the basic mecanim controller.
|
virtual |
Return true if the character may accept input to generate movement
Reimplemented in plyGame.PlayerBaseController.
|
virtual |
Return the current move speed being used. This defaults to returning moveSpeed but some controllers might override this if they have other movement speed types, for example running during a chase.
|
virtual |
Called when the character is killed. Call base.Death() if you override this.
|
virtual |
Turn the character to face in direction. Return false if this character controller do not accept requests to turn. Actor uses this to ask the character to look in direction it needs to perform a skill. The delayAfter determine how long the character will face the target direction, after reaching it and before returning to viewing in direction it is moving (if moving).
|
virtual |
Turn the character to face the target location (position). Return false if this character controller do not accept requests to turn. Actor uses this to ask the character to look in a direction to perform skill. The delayAfter determine how long the character will face the target direction, after reaching it and before returning to viewing in direction is is moving (if moving).
|
virtual |
Move the character to position. Return false if this character controller do not accept requests to move. Actor uses this to ask the character to move, for example when it needs the character to move closer to selected target or to perform a skill.
position | The position to move to |
useFasterMovement | A hint that a run speed should be used if the character supports it |
void plyGame.CharacterControllerBase.SelectTarget | ( | GameObject | go | ) |
Called when a target is selected. et the selected target. If null or passed object is not a Targetable, then the selected target will be cleared. You should call base.SelectTarget() if you override this.
|
virtual |
Called when a target is selected. If null then the selected target will be cleared. You should call base.SelectTarget() if you override this.
|
virtual |
Set the movement speed of the character
|
virtual |
The gameObject as target interact. The character will try to move to it and face it before the Interact related events are triggered.
|
virtual |
The character will try to move to it and face it before the Interact related events are triggered.
|
virtual |
Set the turn speed of the character
|
virtual |
Ask character to stop moving and/ or turning
|
virtual |
Ask character to stop. Removing queued targets and stop moving.
|
virtual |
Trigger event on currently active interact
|
virtual |
You will not need to override this in a base class as it already returns Type.Character.
Reimplemented from plyGame.Targetable.
|
virtual |
Return the current turn speed being used. This defaults to returning turnSpeed but some controllers might override this if they have other movement speed types, for example running during a chase.
|
virtual |
Character's current velocity
|
getset |
The Transform component of the character
|
getset |
Is control of the character enabled? Player characters should not accept input and an NPC's I should be off when this is false.
|
getset |
If set then the character should not move. Normally set by actor when a skill being used do not allow movement.
|
get |
True while the character is "interacting" with something. StopInteract() must be called to stop it.
|
getset |
The object queued to be interacted with once character is in range and facing it.
|
getset |
This character's currently selected Targetable object. For player controllers this would be what the player clicked on (characters, items and objects) last and for NPCs this would be what the AI selected (only other characters)