本文整理汇总了C#中Village.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# Village.GetComponent方法的具体用法?C# Village.GetComponent怎么用?C# Village.GetComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Village
的用法示例。
在下文中一共展示了Village.GetComponent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MergeThree
public void MergeThree()
{
// the new village is the one that will remain if the three villages merge
Village temp = CompareVillages(Village1, Village2);
_newVillage = CompareVillages(temp, Village3);
// the new village will have all the resources (wood, gold, tiles)
_newVillage.GetComponent<NetworkView>().RPC("updateWood", RPCMode.AllBuffered, -_newVillage.Wood + Village1.Wood + Village2.Wood + Village3.Wood);
_newVillage.GetComponent<NetworkView>().RPC("updateGold", RPCMode.AllBuffered, -_newVillage.Gold + Village1.Gold + Village2.Gold + Village3.Gold);
_newVillage.VillageTerritory = Tiles;
// if the new village is the current village
// then the other two villages' flags are turned off
if (_newVillage == Village1)
{
DestroyVillage(Village2);
DestroyVillage(Village3);
}
// else if the new village is village2
else if (_newVillage == Village2)
{
DestroyVillage(Village1);
DestroyVillage(Village3);
}
// else if the new village is village 3
else
{
DestroyVillage(Village1);
DestroyVillage(Village2);
}
}
示例2: MergeTwo
public void MergeTwo()
{
// the new village is the one that will remain if the two villages merge
_newVillage = CompareVillages(Village1, Village2);
// the new village will have all the resources (wood, gold, tiles)
_newVillage.GetComponent<NetworkView>().RPC("updateWood", RPCMode.AllBuffered, -_newVillage.Wood + Village1.Wood + Village2.Wood);
_newVillage.GetComponent<NetworkView>().RPC("updateGold", RPCMode.AllBuffered, -_newVillage.Gold + Village1.Gold + Village2.Gold);
_newVillage.VillageTerritory = Tiles;
// if the new village is the current village
if (_newVillage == Village1)
DestroyVillage(Village2);
// else if the new village is the other village
else
DestroyVillage(Village1);
}