本文整理汇总了C#中Village.getControlledUnits方法的典型用法代码示例。如果您正苦于以下问题:C# Village.getControlledUnits方法的具体用法?C# Village.getControlledUnits怎么用?C# Village.getControlledUnits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Village
的用法示例。
在下文中一共展示了Village.getControlledUnits方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: updateUnitActions
public void updateUnitActions(Village v)
{
List<Unit> units = v.getControlledUnits();
foreach (Unit u in units)
{
UnitActionType currentUnitAction = u.getAction();
if(currentUnitAction == UnitActionType.StartedCultivating)
{
u.gameObject.networkView.RPC("setActionNet",RPCMode.AllBuffered,(int)UnitActionType.FinishedCultivating);
}
else if (currentUnitAction == UnitActionType.FinishedCultivating)
{
Tile tile = u.getLocation();
tile.networkView.RPC("setLandTypeNet", RPCMode.AllBuffered, (int) LandType.Meadow);
GameObject meadow = Network.Instantiate(meadowPrefab, new Vector3 (tile.point.x, 0, tile.point.y), meadowPrefab.transform.rotation,0) as GameObject;
tile.networkView.RPC ("replaceTilePrefabNet", RPCMode.AllBuffered, meadow.networkView.viewID);
u.gameObject.networkView.RPC("setActionNet",RPCMode.AllBuffered,(int)UnitActionType.ReadyForOrders);
}
else if(currentUnitAction == UnitActionType.BuildingRoad)
{
Tile tile = u.getLocation();
tile.networkView.RPC ("setRoadNet", RPCMode.AllBuffered, true);
u.gameObject.networkView.RPC("setActionNet",RPCMode.AllBuffered,(int)UnitActionType.ReadyForOrders);
}
else if(currentUnitAction == UnitActionType.UpgradingCombining)
{
u.gameObject.networkView.RPC("setActionNet",RPCMode.AllBuffered,(int)UnitActionType.ReadyForOrders);
}
else
{
u.gameObject.networkView.RPC("setActionNet",RPCMode.AllBuffered,(int)UnitActionType.ReadyForOrders);
}
}
}