C# Class GameDirector, PaperCowboys

Inheritance: MonoBehaviour
Mostrar archivo Open project: Gamieon/PaperCowboys Class Usage Examples

Public Properties

Property Type Description
IsGameOver bool
IsOnline bool
PlayerCharacterPrefab string
crosshairTexture Texture2D
endingPoint Transform
levelSong AudioClip
maxCameraYPoint Transform
menuButtonStyle GUIStyle
menuOptionsStyle GUIStyle
respawnGUIStyle GUIStyle
skullCrossbonesTexture Texture2D
solidWhiteTexture Texture2D
startingPoint Transform
titleStyle GUIStyle
weaponAmmoGUIStyle GUIStyle
weaponBoxIconTextures Texture2D[]
weaponBoxTexture Texture2D
weaponHotkeyGUIStyle GUIStyle

Private Properties

Property Type Description
IInputPoller bool
RPCBossDefeated void
RPCChatMessage void
RPCGameOver void
RPCGiveDrop void
RPCRespawnDeadPlayer void
RPCRespawnDeadPlayer void
RPCRespawnDeadPlayer void
RPCSetScore void
RPCSpawnYourself void

Public Methods

Method Description
AdvanceCurrentLevel ( ) : void

Called on the master client to advance the current level

Awake ( ) : void
ClearOldestChatMessage ( ) : void

Called in response to a RPCChatMessage message to clear the oldest chat message from the list ten seconds after a new message was added.

HideGameMenu ( ) : void

Called by this component to hide the game menu.

IInputPoller ( ) : void

Called when polling has finished

IInputPoller ( Rect screenArea ) : void

Called to render the GUI

OnConnectedToPhoton ( ) : void
OnDisconnectedFromPhoton ( ) : void
OnDisconnectedFromServer ( NetworkDisconnection info ) : void

Called on the client when the connection was lost or you disconnected from the server.

OnFailedToConnectToPhoton ( ) : void
OnGUI ( ) : void
OnLeftRoom ( ) : void
OnMasterClientSwitched ( PhotonPlayer player ) : void
OnPhotonInstantiate ( PhotonMessageInfo info ) : void
OnPhotonPlayerConnected ( PhotonPlayer player ) : void
OnPhotonPlayerDisconnected ( PhotonPlayer player ) : void
OnPlayerConnected ( NetworkPlayer player ) : void

Called on the server whenever a new player has successfully connected.

OnPlayerDisconnected ( NetworkPlayer player ) : void

Called on the server whenever a player is disconnected from the server.

OnReceivedRoomList ( ) : void
OnReceivedRoomListUpdate ( ) : void
OnSelfCharacterDestroyed ( ) : void

Called from a PlayerCharacter call to DestroyThisCharacter when our player character is destroyed. Here we clear all the player drops, reset the munitions and start the respawn timer. This is only called for the player who actually died.

PollGameOverStatus ( ) : void

Called by the master client to poll the game over status.

PollInputs ( ) : void

This is called by Update() every frame to poll user inputs. Its primary purpose is to coordinate user inputs so multiple input sinks don't try to act on the player (for example: If you had a scene with five components listening for MouseDown events, they could all act on them in ways that conflict with each other. We just want one component (this one) listening for MouseDown events and dispatching them to the proper component.

RenderChatBox ( ) : void

Renders the chat box (but not historic chat messages) and handles chat box typing

RenderChatMessages ( ) : void

Renders the chat message history (no message will be older than ten seconds though)

RenderGameMenu ( ) : void

Renders the game menu.

RenderGameOptions ( ) : void

Renders the game options menu

RenderGameOver ( ) : void

Renders the game over screen

RenderPlayerCrosshair ( ) : void

Renders the player crosshair.

RenderRespawnTimer ( ) : void

Renders the respawning timer.

RenderScores ( ) : void

Renders the player names, scores, and whether they're alive

RenderWeaponBox ( WeaponDirector playerWeapon ) : void

