本文整理汇总了C#中PhotonPlayer类的典型用法代码示例。如果您正苦于以下问题:C# PhotonPlayer类的具体用法?C# PhotonPlayer怎么用?C# PhotonPlayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PhotonPlayer类属于命名空间,在下文中一共展示了PhotonPlayer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OnPhotonPlayerDisconnected
public override void OnPhotonPlayerDisconnected(PhotonPlayer otherPlayer)
{
base.OnPhotonPlayerDisconnected(otherPlayer);
if (PhotonNetwork.isMasterClient)
MatchMakerSendPlayerToClassSelect();
}
开发者ID:RandomTroll18,项目名称:deco3801-nodayoff,代码行数:7,代码来源:TestMatchMaker.cs
示例2: SpawnSpectre
public void SpawnSpectre( Vector2 spawnCoordinates, Quaternion spawnRotation, PhotonPlayer owner )
{
if ( PhotonNetwork.isMasterClient )
{
//Check if coordinate is vacant
GridSpace space = GridSystem.GetSpaceByCoordinate( spawnCoordinates );
if ( space.GridTile != null && !space.GridTile.IsOccupied )
{
//Spawn new unit on the network
GameObject newSpectre = PhotonNetwork.Instantiate( "Units/PlayerSpectre", new Vector3( spawnCoordinates.x, 0, spawnCoordinates.y ), spawnRotation, 0 );
PlayerSpectre spectre = newSpectre.GetComponent<PlayerSpectre>( );
spectre.SetOwner( owner );
spectre.CurrentTile = space.GridTile;
//Notify tile of this objects arrival
space.GridTile.RegisterUnit( spectre );
//Add this spectre to list
if ( Spectres == null )
Spectres = new List<PlayerSpectre>( );
Spectres.Add( newSpectre.GetComponent<PlayerSpectre>( ) );
}
}
else
{
photonView.RPC( "SpawnSpectre", PhotonTargets.MasterClient, spawnCoordinates, spawnRotation, owner );
}
}
开发者ID:MrSuicideFish,项目名称:TBTD,代码行数:30,代码来源:ActorManager.cs
示例3: OnPhotonPlayerConnected
public void OnPhotonPlayerConnected(PhotonPlayer newPlayer)
{
if (PhotonNetwork.isMasterClient)
{
this.SendPickedUpItems(newPlayer);
}
}
开发者ID:2ty,项目名称:race3d,代码行数:7,代码来源:PickupItemSyncer.cs
示例4: recieveCurrentParty
void recieveCurrentParty(PhotonPlayer[] _players, bool _open)
{
List<PhotonPlayer> _players2 = new List<PhotonPlayer>();
foreach (PhotonPlayer _p in _players) { _players2.Add(_p); }
Party _party = new Party(_players2, _open);
GameObject.FindGameObjectWithTag("MenuController").GetComponentInChildren<SocialScreen>().recieveCurrentParty(_party);
}
开发者ID:pShusta,项目名称:TheFellnightPrison,代码行数:7,代码来源:TurnOnCharacter.cs
示例5: AddPickedUpWeapon
//
// Add a weapon of type weaponName to the player
// - if the player already has the weapon then just add ammo
// - confirm it works correctly
public void AddPickedUpWeapon(string weaponName, PhotonPlayer player)
{
if (weapons[weaponName]) {
weapons[weaponName].AddAmmo(weapons[weaponName].DefaultAmmoAmount());
} else {
// spawn weapon for the player
if (PhotonNetwork.player == player) {
GameObject weaponObject = PhotonNetwork.Instantiate(weaponName, weaponPosition.transform.position, camera.transform.rotation, 0);
Weapon weapon = weaponObject.GetComponent<Weapon>();
// need all copies to be not pick upable
weapon.GetComponent<PhotonView>().RPC("PickUp", PhotonTargets.All, null);
// syncs weapon name to weapon so all players have a reference to each players weapons
weapons[weaponName] = weapon;
// this needs to be an rpc
weapon.GetComponent<PhotonView>().RPC("SetParent", PhotonTargets.All, playerController.GetComponent<PhotonView>().viewID, true);
playerController.GetComponent<PhotonView>().RPC("ChangeWeapon", PhotonTargets.All, weaponName, weapon.GetComponent<PhotonView>().viewID);
}
}
}
开发者ID:remz99,项目名称:simplefps,代码行数:29,代码来源:WeaponManager.cs
示例6: RPCBoss3TakeDamage
public void RPCBoss3TakeDamage(float damage, PhotonPlayer owningPlayer)
{
// Flash the thug white
characterTextureFlasher.Flash(0.04f);
// Deduct the hitpoint count
hitPoints -= damage;
// Handling for the owner (the master client)
if (PhotonNetwork.isMasterClient)
{
// If the character is doomed, then begin its VISUAL death sequence. Other players
// will discover this with the next serialization; and you, as the master client,
// will eventually destroy the character entirely.
if (hitPoints - damage < MinHitpointsBeforeFrag)
{
GameDirector gameDirector = (GameDirector)Object.FindObjectOfType(typeof(GameDirector));
// Do stuff for the owning player
if (null != owningPlayer)
{
// Increase their score
int currentScore = (int)owningPlayer.customProperties["Player.ActiveSession.Score"];
gameDirector.photonView.RPC("RPCSetScore", owningPlayer, currentScore + pointValue);
}
// Tell everybody that this character is dying
photonView.RPC("RPCBoss3BeginDying", PhotonTargets.All);
// Tell everybody that the boss has been defeated. Do it buffered in case someone
// jumps in during the victory sequence.
gameDirector.photonView.RPC("RPCBossDefeated", PhotonTargets.AllBuffered);
}
}
}
开发者ID:Gamieon,项目名称:PaperCowboys,代码行数:34,代码来源:L3Boss.cs
示例7: Die
private void Die(PhotonPlayer killer)
{
if (playerController.transform.GetComponent<PhotonView>().isMine) {
GameController.instance.PlayerDied(killer);
PhotonNetwork.Destroy(playerController.gameObject);
}
}
开发者ID:remz99,项目名称:simplefps,代码行数:7,代码来源:HealthManager.cs
示例8: GetShot
public void GetShot(float damage, PhotonPlayer enemyPlayer)
{
health -= damage;
if (photonView.isMine) {
particle = GameObject.Find("spPoint");
AudioSource.PlayClipAtPoint(damagesound, particle.transform.position);
mainscreen.health = health;
}
if (health <= 0 && photonView.isMine) {
//if(SendNetworkMessage != null)
// SendNetworkMessage(PhotonNetwork.player.name + " was killed by " + enemyName);
enemyPlayer.AddKill(1);
PhotonNetwork.player.AddDeath(1);
if(RespawnMe != null)
RespawnMe(3f);
GameObject.Find("screenset").SetActive(false);
PhotonNetwork.Destroy (gameObject);
}
}
开发者ID:umjinsun12,项目名称:Suddenforce,代码行数:27,代码来源:playerstatus.cs
示例9: OnEnable
void OnEnable () {
if (CurrentParty == null)
{
CurrentParty = new Party(PhotonNetwork.player);
}
nonGmPlayers = new PhotonPlayer[9];
GmPlayers = new PhotonPlayer[11];
ConnectedPlayers = PhotonNetwork.playerList;
int counter = 0;
int gmcounter = 0;
foreach (GameObject _object in PlayerButtons)
{
_object.SetActive(false);
}
foreach (GameObject _object in PartyButtons)
{
_object.SetActive(false);
}
foreach (PhotonPlayer _player in ConnectedPlayers)
{
if (_player.name != "" && _player.name != PhotonNetwork.player.name)
{
nonGmPlayers[counter] = _player;
PlayerButtons[counter].SetActive(true);
PlayerButtons[counter].GetComponentInChildren<Text>().text = _player.name;
counter++;
}
else if (_player.name != PhotonNetwork.player.name && !_player.isMasterClient)
{
GmPlayers[gmcounter] = _player;
gmcounter++;
}
}
updateCurrentPartyUi();
}
开发者ID:pShusta,项目名称:TheFellnightPrison,代码行数:35,代码来源:SocialScreen.cs
示例10: OnPawnTakesDamage
//public void OnPawnTakesDamage(CombatEventListener.PawnTakesDamageCallback callback, PhotonPlayer thePlayer, int damageTaken)
public void OnPawnTakesDamage(PhotonPlayer thePlayer, int currentHealth, int maxHealth)
{
foreach (ICombatEventListener listener in IterateListeners<ICombatEventListener>())
{
listener.OnPawnTakesDamage(thePlayer, currentHealth, maxHealth);
}
}
开发者ID:Awesome-MQP,项目名称:Storybook,代码行数:8,代码来源:CombatEventDispatcher.cs
示例11: OnMasterClientSwitched
/// <remarks>
/// In theory, the client which created the room might crash/close before it sets the start time.
/// Just to make extremely sure this never happens, a new masterClient will check if it has to
/// start a new round.
/// </remarks>
public void OnMasterClientSwitched(PhotonPlayer newMasterClient)
{
if (!PhotonNetwork.room.customProperties.ContainsKey (StartTimeKey)) {
Debug.Log ("The new master starts a new round, cause we didn't start yet.");
this.StartRoundNow ();
}
}
开发者ID:Avatarchik,项目名称:survival-shooter-multiplayer-unity3d-files,代码行数:12,代码来源:InRoomRoundTimer.cs
示例12: OnPickup
protected void OnPickup(PhotonPlayer m_actor,int m_view)
{
PhotonView view = PhotonView.Find(m_view);
if (view != null)
{
bl_CTFPlayerLogic logic = view.GetComponent<bl_CTFPlayerLogic>();
if (CanBePickedUpBy(logic) == true)
{
OnPickup(logic);
if (PhotonNetwork.player == m_actor)
{
bool t_send = false;//Prevent call two or more events
if (!t_send)
{
t_send = true;
Team oponentTeam;
if ((string)PhotonNetwork.player.customProperties[PropiertiesKeys.TeamKey] == Team.Delta.ToString())
oponentTeam = Team.Recon;
else
oponentTeam = Team.Delta;
bl_EventHandler.KillEvent(PhotonNetwork.player.name, "", "Obtained at the " + oponentTeam.ToString() + " flag", (string)PhotonNetwork.player.customProperties[PropiertiesKeys.TeamKey], 777, 15);
}
}
}
}
}
开发者ID:SaltPeter,项目名称:fps,代码行数:26,代码来源:bl_FlagBase.cs
示例13: OnPhotonPlayerConnected
void OnPhotonPlayerConnected(PhotonPlayer other)
{
if (PhotonNetwork.playerList.Length > 1)
{
FadingManager.Instance.Fade(scene);
}
}
开发者ID:CanPayU,项目名称:SuperSwungBall,代码行数:8,代码来源:PrivateGameController.cs
示例14: SetPlayer
public void SetPlayer(int inLevel, string inName, int inPlayerID, PhotonPlayer inPhotonPlayer)
{
playerLevel = inLevel;
playerID = inPlayerID;
playerName = inName;
nameLabel.text = playerName;
netPlayer = inPhotonPlayer;
}
开发者ID:KenReaGameDev,项目名称:Super-Color-Battle-Ultra,代码行数:8,代码来源:NetPlayerInfo.cs
示例15: PlayerDied
/**
* How to handle player deaths, each subclass can set their own rules for
* player deaths
*/
public virtual void PlayerDied(PlayerManager playerManager, PhotonPlayer killer)
{
ScoreBoard.instance.GetComponent<PhotonView>().RPC("AddKillToScoreBoard", PhotonTargets.All, killer);
MenuCamera.instance.gameObject.SetActive(true);
playerManager.SetNextSpawnTime();
}
开发者ID:remz99,项目名称:simplefps,代码行数:12,代码来源:GameMode.cs
示例16: OnPhotonPlayerConnected
public override void OnPhotonPlayerConnected(PhotonPlayer newPlayer)
{
base.OnPhotonPlayerConnected(newPlayer);
InitPlayer();
SpawnPlayerUnits();
PhotonNetwork.room.open = false;
PhotonNetwork.room.visible = false;
}
开发者ID:KewlalaGamez,项目名称:Apoptosis,代码行数:8,代码来源:OnlineGameController.cs
示例17: OnMasterClientSwitched
public override void OnMasterClientSwitched(PhotonPlayer newMasterClient)
{
base.OnMasterClientSwitched(newMasterClient);
if (newMasterClient == PhotonNetwork.player)
{
view.RequestOwnership();
}
}
开发者ID:tegleg,项目名称:mfp,代码行数:8,代码来源:bl_SyncObject.cs
示例18: OnMasterClientSwitched
public void OnMasterClientSwitched(PhotonPlayer newMasterPlayer)
{
if (PhotonNetwork.isMasterClient)
{
//disable the ui buttons for the master
FindObjectOfType<UIManager>().DisableClientButtons();//just a temp ugly call as it's a test project
}
}
开发者ID:Ralph89,项目名称:SoccerRally,代码行数:8,代码来源:NetworkManager.cs
示例19: CalculatePlayerDamage
// Calculates damage taken based on distance between player and explosion
private int CalculatePlayerDamage(PhotonPlayer p)
{
if ((string)p.customProperties[PropiertiesKeys.TeamKey] == myTeam)
return 0;
float distance = Vector3.Distance(base.transform.position, FindPhotonPlayer(p).transform.position);
return Mathf.Clamp((int) (this.explosionDamage * ((this.explosionRadius - distance) / this.explosionRadius)), 0, (int) this.explosionDamage);
}
开发者ID:SaltPeter,项目名称:fps,代码行数:9,代码来源:bl_Blast.cs
示例20: OnPhotonPlayerConnected
void OnPhotonPlayerConnected(PhotonPlayer newPlayer)
{
if (PhotonNetwork.isMasterClient)
{
//A player connected to me(the MasterClient), spawn a player for it:
Spawnplayer(newPlayer);
}
}
开发者ID:pisipo,项目名称:PUNProja,代码行数:8,代码来源:Tutorial_3_Spawnscript.cs
注:本文中的PhotonPlayer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论