本文整理汇总了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();
}
}
}
示例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);
//.........这里部分代码省略.........