Renders a single weapon box at the top of the screen

RenderWeapons ( ) : void

Renders the weapon boxes at the top of the screen

RespawnDeadPlayer ( NetworkPlayer player ) : void

Called from RPCRespawnDeadPlayer to tell a player that they need to spawn themselves. This is only called on the master client.

RespawnDeadPlayer ( PhotonPlayer player ) : void

Called from RPCRespawnDeadPlayer to tell a player that they need to spawn themselves. This is only called on the master client.

RespawnDeadPlayer ( uLink player ) : void

Called from RPCRespawnDeadPlayer to tell a player that they need to spawn themselves. This is only called on the master client.

SetSelfCharacter ( PlayerCharacter playerCharacter ) : void

Called by a class inherited from PlayerCharacter when our character is instantiated

ShowChatBar ( ) : void

Called by the local user from the PlayerCharacter component which handles input polling to display the chat bar to begin typing in a message to all players.

ShowGameMenu ( ) : void

Called by the local user from the PlayerCharacter component which handles input polling to display the game menu.

SpawnSelfCharacter ( Vector3 position ) : void

Called by RPCSpawnYourself for you to spawn your player character. This can be called on any client.

Start ( ) : void
Update ( ) : void
WarpToScene ( string sceneName ) : void

Called on the master client to warps to a scene.

uLink_OnDisconnectedFromServer ( uLink info ) : void

Called on the client when the connection was lost or you disconnected from the server.

uLink_OnPlayerConnected ( uLink player ) : void

Called on the server whenever a new player has successfully connected.

uLink_OnPlayerDisconnected ( uLink player ) : void

Called on the server whenever a player is disconnected from the server.

uLink_OnServerUninitialized ( ) : void

Called on the server whenever a Disconnect was invoked and has completed.

Private Methods

Method Description
IInputPoller ( ) : bool

Called to begin polling this input object

RPCBossDefeated ( ) : void
RPCChatMessage ( string message, float r, float g, float b ) : void
RPCGameOver ( ) : void
RPCGiveDrop ( Vector3 position ) : void
RPCRespawnDeadPlayer ( NetworkPlayer player ) : void
RPCRespawnDeadPlayer ( PhotonPlayer player ) : void
RPCRespawnDeadPlayer ( uLink player ) : void
RPCSetScore ( int newScore ) : void
RPCSpawnYourself ( float x, float y ) : void

Method Details

AdvanceCurrentLevel() public static method

Called on the master client to advance the current level
public static AdvanceCurrentLevel ( ) : void
return void

Awake() public method

public Awake ( ) : void
return void

ClearOldestChatMessage() public method

Called in response to a RPCChatMessage message to clear the oldest chat message from the list ten seconds after a new message was added.
public ClearOldestChatMessage ( ) : void
return void

HideGameMenu() public method

Called by this component to hide the game menu.
public HideGameMenu ( ) : void
return void

IInputPoller() public method

Called when polling has finished
public IInputPoller ( ) : void
return void

IInputPoller() public method

Called to render the GUI
public IInputPoller ( Rect screenArea ) : void
screenArea Rect /// The available screen area. You should call GUI.BeginGroup before rendering. ///
return void

OnConnectedToPhoton() public method

public OnConnectedToPhoton ( ) : void
return void

OnDisconnectedFromPhoton() public method

public OnDisconnectedFromPhoton ( ) : void
return void

OnDisconnectedFromServer() public method

Called on the client when the connection was lost or you disconnected from the server.
public OnDisconnectedFromServer ( NetworkDisconnection info ) : void
info NetworkDisconnection /// Info. ///
return void

OnFailedToConnectToPhoton() public method

public OnFailedToConnectToPhoton ( ) : void
return void

OnGUI() public method

public OnGUI ( ) : void
return void

OnLeftRoom() public method

public OnLeftRoom ( ) : void
return void

OnMasterClientSwitched() public method

public OnMasterClientSwitched ( PhotonPlayer player ) : void
player PhotonPlayer
return void

