BomberUnits
...a Unity learning project
PlayerController Class Reference

Is responsible for everything related to the player figure. More...

+ Inheritance diagram for PlayerController:
+ Collaboration diagram for PlayerController:

Public Member Functions

Transform RegisterBomb (Bomb b)
 Offered here, as bomb registering also takes place on remotes for bombs placed by other clients. More...
 
void SetAssociatedPlayer (Player p)
 
void SetControlActive (bool value)
 
void Kill ()
 
void GivePassivePowerUp (PowerUpEffect powerUp, float duration)
 
void ChangeMaxBombs (int value)
 
void ChangeBombRange (int value)
 
void OnPhotonSerializeView (PhotonStream stream, PhotonMessageInfo info)
 Synchronization of custom values via Photon. More...
 

Public Attributes

CharSettings charSettings
 

Private Member Functions

void Awake ()
 
void Start ()
 
void Update ()
 Calls the different handlers which need to run during update cycles.
 
bool TryToReadPlayerFromInitData ()
 This is called whenever we got serialized init data by Network Instantiation. More...
 
void SetSyncedAnimationParams ()
 The animation params are calculated by the owning client only and synced via PhotonView. More...
 
void HandleDeath ()
 Checks the current hit points and initiates the player death event and ends local control over this. More...
 

Private Attributes

BombHandler bombHandler = default
 
bool controlActive
 
Player player = null
 
InputHandler inputHandler
 
MoveHandler moveHandler
 
CharCustomizer charCustomizer
 
InputState inputState = new InputState()
 
MovementState moveState
 
Animator anim
 

Detailed Description

Is responsible for everything related to the player figure.

The following topics are delegated to handling classes:

Definition at line 20 of file PlayerController.cs.

Member Function Documentation

◆ HandleDeath()

void HandleDeath ( )
inlineprivate

Checks the current hit points and initiates the player death event and ends local control over this.

This is to be called only for the owning client. TODO: Which other tasks could be interrupted by death? Like bomb staging and button presses?

Definition at line 192 of file PlayerController.cs.

◆ OnPhotonSerializeView()

void OnPhotonSerializeView ( PhotonStream  stream,
PhotonMessageInfo  info 
)
inline

Synchronization of custom values via Photon.

Each value has to be serializable and is written and read to/from the stream in sequence. The data is transferred unreliable and should thus not be used to trigger any game mechanics, only visuals!

Definition at line 151 of file PlayerController.cs.

◆ RegisterBomb()

Transform RegisterBomb ( Bomb  b)
inline

Offered here, as bomb registering also takes place on remotes for bombs placed by other clients.

Called by the placed bomb itself on every client after its instantiation. Returns the needed transform where the bomb is intially held by the player.

Definition at line 104 of file PlayerController.cs.

◆ SetSyncedAnimationParams()

void SetSyncedAnimationParams ( )
inlineprivate

The animation params are calculated by the owning client only and synced via PhotonView.

Applying them thus is called independent of whether this is local or remote.

Definition at line 183 of file PlayerController.cs.

◆ TryToReadPlayerFromInitData()

bool TryToReadPlayerFromInitData ( )
inlineprivate

This is called whenever we got serialized init data by Network Instantiation.

This is usually the case. Expects: [0]: (string) clientID, [1]: (int) playerUID Returns success.

Definition at line 168 of file PlayerController.cs.

Member Data Documentation

◆ player

Player player = null
private
Todo:
: replace by enable/disable? is sync still called in this case?

Definition at line 28 of file PlayerController.cs.


The documentation for this class was generated from the following file: