Tanks Multiplayer  1.5
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
Player

Networked player class implementing movement control and shooting. Contains both server and client logic in an authoritative approach. More...

Inheritance diagram for Player:
PlayerBot

Public Member Functions

override void OnPlayerPropertiesUpdate (Photon.Realtime.Player player, ExitGames.Client.Photon.Hashtable playerAndUpdatedProps)
 This method gets called whenever player properties have been changed on the network. More...
 
PhotonView GetView ()
 Helper method for getting the current object owner. More...
 
void TakeDamage (Bullet bullet)
 Server only: calculate damage to be taken by the Player, triggers score increase and respawn workflow on death. More...
 
void CmdRespawn ()
 Command telling the server and all others that this client is ready for respawn. This is when the respawn delay is over or a video ad has been watched. More...
 
void ResetPosition ()
 Repositions in team area and resets camera & input variables. This should only be called for the local player. More...
 

Public Attributes

Text label
 UI Text displaying the player name. More...
 
int maxHealth = 10
 Maximum health value at game start. More...
 
short turretRotation
 Current turret rotation and shooting direction. More...
 
float fireRate = 0.75f
 Delay between shots. More...
 
float moveSpeed = 8f
 Movement speed in all directions. More...
 
Slider healthSlider
 UI Slider visualizing health value. More...
 
Slider shieldSlider
 UI Slider visualizing shield value. More...
 
AudioClip shotClip
 Clip to play when a shot has been fired. More...
 
AudioClip explosionClip
 Clip to play on player death. More...
 
GameObject shotFX
 Object to spawn on shooting. More...
 
GameObject explosionFX
 Object to spawn on player death. More...
 
Transform turret
 Turret to rotate with look direction. More...
 
Transform shotPos
 Position to spawn new bullets at. More...
 
GameObject[] bullets
 Array of available bullets for shooting. More...
 
MeshRenderer[] renderers
 MeshRenderers that should be highlighted in team color. More...
 
GameObject killedBy
 Last player gameobject that killed this one. More...
 
FollowTarget camFollow
 Reference to the camera following component. More...
 

Protected Member Functions

void Shoot (Vector2 direction=default(Vector2))
 
void CmdShoot (short[] position, short angle)
 
void RpcOnShot ()
 
void OnHealthChange (int value)
 
void OnShieldChange (int value)
 
virtual void RpcRespawn (short senderId)
 
void RpcGameOver (byte teamIndex)
 

Detailed Description

Networked player class implementing movement control and shooting. Contains both server and client logic in an authoritative approach.

Member Function Documentation

void CmdRespawn ( )

Command telling the server and all others that this client is ready for respawn. This is when the respawn delay is over or a video ad has been watched.

void CmdShoot ( short[]  position,
short  angle 
)
protected
PhotonView GetView ( )

Helper method for getting the current object owner.

void OnHealthChange ( int  value)
protected
override void OnPlayerPropertiesUpdate ( Photon.Realtime.Player  player,
ExitGames.Client.Photon.Hashtable  playerAndUpdatedProps 
)

This method gets called whenever player properties have been changed on the network.

void OnShieldChange ( int  value)
protected
void ResetPosition ( )

Repositions in team area and resets camera & input variables. This should only be called for the local player.

void RpcGameOver ( byte  teamIndex)
protected
void RpcOnShot ( )
protected
virtual void RpcRespawn ( short  senderId)
protectedvirtual

Reimplemented in PlayerBot.

void Shoot ( Vector2  direction = default(Vector2))
protected
void TakeDamage ( Bullet  bullet)

Server only: calculate damage to be taken by the Player, triggers score increase and respawn workflow on death.

Member Data Documentation

GameObject [] bullets

Array of available bullets for shooting.

FollowTarget camFollow

Reference to the camera following component.

AudioClip explosionClip

Clip to play on player death.

GameObject explosionFX

Object to spawn on player death.

float fireRate = 0.75f

Delay between shots.

Slider healthSlider

UI Slider visualizing health value.

GameObject killedBy

Last player gameobject that killed this one.

Text label

UI Text displaying the player name.

int maxHealth = 10

Maximum health value at game start.

float moveSpeed = 8f

Movement speed in all directions.

MeshRenderer [] renderers

MeshRenderers that should be highlighted in team color.

Slider shieldSlider

UI Slider visualizing shield value.

AudioClip shotClip

Clip to play when a shot has been fired.

GameObject shotFX

Object to spawn on shooting.

Transform shotPos

Position to spawn new bullets at.

Transform turret

Turret to rotate with look direction.

short turretRotation

Current turret rotation and shooting direction.


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