OnPhotonInstantiate() public method

public OnPhotonInstantiate ( PhotonMessageInfo info ) : void
info PhotonMessageInfo
return void

OnPhotonPlayerConnected() public method

public OnPhotonPlayerConnected ( PhotonPlayer player ) : void
player PhotonPlayer
return void

OnPhotonPlayerDisconnected() public method

public OnPhotonPlayerDisconnected ( PhotonPlayer player ) : void
player PhotonPlayer
return void

OnPlayerConnected() public method

Called on the server whenever a new player has successfully connected.
public OnPlayerConnected ( NetworkPlayer player ) : void
player NetworkPlayer /// Player. ///
return void

OnPlayerDisconnected() public method

Called on the server whenever a player is disconnected from the server.
public OnPlayerDisconnected ( NetworkPlayer player ) : void
player NetworkPlayer /// Player. ///
return void

OnReceivedRoomList() public method

public OnReceivedRoomList ( ) : void
return void

OnReceivedRoomListUpdate() public method

public OnReceivedRoomListUpdate ( ) : void
return void

OnSelfCharacterDestroyed() public method

Called from a PlayerCharacter call to DestroyThisCharacter when our player character is destroyed. Here we clear all the player drops, reset the munitions and start the respawn timer. This is only called for the player who actually died.
public OnSelfCharacterDestroyed ( ) : void
return void

PollGameOverStatus() public method

Called by the master client to poll the game over status.
public PollGameOverStatus ( ) : void
return void

PollInputs() public method

This is called by Update() every frame to poll user inputs. Its primary purpose is to coordinate user inputs so multiple input sinks don't try to act on the player (for example: If you had a scene with five components listening for MouseDown events, they could all act on them in ways that conflict with each other. We just want one component (this one) listening for MouseDown events and dispatching them to the proper component.
public PollInputs ( ) : void
return void

RenderChatBox() public method

Renders the chat box (but not historic chat messages) and handles chat box typing
public RenderChatBox ( ) : void
return void

RenderChatMessages() public method

Renders the chat message history (no message will be older than ten seconds though)
public RenderChatMessages ( ) : void
return void

RenderGameMenu() public method

Renders the game menu.
public RenderGameMenu ( ) : void
return void

RenderGameOptions() public method

Renders the game options menu
public RenderGameOptions ( ) : void
return void

RenderGameOver() public method

Renders the game over screen
public RenderGameOver ( ) : void
return void

RenderPlayerCrosshair() public method

Renders the player crosshair.
public RenderPlayerCrosshair ( ) : void
return void

RenderRespawnTimer() public method

Renders the respawning timer.
public RenderRespawnTimer ( ) : void
return void

RenderScores() public method

Renders the player names, scores, and whether they're alive
public RenderScores ( ) : void
return void

RenderWeaponBox() public method

Renders a single weapon box at the top of the screen
public RenderWeaponBox ( WeaponDirector playerWeapon ) : void
playerWeapon WeaponDirector /// Player weapon. ///
return void

RenderWeapons() public method

Renders the weapon boxes at the top of the screen
public RenderWeapons ( ) : void
return void

RespawnDeadPlayer() public method

Called from RPCRespawnDeadPlayer to tell a player that they need to spawn themselves. This is only called on the master client.
public RespawnDeadPlayer ( NetworkPlayer player ) : void
player NetworkPlayer /// The player to respawn. ///
return void

RespawnDeadPlayer() public method

Called from RPCRespawnDeadPlayer to tell a player that they need to spawn themselves. This is only called on the master client.
public RespawnDeadPlayer ( PhotonPlayer player ) : void
player PhotonPlayer /// The player to respawn. ///
return void

RespawnDeadPlayer() public method

Called from RPCRespawnDeadPlayer to tell a player that they need to spawn themselves. This is only called on the master client.
public RespawnDeadPlayer ( uLink player ) : void
player uLink /// The player to respawn. ///
return void

SetSelfCharacter() public method

