本文整理汇总了C#中World.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# World.GetComponent方法的具体用法?C# World.GetComponent怎么用?C# World.GetComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World
的用法示例。
在下文中一共展示了World.GetComponent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveZoneBlocks
// Removes the zone with its blocks
public void RemoveZoneBlocks(Vector3 HitPosition, World MyHitWorld) {
//Debug.LogError ("Building Core being Removed");
// get zone
Zone MyZone = GetManager.GetZoneManager().GetZoneFromBlock(HitPosition);
Vector3 ZoneSize = MyZone.Size;
for (float i = -Mathf.FloorToInt(ZoneSize.x); i <= Mathf.FloorToInt(ZoneSize.x); i++)
for (float j = -Mathf.FloorToInt(ZoneSize.y)+1; j <= Mathf.FloorToInt(ZoneSize.y); j++)
for (float k = -Mathf.FloorToInt(ZoneSize.z); k <= Mathf.FloorToInt(ZoneSize.z); k++) {
if (GetManager.GetNetworkManager().IsConnected()) {
MyHitWorld.GetComponent<NetworkView>().RPC ("SetBlockAir",
RPCMode.All,
Mathf.FloorToInt(i+MyZone.InBlockPosition.x),
Mathf.FloorToInt(j+MyZone.InBlockPosition.y),
Mathf.FloorToInt(k+MyZone.InBlockPosition.z)
);
}
}
GetManager.GetZoneManager().DestroyZone (MyZone);
}
示例2: RemoveBlock
public void RemoveBlock(BlockData MyBlockData, Vector3 HitPosition, World MyHitWorld) {
switch (MyBlockData.OnDestroyFunctionId)
{
case(1): // for zone cores
RemoveZoneBlocks (HitPosition, MyHitWorld);
break;
case(2): // town hall end of game condition?
GetManager.GetGameManager().EndGame();
RemoveZoneBlocks (HitPosition, MyHitWorld);
break;
case(3):// TNT
break;
}
if (MyBlockData.RemovedSoundEffect)
SoundSource.PlayOneShot (MyBlockData.RemovedSoundEffect);
if (GetManager.GetNetworkManager ().IsConnected ())
MyHitWorld.GetComponent<NetworkView> ().RPC ("SetBlockAir",
RPCMode.All,
Mathf.RoundToInt (HitPosition.x),
Mathf.RoundToInt (HitPosition.y),
Mathf.RoundToInt (HitPosition.z)
);
else
MyHitWorld.SetBlockAir (Mathf.RoundToInt (HitPosition.x),
Mathf.RoundToInt (HitPosition.y),
Mathf.RoundToInt (HitPosition.z));
}
示例3: Initialized
public override void Initialized(World world)
{
world.GetComponent<LimitedWorld>().Adjust();
}