Battle Talent  V11
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Events | List of all members
CrossLink.CharacterControllerBase Class Reference

Inherits MonoBehaviour.

Inherited by CrossLink.CharacterController, CrossLink.DummyCharacter, and CrossLink.InteractCharacter.

Public Member Functions

void Reset ()
 
void SetCapsuleIgnore (Collider target, bool ignore)
 
void SetCapsuleAct (bool e)
 
void IgnorePlayerCollision (bool ig)
 
Vector3 GetCentrePos ()
 
void SetBodyHeight (float height)
 
float GetBodyHeight ()
 
float GetDefaultBodyWidth ()
 
void SetSecondaryColExtend (bool e)
 
void SetMoveSpeedState (float ms)
 
float GetMoveSpeedState ()
 
void SetMoveSpeed (float ms)
 
float GetMoveSpeed ()
 
void SetRotateSpeed (float rs)
 
float GetRotateSpeed ()
 
void ScaleMass (bool s)
 
bool IsMassScale ()
 
bool IsStandStill ()
 
void StandStill (bool s)
 
Vector3 GetTargetDir ()
 
Vector3 GetTargetVec ()
 
bool IsMoving ()
 
bool IsMoveComandDisabled ()
 
void SetDisableMoveCommand (bool s)
 
void ToggleKinematic (bool t)
 
bool IsGhostMove ()
 
void ToggleGhostMove (bool g)
 
void SetDisableMoveForAWhile (bool dm, float sec)
 
void PanMove (Vector3 moveDir)
 
void PanPush (Vector3 offset)
 
void PhysicsTrack (Vector3 pos)
 
void PanPushForAWhile (Vector3 dir, float sec)
 
float GetRotateDelta ()
 
void Rotate (float rotDelta)
 
virtual void RotateWithVRSpace (float rotDelta)
 this is used for rotate the whole body with vr space if this obj do not have vr controller attached to, then it's the same as Rotate More...
 
void RotateTo (Vector3 dir, float rotateSpeed, float dt)
 
void RotateTo (Vector3 target)
 
bool IsRootMotion ()
 
void SetRootMotion (bool rm)
 
bool MovePosition (Vector3 dest, bool forceAssist=false)
 
bool IsMovementEnable ()
 
void SetMovementEnable (bool e)
 
void SetMovementForAWhile (bool e, float sec=1)
 
virtual void ResetMovement ()
 
void LerpYSpeed ()
 
void ResetMoveComand (float dt)
 
void UpdatePos (float dt)
 
void UpdateStandStill (float dt)
 
float GetOriginalDragPower ()
 
void InitDrag ()
 
void SetDragPower (float p)
 
void SetDragForAWhile (float drag=0, float sec=0.2f)
 
void SetEnabledJumpCount (int jc)
 
virtual bool CheckReadyToJump ()
 
int JumpCountLeft ()
 
void CountAsJump (int jc=1)
 
virtual void Jump (Vector3 dir)
 
virtual void JumpEnd ()
 
bool IsStartJump ()
 
bool IsJumping ()
 is just start to jump or not in the ground More...
 
bool GetPushbackEnabled ()
 
void SetPushbackEnabled (bool e)
 
bool IsPushbacking ()
 
void ResetPushTime ()
 
void AddPushback (Vector3 srcPos, bool force=false)
 
void AddPushback (Vector3 srcPos, float hitbackDis, bool force=false)
 used for hitback from attack force More...
 
void AddPushbackByForce (Vector3 forceDir, bool force=false)
 used for drag and grab More...
 
void AddPushbackByDir (Vector3 pushDir, bool force=false)
 
void AddForce (Vector3 force, ForceMode fm=ForceMode.VelocityChange)
 
void ClearPushback ()
 
Rigidbody GetGroundRB ()
 
bool IsJustGround (float sec=0.5f)
 
float GetGroundedTime ()
 
void RawSetIsGround (bool i)
 
bool IsLatestHitGround ()
 
Vector3 GetGroundPos ()
 
string GetGroundCollisionMaterial ()
 