Called by a class inherited from PlayerCharacter when our character is instantiated
public SetSelfCharacter ( PlayerCharacter playerCharacter ) : void
playerCharacter PlayerCharacter /// Player character. ///
return void

ShowChatBar() public method

Called by the local user from the PlayerCharacter component which handles input polling to display the chat bar to begin typing in a message to all players.
public ShowChatBar ( ) : void
return void

ShowGameMenu() public method

Called by the local user from the PlayerCharacter component which handles input polling to display the game menu.
public ShowGameMenu ( ) : void
return void

SpawnSelfCharacter() public method

Called by RPCSpawnYourself for you to spawn your player character. This can be called on any client.
public SpawnSelfCharacter ( Vector3 position ) : void
position Vector3 /// Position. ///
return void

Start() public method

public Start ( ) : void
return void

Update() public method

public Update ( ) : void
return void

WarpToScene() public static method

Called on the master client to warps to a scene.
public static WarpToScene ( string sceneName ) : void
sceneName string /// Scene name. ///
return void

uLink_OnDisconnectedFromServer() public method

Called on the client when the connection was lost or you disconnected from the server.
public uLink_OnDisconnectedFromServer ( uLink info ) : void
info uLink /// Info. ///
return void

uLink_OnPlayerConnected() public method

Called on the server whenever a new player has successfully connected.
public uLink_OnPlayerConnected ( uLink player ) : void
player uLink /// Player. ///
return void

uLink_OnPlayerDisconnected() public method

Called on the server whenever a player is disconnected from the server.
public uLink_OnPlayerDisconnected ( uLink player ) : void
player uLink /// Player. ///
return void

uLink_OnServerUninitialized() public method

Called on the server whenever a Disconnect was invoked and has completed.
public uLink_OnServerUninitialized ( ) : void
return void

Property Details

IsGameOver public_oe property

True if the game is over
public bool IsGameOver
return bool

IsOnline public_oe static_oe property

Sets a value indicating whether the game is going to be online. This must be set by the main menu, and it defaults to false meaning we're offline by default.
public static bool IsOnline
return bool

PlayerCharacterPrefab public_oe property

The player character prefab.
public string PlayerCharacterPrefab
return string

crosshairTexture public_oe property

The crosshair texture.
public Texture2D crosshairTexture
return Texture2D

endingPoint public_oe property

The ending point.
public Transform endingPoint
return Transform

levelSong public_oe property

The level song.
public AudioClip levelSong
return AudioClip

maxCameraYPoint public_oe property

public Transform maxCameraYPoint
return Transform

menuButtonStyle public_oe property

The menu button style.
public GUIStyle menuButtonStyle
return GUIStyle

menuOptionsStyle public_oe property

The menu options style.
public GUIStyle menuOptionsStyle
return GUIStyle

respawnGUIStyle public_oe property

The GUI style for respawning
public GUIStyle respawnGUIStyle
return GUIStyle

skullCrossbonesTexture public_oe property

The skull and crossbones texture.
public Texture2D skullCrossbonesTexture
return Texture2D

solidWhiteTexture public_oe property

The solid white texture.
public Texture2D solidWhiteTexture
return Texture2D

startingPoint public_oe property

The starting point.
public Transform startingPoint
return Transform

titleStyle public_oe property

The title style.
public GUIStyle titleStyle
return GUIStyle

weaponAmmoGUIStyle public_oe property

The weapon ammo GUI style.
public GUIStyle weaponAmmoGUIStyle
return GUIStyle

weaponBoxIconTextures public_oe property

The weapon box icon textures.
public Texture2D[] weaponBoxIconTextures
return Texture2D[]

weaponBoxTexture public_oe property

A box on top of the UI to represent the status of a weapon
public Texture2D weaponBoxTexture
return Texture2D

weaponHotkeyGUIStyle public_oe property

The weapon hotkey GUI style.
public GUIStyle weaponHotkeyGUIStyle
return GUIStyle