本文整理汇总了C#中UnityEngine.NetworkViewID.GetGameObject方法的典型用法代码示例。如果您正苦于以下问题:C# NetworkViewID.GetGameObject方法的具体用法?C# NetworkViewID.GetGameObject怎么用?C# NetworkViewID.GetGameObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.NetworkViewID
的用法示例。
在下文中一共展示了NetworkViewID.GetGameObject方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryEnterVessel
void TryEnterVessel(NetworkViewID playerViewID)
{
if (!rider && !playerViewID.GetGameObject().GetComponent<VesselController>())
{
networkView.RPC("CommitEnterVessel", RPCMode.All, playerViewID);
}
}
示例2: TryPickupItem
void TryPickupItem(NetworkViewID playerViewID)
{
GameObject interactor = playerViewID.GetGameObject();
if (interactor.GetInventory().IsFull) return;
if (item == null)
{
Debug.Log("This item doesn't have a viewID yet. Assigning one.");
item = ItemFactory.CreateItemForPlayer(this.itemName);
}
interactor.networkView.RPC("CommitAddToInventory", RPCMode.All, item.viewID, itemName);
Network.Destroy(this.gameObject);
}
示例3: CommitEnterVessel
void CommitEnterVessel(NetworkViewID enteringPlayer)
{
Debug.Log("Commit vessel entry");
GameObject entered = enteringPlayer.GetGameObject();
entered.transform.position = this.transform.position;
this.transform.SetParentAndCenter(entered.transform);
this.transform.position += Vector3.up * 1.5f;
this.rider = entered;
if (entered.IsMyLocalPlayer() || Network.isServer)
{
entered.GetComponent<ThirdPersonController>().enabled = false;
entered.AddComponent<VesselController>().vessel = this;
}
}
示例4: NotifyDeath
protected virtual void NotifyDeath(Vector3 deathPosition, NetworkViewID killer, int experience, int gold)
{
var e = new UnitDiedEventArgs() { reward = new KillReward(experience, gold), killer = killer.GetGameObject(), deathPosition = deathPosition };
if (Died != null)
{
Died(gameObject, e);
}
killer.GetGameObject().GetCharacterStats().OnKilledUnit(new UnitKilledEventArgs() { deadUnit = this.gameObject, deathPosition = deathPosition });
}
示例5: CommitPickupRelic
void CommitPickupRelic(NetworkViewID viewID)
{
isPickedUp = true;
this.collider.enabled = false;
var player = viewID.GetGameObject();
SetControllingTeam(player.GetTeamNumber());
AddHolderBuffs(player);
this.transform.SetParentAndCenter(player.transform);
this.transform.localPosition += Vector3.up * 3.5f;
rigidbody.isKinematic = true;
if (Network.isServer)
{
player.GetCharacterStats().Died += RelicHolder_Died;
}
}
示例6: TryPickupRelic
void TryPickupRelic(NetworkViewID viewID)
{
if (!isPickedUp)
networkView.RPC("CommitPickupRelic", RPCMode.All, viewID);
else
Debug.LogWarning(viewID.GetGameObject() + " tried to pick up a relic that was already picked up!");
}
示例7: TryExitVessel
void TryExitVessel(NetworkViewID viewID)
{
var player = viewID.GetGameObject();
vessel.networkView.RPC("CommitExitVessel", RPCMode.All, viewID);
if (gameObject.IsMyLocalPlayer())
{
ExitVessel();
}
else
{
if (Network.isServer)
ExitVessel();
networkView.RPC("ExitVessel", PlayerManager.Main.FindRecord(player).networkPlayer);
}
}