void PlayFootstepSound (string footMat, float force)
 
void PlayJumpStartSound (string footMat, float force)
 
void PlayJumpEndSound (string footMat, float force)
 
void SetLatestHitGround (bool hit)
 
virtual bool IsGround ()
 
bool IsMidAir (float diff=0.5f, Transform checkTrans=null)
 
void CheckGround (Transform checkTrans=null)
 
bool CheckGroundFall ()
 
Transform CheckCharacter ()
 
bool ClampGroundEnabled ()
 
void EnableClampGround (bool c)
 
void PrepareClampGround ()
 
void DoClampGround ()
 
bool IsGhostMode ()
 
void BecomeAFollowShell (bool b)
 

Static Public Member Functions

static CharacterControllerBase GetControllerByCol (Collider c)
 

Public Attributes

Transform trans
 
Rigidbody capsuleRB
 
CapsuleCollider capsuleCollider
 
BoxCollider secondaryCollider
 
Collider thirdCollider
 
Collider fourthCollider
 
Collider[] otherCols
 
VelocityCalculator velEstor = new VelocityCalculator()
 
float dragPower = 0.8f
 
float moveSpeed = StandardMoveSpeed
 
float rotateSpeed = 800
 
float pullUpMaxDis = 0.3f
 
bool enableAssist = true
 
System.Func< Vector3, bool > UpdatePosFunc = null
 
float jumpForce = 8f
 
LayerMask groundLayer
 

Static Public Attributes

const float StandardMoveSpeed = 2.5f
 
static bool IgnoreMovePositionRigidbody = false
 

Protected Member Functions

void Awake ()
 
void OnDestroy ()
 
void OnEnable ()
 
void OnDisable ()
 
virtual float GetMoveSpeed (Vector3 dir)
 
virtual void OnJump ()
 
void PhysicsJump (Vector3 dir, float force)
 
void SetPushback (Vector3 vec, bool p=false)
 
void UpdatePushback (float dt)
 

Protected Attributes

float moveSpeedState = 1
 
float originalMass
 
Vector3 targetDir
 
bool moveCommand = false
 
bool disableMoveCommand = false
 
bool isGhostMove = false
 
Vector3 movementDir
 
float rotateDelta
 
bool rotateCommand = false
 
bool isRootMotion = false
 
float pullUpMinDis = 0.1f
 
bool checkPullRadius = true
 
bool enableMovement = true
 
int moveActId = -1
 
float jumpTime
 
int enabledJumpCount = 1
 
bool enablePushback = true
 
float impluseTime
 
Vector3 impluseVec
 
RaycastHit groundHitInfo
 
bool isLatestHitGround = true
 
bool prevGround = true
 
bool clampGround = false
 
Transform clampObj
 
Vector3 lastGroundPosition
 
Vector3 lastGroundForward
 
Vector3 lastLocalPosition
 
Vector3 lastForwardLocalPosition
 
Vector3 lastWorldPosition
 
bool ghostMode = false
 

Static Protected Attributes

const float PushbackTime = 0.14f
 

Events

System.Action JumpEvent
 
System.Action< CharacterControllerBase, bool > GroundEvent
 

Member Function Documentation

◆ AddPushback()

void CrossLink.CharacterControllerBase.AddPushback ( Vector3  srcPos,
float  hitbackDis,
bool  force = false 
)

used for hitback from attack force

Parameters
srcPos
hitbackDis
force

◆ AddPushbackByForce()

void CrossLink.CharacterControllerBase.AddPushbackByForce ( Vector3  forceDir,
bool  force = false 
)

used for drag and grab

Parameters
forceDir
force

◆ IsJumping()

bool CrossLink.CharacterControllerBase.IsJumping ( )

is just start to jump or not in the ground

Returns

◆ RotateWithVRSpace()

virtual void CrossLink.CharacterControllerBase.RotateWithVRSpace ( float  rotDelta)
virtual

this is used for rotate the whole body with vr space if this obj do not have vr controller attached to, then it's the same as Rotate

Parameters
rotDelta

Reimplemented in CrossLink.InteractCharacter.