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

Manages network-synced spawning of prefabs, in this case collectibles and powerups. With the respawn time synced on all clients it supports host migration too. More...

Inheritance diagram for ObjectSpawner:

Public Member Functions

override void OnPlayerEnteredRoom (Photon.Realtime.Player player)
 Synchronizes current active state of the object to joining players. More...
 
override void OnMasterClientSwitched (Photon.Realtime.Player newMaster)
 Called after switching to a new MasterClient when the current one leaves. Here the new master has to decide whether to enable the object in the scene. More...
 
void Instantiate ()
 Instantiates the object in the scene using PoolManager functionality. More...
 
void Pickup (short viewId)
 Collects the object and assigns it to the player with the corresponding view. More...
 
void Drop (Vector3 position)
 Unparents the object from any carrier and drops it at the targeted position. More...
 
void Return ()
 Returns the object back to this spawner's position. E.g. in Capture The Flag mode this can occur if a team collects its own flag, or a flag timed out after being dropped. More...
 
void Destroy ()
 Called by the spawned object to destroy itself on this managing component. This could be the case when it has been collected by players. More...
 
void SetRespawn (float init=0f)
 Called by the spawned object to reset its respawn counter when it is despawned in the scene. Also called on all clients with the current counter on host migration. More...
 

Public Attributes

GameObject prefab
 Prefab to sync the instantiation for over the network. More...
 
bool respawn
 Checkbox whether the object should be respawned after being despawned. More...
 
int respawnTime
 Delay until respawning the object again after it got despawned. More...
 
GameObject obj
 Reference to the spawned prefab gameobject instance in the scene. More...
 
CollectionType colType = CollectionType.Use
 Type of Collectible this spawner should utilize. This is set automatically, thus hidden in the inspector. Fires network messages depending on type. More...
 

Detailed Description

Manages network-synced spawning of prefabs, in this case collectibles and powerups. With the respawn time synced on all clients it supports host migration too.

Member Function Documentation

void Destroy ( )

Called by the spawned object to destroy itself on this managing component. This could be the case when it has been collected by players.

void Drop ( Vector3  position)

Unparents the object from any carrier and drops it at the targeted position.

void Instantiate ( )

Instantiates the object in the scene using PoolManager functionality.

override void OnMasterClientSwitched ( Photon.Realtime.Player  newMaster)

Called after switching to a new MasterClient when the current one leaves. Here the new master has to decide whether to enable the object in the scene.

override void OnPlayerEnteredRoom ( Photon.Realtime.Player  player)

Synchronizes current active state of the object to joining players.

void Pickup ( short  viewId)

Collects the object and assigns it to the player with the corresponding view.

void Return ( )

Returns the object back to this spawner's position. E.g. in Capture The Flag mode this can occur if a team collects its own flag, or a flag timed out after being dropped.

void SetRespawn ( float  init = 0f)

Called by the spawned object to reset its respawn counter when it is despawned in the scene. Also called on all clients with the current counter on host migration.

Member Data Documentation

Type of Collectible this spawner should utilize. This is set automatically, thus hidden in the inspector. Fires network messages depending on type.

GameObject obj

Reference to the spawned prefab gameobject instance in the scene.

GameObject prefab

Prefab to sync the instantiation for over the network.

bool respawn

Checkbox whether the object should be respawned after being despawned.

int respawnTime

Delay until respawning the object again after it got despawned.


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