本文整理汇总了C#中PlayerScript.setGameObjectTo方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerScript.setGameObjectTo方法的具体用法?C# PlayerScript.setGameObjectTo怎么用?C# PlayerScript.setGameObjectTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerScript
的用法示例。
在下文中一共展示了PlayerScript.setGameObjectTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InstantiatePlayerObject
public void InstantiatePlayerObject()
{
Vector3 spawnPosition = Vector3.zero;
if(Network.isServer)
{
spawnPosition = new Vector3(0, 8f, -0.5f);
}
else
{
spawnPosition = new Vector3(0, -8f , -0.5f);
}
GameObject newPlayer = (GameObject) Network.Instantiate(playerPrefab, Vector3.zero, Quaternion.identity, 0);
GameObject newPlayerObject = (GameObject) Network.Instantiate(prefab, spawnPosition, Quaternion.identity, 0);
Debug.Log (newPlayer.ToString() + " " + newPlayerObject.ToString ());
NetworkViewID objectVID = newPlayerObject.networkView.viewID;
NetworkViewID playerVID = newPlayer.networkView.viewID;
newPlayerObject.GetComponent<PlayerObjectScript>().AssignPlayer(playerVID);
this.thisPlayer = newPlayer.GetComponent<PlayerScript>();
thisPlayer.setGameObjectTo(objectVID);
}