All Classes Namespaces Functions Variables Enumerations Enumerator Properties
plyGame.PlayerBaseController Class Reference

Player character controller base class. You can choose to either derive from this or CharacterControllerbase. This class contain some useful helpers that you would have to re- implement if deriving a player controller from CharacterControllerbase. More...

Inherits plyGame.CharacterControllerBase.

Inherited by plyGame.PlayerThirdPersonController, plyGame.PlayerTopDownController, and plyGame.PlayerTopDownNavController.

Public Member Functions

override bool MovementControlAllowed ()
 Return true if the character may accept input to generate movement. More...
 
override bool IsPlayer ()
 Override to tell plyGame this is a player character controller More...
 
override void SelectTarget (Targetable t)
 
override void ClearTarget ()
 
- Public Member Functions inherited from plyGame.CharacterControllerBase
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 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 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...
 
- Public Member Functions inherited from plyGame.Targetable
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 canMouseSelect = true
 can the player make selections with the mouse
 
bool canMouseSelActor = true
 can the player select characters/ actors with the mouse
 
bool canMouseSelItem = true
 can the player select items with the mouse
 
bool canMouseSelObject = true
 can the player select objects with the mouse
 
float mouseSelDistance = 100f
 how far from the character mouse selection be performed
 
int mouseSelAngle = 360
 at what angle from character's forward can selection be done? (0 to 360) ( <=0 || >=360 will assume 360 )
 
bool clearSelectedOnFloorClick = true
 Clear selected when click on floor.
 
bool canButtonSelect = true
 can the player make selection with buttons (like TAB)
 
bool canButtonSelActor = true
 can the player select/ target characters (actors) with a button
 
bool canButtonSelItem = true
 can the player select an item with a button
 
bool canButtonSelObject = true
 can the player select an object with a button
 
float buttonSelDistance = 10f
 how far from the character can button selection be performed
 
int buttonSelAngle = 60
 at what angle from character's forward can selection be done? (0 to 360) (<=0 || >= 360 will assume 360)
 
bool autoMoveToInteract = true
 should character move closer to target selected to interact with?
 
bool movementCanStopInteraction = true
 Can movement call the Interact Stop events?
 
bool itemSelectInteract = true
 is item selection the same as interaction?
 
int actionSlotCount = 10
 how many action slots there are
 
- Public Attributes inherited from plyGame.CharacterControllerBase
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.
 
- Public Attributes inherited from plyGame.Targetable
GeneralCallback onDestroy
 Assign to this a delegate to respond to this object being destroyed.
 

Protected Member Functions

void Reset ()
 
new void Awake ()
 
new void Start ()
 
new void OnDestroy ()
 
void Update ()
 
void OnDrawGizmosSelected ()
 
- Protected Member Functions inherited from plyGame.CharacterControllerBase
void Awake ()
 
void Start ()
 
void LateUpdate ()
 
- Protected Member Functions inherited from plyGame.Targetable
void OnDestroy ()
 

Protected Attributes

LayerMask floorClickMask
 used when detecting a floor click (it is set up such to ignore certain layers while not allowing click-through others so must still check if was actually Floor layer that was clicked)
 
LayerMask selectClickMask
 used when detecting click on targetable
 
LayerMask selectButtonMask
 used when finding targetable(s) around character
 
FollowTargetObject selNPCFriendly = null
 
FollowTargetObject selNPCNeutral = null
 
FollowTargetObject selNPCHostile = null
 
FollowTargetObject selObject = null
 
FollowTargetObject selItem = null
 
FollowTargetObject activeSelector = null
 
int Key_ClickSelectTarget = -1
 
int Key_SelectNextTarget = -1
 
int Key_TargetClear = -1
 
int Key_ClickInteract = -1
 
int Key_Interact = -1
 

Properties

ActionSlots actionSlots [get, set]
 
- Properties inherited from plyGame.CharacterControllerBase
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...
 

Additional Inherited Members

- Public Types inherited from plyGame.CharacterControllerBase
enum  ValidInteractTargets { FriendlyActor = (1 << 0), NeutralActor = (1 << 1), HostileActor = (1 << 2), RPGObject = (1 << 3) }
 
- Public Types inherited from plyGame.Targetable
enum  Type { Type.Character = 1, Type.Object = 2, Type.Item = 4, Type.Unknown = 1024 }
 The targetable types More...
 

Detailed Description

Player character controller base class. You can choose to either derive from this or CharacterControllerbase. This class contain some useful helpers that you would have to re- implement if deriving a player controller from CharacterControllerbase.

Member Function Documentation

override bool plyGame.PlayerBaseController.IsPlayer ( )
virtual

Override to tell plyGame this is a player character controller

Reimplemented from plyGame.CharacterControllerBase.

override bool plyGame.PlayerBaseController.MovementControlAllowed ( )
virtual

Return true if the character may accept input to generate movement.

Reimplemented from plyGame.CharacterControllerBase.