本文整理汇总了C#中NetworkManager.CreateLocalPlayer方法的典型用法代码示例。如果您正苦于以下问题:C# NetworkManager.CreateLocalPlayer方法的具体用法?C# NetworkManager.CreateLocalPlayer怎么用?C# NetworkManager.CreateLocalPlayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetworkManager
的用法示例。
在下文中一共展示了NetworkManager.CreateLocalPlayer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PopulateLayers
public void PopulateLayers(IDictionary<string,object> lines, NetworkManager nm)
{
try{
foreach (var level in lines) {
var xy = level.Key.Split (new []{ 'x' }, 2);
if (xy.Length != 2)
continue;
int x, y;
var line = level.Value.ToString ();
if (int.TryParse (xy[0], out x) && int.TryParse (xy[1], out y)) {
Debug.Log("x="+x + " and y = "+y);
int z = 0;
for (;z<line.Length; ++z)
{
var c = line[z];
if (c != ' ')
{
var pos = new Vector3(-45+x*10,-45+y*10,-45+z*10);
if (c == '.')
{
if (StartPoint != null)
CreateBox (StartPoint, pos);
spawnPoints.Add(pos);
continue;
}
GameObject prefab = null;
if (c == 'A')
prefab = CubeA;
else if (c == 'B')
prefab = CubeB;
else if (c == 'C')
prefab = CubeC;
else if (c == 'E')
prefab = Exit;
if (prefab == null)
prefab = CubeA;
if (prefab != null)
CreateBox (prefab, pos);
}
}
}
}
} catch (Exception ex) {
Debug.Log (ex);
}
if (spawnPoints.Count == 0)
nm.CreateLocalPlayer (new Vector3 (0, 0, 0));
else
nm.CreateLocalPlayer (spawnPoints[UnityEngine.Random.Range(0,spawnPoints.Count)]);
}