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


C# Building.GetLevel方法代码示例

本文整理汇总了C#中Building.GetLevel方法的典型用法代码示例。如果您正苦于以下问题:C# Building.GetLevel方法的具体用法?C# Building.GetLevel怎么用?C# Building.GetLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Building的用法示例。


在下文中一共展示了Building.GetLevel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetTower

	//show the tower info panel, update the info in the panel
	private void GetTower(){
		RaycastHit hit = new RaycastHit();
		Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
		Physics.Raycast(ray, out hit, 100);
		if (hit.transform != null) {
			if (hit.transform.tag == "Tower1") {
				//show the current tower attack, upgrade button, destory button
				name = "Basic Tower";
				description = "this tower has middle attack range, medium rate of fire";
				building = cManager.GetBuildingById(int.Parse(hit.collider.transform.name));
				attackNumber = building.GetAttackPower()+"";
				levelNumber = building.GetLevel()+"";
				//show the attack range
				SetAttackRangeShow(building);
				SetPanel(name,description,attackNumber,levelNumber);
			} else if(hit.transform.tag == "Tower2"){
				name = "Shotgun Tower";
				description = "this tower has low range, medium rate of fire, can shoot two enemies";
				building = cManager.GetBuildingById(int.Parse(hit.collider.transform.name));
				attackNumber = building.GetAttackPower()+"";
				levelNumber = building.GetLevel()+"";
				SetAttackRangeShow(building);
				SetPanel(name,description,attackNumber,levelNumber);
			} else if(hit.transform.tag == "Tower4"){
				name = "Stasis Tower";
				description = "this tower slows the near enemies";
				building = cManager.GetBuildingById(int.Parse(hit.collider.transform.name));
				attackNumber = 0 + "";
				levelNumber = building.GetLevel()+"";
				SetAttackRangeShow(building);
				SetPanel(name,description,attackNumber,levelNumber);
			} else if(hit.transform.tag == "Tower7"){
				name = "Missile Tower";
				description = "this tower attack the area enemies";
				building = cManager.GetBuildingById(int.Parse(hit.collider.transform.name));
				attackNumber = building.GetAttackPower()+"";
				levelNumber = building.GetLevel()+"";
				SetAttackRangeShow(building);
				SetPanel(name,description,attackNumber,levelNumber);
			} else if(hit.transform.tag == "Tower10"){
				name = "Laser Tower";
				description = "this tower is the most powerful tower";
				building = cManager.GetBuildingById(int.Parse(hit.collider.transform.name));
				attackNumber = building.GetAttackPower()+"";
				levelNumber = building.GetLevel()+"";
				SetAttackRangeShow(building);
				SetPanel(name,description,attackNumber,levelNumber);
			} else {
				SetAttackRangeHide();
			}
		}
	}
开发者ID:ziyihu,项目名称:TowerDefence,代码行数:53,代码来源:TowerBuildManager.cs

