KS.Reactor.ksPlayerController Class Referenceabstract

Base class for player controllers. More...

Inheritance diagram for KS.Reactor.ksPlayerController:
KS.Reactor.ksScriptAsset

Public Member Functions

abstract void RegisterInputs (ksInputRegistrar registrar)
 Register all buttons and axes you will be using here. More...
 
virtual void Initialize ()
 Called after properties are initialized. More...
 
abstract void Update ()
 Called every frame. More...
 
virtual new ksPlayerController Clone ()
 Creates a copy of the controller with the value of all members tagged with ksEditable or ksCloneable copied. More...
 

Properties

ksInput Input [get, set]
 Player input. More...
 
ksTransform Transform [get, set]
 Entity transform. More...
 
ksTransform2D Transform2D [get, set]
 2D entity transform. More...
 
ksIRigidBody RigidBody [get, set]
 Entity rigid body. More...
 
ksIRigidBody2D RigidBody2D [get, set]
 2D entity rigid body. More...
 
ksICharacterController CharacterController [get, set]
 Character controller. More...
 
ksIEntity Entity [get, set]
 Entity this player controller is controlling. More...
 
ksTime Time [get, set]
 Time. More...
 
ksPropertyMap Properties [get]
 Entity properties. More...
 
ksBasePhysics Physics [get, set]
 Physics API. More...
 
bool UseInputPrediction [get, set]
 Should this controller use input prediction? Set this to false in Initialize or in the inspector to disable input prediction. More...
 
abstract uint Type [get]
 Player controller type. This must be unique-per class and non-zero. More...
 
- Properties inherited from KS.Reactor.ksScriptAsset
static ksBaseAssetLoader Assets [get, set]
 Asset loader singleton. Set this to supply a custom asset loader. More...
 
uint AssetId [get, set]
 The id of the asset. Zero means it is not an asset. More...
 
string AssetPath [get, set]
 The asset path. More...
 
bool IsPrefab [get, set]
 Is this a prefab asset? If true, this is the asset returned by ksBaseAssetLoader.Get<T>(uint, bool). More...
 
string? AssetName [get]
 The name of the asset. More...
 

Detailed Description

Base class for player controllers.

Player controllers allow you to write one class that runs on both the client and the server for controlling entity movement using player inputs. The server uses it for authoritative movement, and the client uses it for prediction/latency masking.

Member Function Documentation

◆ Clone()

virtual new ksPlayerController KS.Reactor.ksPlayerController.Clone ( )
virtual

Creates a copy of the controller with the value of all members tagged with ksEditable or ksCloneable copied.

Arrays, lists, and dictionaries are cloned. Other object references will reference the same object.

Reimplemented from KS.Reactor.ksScriptAsset.

◆ Initialize()

virtual void KS.Reactor.ksPlayerController.Initialize ( )
virtual

Called after properties are initialized.

◆ RegisterInputs()

abstract void KS.Reactor.ksPlayerController.RegisterInputs ( ksInputRegistrar  registrar)
pure virtual

Register all buttons and axes you will be using here.

Parameters
registrarRegistrar to register with.

◆ Update()

abstract void KS.Reactor.ksPlayerController.Update ( )
pure virtual

Called every frame.

Property Documentation

◆ CharacterController

ksICharacterController KS.Reactor.ksPlayerController.CharacterController
getset

Character controller.

◆ Entity

ksIEntity KS.Reactor.ksPlayerController.Entity
getset

Entity this player controller is controlling.

◆ Input

ksInput KS.Reactor.ksPlayerController.Input
getset

Player input.

◆ Physics

ksBasePhysics KS.Reactor.ksPlayerController.Physics
getset

Physics API.

◆ Properties

ksPropertyMap KS.Reactor.ksPlayerController.Properties
get

Entity properties.

◆ RigidBody

ksIRigidBody KS.Reactor.ksPlayerController.RigidBody
getset

Entity rigid body.

◆ RigidBody2D

ksIRigidBody2D KS.Reactor.ksPlayerController.RigidBody2D
getset

2D entity rigid body.

◆ Time

ksTime KS.Reactor.ksPlayerController.Time
getset

Time.

◆ Transform

ksTransform KS.Reactor.ksPlayerController.Transform
getset

Entity transform.

◆ Transform2D

ksTransform2D KS.Reactor.ksPlayerController.Transform2D
getset

2D entity transform.

◆ Type

abstract uint KS.Reactor.ksPlayerController.Type
get

Player controller type. This must be unique-per class and non-zero.

◆ UseInputPrediction

bool KS.Reactor.ksPlayerController.UseInputPrediction
getset

Should this controller use input prediction? Set this to false in Initialize or in the inspector to disable input prediction.

Setting this after Initialize is called will do nothing.