当前位置: 首页>>代码示例>>C#>>正文


C# Village.GetComponent方法代码示例

本文整理汇总了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);
		}
	}
开发者ID:EmilioF,项目名称:UnityProjects,代码行数:32,代码来源:MergeVillages.cs

示例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);
	}
开发者ID:EmilioF,项目名称:UnityProjects,代码行数:18,代码来源:MergeVillages.cs


注:本文中的Village.GetComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。