示例2: GetTower

	//show the tower info panel, update the info in the panel
	private void GetTower(){
		RaycastHit hit = new RaycastHit();
		Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
		Physics.Raycast(ray, out hit, 100);
		if (hit.transform != null) {
			if (hit.transform.tag == "Tower1") {
				//show the current tower attack, upgrade button, destory button
				name = "Basic Tower";
				description = "This tower has middle attack range, medium rate of fire\n\n"+"Need 1 power to function";
				building = cManager.GetBuildingById(int.Parse(hit.collider.transform.name));
				attackNumber = building.GetAttackPower()+"";
				levelNumber = building.GetLevel()+"";
				//show the attack range
				SetAttackRangeShow(building);
				//show the attack range using sprite
				SetSpriteRangeShow(building);
				SetPanel(name,description,attackNumber,levelNumber);
			} else if(hit.transform.tag == "Tower2"){
				name = "Shotgun Tower";
				description = "This tower has low range, medium rate of fire, can shoot four enemies\n\n"+"Need 2 power to function";
				building = cManager.GetBuildingById(int.Parse(hit.collider.transform.name));
				attackNumber = building.GetAttackPower()+"";
				levelNumber = building.GetLevel()+"";
				SetAttackRangeShow(building);
				//show the attack range using sprite
				SetSpriteRangeShow(building);
				SetPanel(name,description,attackNumber,levelNumber);
			} else if(hit.transform.tag == "Tower4"){
				name = "Stasis Tower";
				description = "This tower slows the near enemies\n\n"+"Need 1 power to function";
				building = cManager.GetBuildingById(int.Parse(hit.collider.transform.name));
				attackNumber = 0 + "";
				levelNumber = building.GetLevel()+"";
				SetAttackRangeShow(building);
				//show the attack range using sprite
				SetSpriteRangeShow(building);
				SetPanel(name,description,attackNumber,levelNumber);
			} else if(hit.transform.tag == "Tower7"){
				name = "Missile Tower";
				description = "This tower attack the area enemies\n\n"+"Need 2 power to function";
				building = cManager.GetBuildingById(int.Parse(hit.collider.transform.name));
				attackNumber = building.GetAttackPower()+"";
				levelNumber = building.GetLevel()+"";
				SetAttackRangeShow(building);
				//show the attack range using sprite
				SetSpriteRangeShow(building);
				SetPanel(name,description,attackNumber,levelNumber);
			} else if(hit.transform.tag == "Tower10"){
				name = "Laser Tower";
				description = "This tower is the most powerful tower\n\n"+"Need 3 power to function";
				building = cManager.GetBuildingById(int.Parse(hit.collider.transform.name));
				attackNumber = building.GetAttackPower()+"";
				levelNumber = building.GetLevel()+"";
				SetAttackRangeShow(building);
				//show the attack range using sprite
				SetSpriteRangeShow(building);
				SetPanel(name,description,attackNumber,levelNumber);
			} else if(hit.transform.tag == "Research"){
				name = "Research Lab";
				description = "This tower will allow you to generate research point to be used in tech tree";
				building = cManager.GetBuildingById(int.Parse(hit.collider.transform.name));
				attackNumber = 0 + "";
				levelNumber = 0 + "";
				SetPanel(name,description,attackNumber,levelNumber);
			} else if(hit.transform.tag == "SmallMine"){
				name = "Small Mine";
				description = "This tower collection diamond from nearby resource 1 per second";
				building = cManager.GetBuildingById(int.Parse(hit.collider.transform.name));
				attackNumber = 0 +"";
				levelNumber = 0 + "";
				SetPanel(name,description,attackNumber,levelNumber);
			} else if(hit.transform.tag == "LargeMine"){
				name = "Large Mine";
				description = "This tower collection diamond from nearby resource 2 per second";
				building = cManager.GetBuildingById(int.Parse(hit.collider.transform.name));
				attackNumber = 0 +"";
				levelNumber = 0 + "";
				SetPanel(name,description,attackNumber,levelNumber);
			} else if(hit.transform.tag == "SmallGeneator"){
				name = "Small Power";
				description = "This tower will provide: "+ GetSmallGenPower() +" power";
				building = cManager.GetBuildingById(int.Parse(hit.collider.transform.name));
				attackNumber = 0+"";
				levelNumber = 0 + "";
				SetPanel(name,description,attackNumber,levelNumber);
			} else if(hit.transform.tag == "LargeGeneator"){
				name = "Large Power";
				description = "This tower will provide: "+ GetBigGenPower() + " power";
				building = cManager.GetBuildingById(int.Parse(hit.collider.transform.name));
				attackNumber = 0+"";
				levelNumber = 0 + "";
				SetPanel(name,description,attackNumber,levelNumber);
			} else if(hit.transform.tag == "Targeting"){
				name = "Targeting Facility";
				description = "This tower will increase 2 attack number for nearby towers\n\n"+"Need 2 power to function";
				building = cManager.GetBuildingById(int.Parse(hit.collider.transform.name));
				attackNumber = 0+"";
				levelNumber = 0 + "";
				SetAttackRangeShow(building);
//.........这里部分代码省略.........
开发者ID:ziyihu,项目名称:Tower-Defence,代码行数:101,代码来源:TowerBuildManager.cs


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