本文整理汇总了C#中Tower类的典型用法代码示例。如果您正苦于以下问题:C# Tower类的具体用法?C# Tower怎么用?C# Tower使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Tower类属于命名空间,在下文中一共展示了Tower类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetInspectorStyle
private GUIStyle GetInspectorStyle(Tower t, int i, bool nada)
{
Section s = t.GetSection(i);
GUIStyle gStyle;
GUIStyle yStyle;
GUIStyle rStyle;
if(nada) {
gStyle = nadagStyle;
yStyle = nadayStyle;
rStyle = nadarStyle;
} else {
bool hasWeapon = s.attributes.weapon.GetWeaponType() != "Nothing";
gStyle = hasWeapon ? wgStyle : ngStyle;
yStyle = hasWeapon ? wyStyle : nyStyle;
rStyle = hasWeapon ? wrStyle : nrStyle;
}
int stress = t.GetWeightAboveSection(i);
int maxSP = s.attributes.sp;
double ratio = (double)stress / (double)maxSP;
if(ratio < 0.33) {
return gStyle;
} else if(ratio >= 0.33 && ratio < 0.66) {
return yStyle;
} else {
return rStyle;
}
}
开发者ID:austinblakeslee,项目名称:verthex,代码行数:27,代码来源:TowerInspector.cs
示例2: SpawnTower
/// <summary>
/// Metoda odpowiedzialna za dodawanie odpowiedniego obiektu wieży, definiowanego przez argument type, w miejscu i jako dziecko obiektu parent. Zwraca koszt wieży.
/// </summary>
/// <param name="type">Argument typu TowerType określająca typ wieży, jak ma zostać utworzona.</param>
/// <param name="parent">Argument typu GameObject, którego dzieckiem stanie się nowa wieża.</param>
/// <returns>Wzraca koszt wybudowania wieży.</returns>
public int SpawnTower(TowerType type, GameObject parent)
{
Tower tempTower = new Tower();
GameObject tempGameObject = null;
switch (type)
{
case TowerType.Wall:
tempTower = WallTower;
tempGameObject = Resources.Load("Prefabs/Towers/Wall") as GameObject;
break;
case TowerType.Shooting:
tempTower = ShootingTower;
tempGameObject = Resources.Load("Prefabs/Towers/Shooting") as GameObject;
break;
case TowerType.Aoe:
tempTower = AoeTower;
tempGameObject = Resources.Load("Prefabs/Towers/Aoe") as GameObject;
break;
}
GameObject tower = Instantiate(tempGameObject, parent.transform.position, Quaternion.identity) as GameObject;
tower.transform.parent = parent.transform;
tower.transform.localPosition = new Vector3(tower.transform.localPosition.x, -(2.0f/parent.transform.localScale.y), tower.transform.localPosition.z);
return tempTower.Cost;
}
开发者ID:Methires,项目名称:Unity-Tower-Defense,代码行数:31,代码来源:BuildTower.cs
示例3: MoveDisks
public void MoveDisks(int n, Tower destination, Tower buffer){
if (n > 0) {
////////////String tag = "move_" + n + "_disks_from_" + Index + "_to_" + destination.Index + "_with_buffer_" + buffer.Index;
////////////Console.WriteLine("<" + tag + ">");
MoveDisks(n - 1, buffer, destination);
////////////Console.WriteLine("<move_top_from_" + Index + "_to_" + destination.Index + ">");
////////////Console.WriteLine("<before>");
////////////Console.WriteLine("<source_print>");
////////////Print();
////////////Console.WriteLine("</source_print>");
////////////Console.WriteLine("<destination_print>");
////////////destination.Print();
////////////Console.WriteLine("</destination_print>");
////////////Console.WriteLine("</before>");
MoveTopTo(destination);
////////////Console.WriteLine("<after>");
////////////Console.WriteLine("<source_print>");
////////////Print();
////////////Console.WriteLine("</source_print>");
////////////Console.WriteLine("<destination_print>");
////////////destination.Print();
////////////Console.WriteLine("</destination_print>");
////////////Console.WriteLine("</after>");
////////////Console.WriteLine("</move_top_from_" + Index + "_to_" + destination.Index + ">");
buffer.MoveDisks(n - 1, destination, this);
////////////Console.WriteLine("</" + tag + ">");
}
}
开发者ID:0x0all,项目名称:ctci,代码行数:28,代码来源:Q03_4.cs
示例4: Build
public AbstractBuilding Build(string type, Game.Point coords)
{
AbstractBuilding building = null;
switch (type)
{
case ("Farm"):
{
building = new Farm(coords);
break;
}
case ("Barrack"):
{
building = new Barrack(coords);
break;
}
case ("BowWorkshop"):
{
building = new BowWorkshop(coords);
break;
}
case ("Tower"):
{
building = new Tower(coords);
break;
}
default:
break;
}
return building;
}
开发者ID:bytecode0101,项目名称:uWarcraft,代码行数:30,代码来源:BuildingFactory.cs
示例5: Start
// Use this for initialization
void Start ()
{
if (tower == null) {
tower = GameObject.FindGameObjectWithTag ("Tower").GetComponent<Tower> ();
}
}
开发者ID:stagdage,项目名称:GameJam2016,代码行数:8,代码来源:RitualDisplay.cs
示例6: Deselect
public void Deselect()
{
selectedTower = null;
CurrentlySelectedTower = null;
RangeCircle.transform.localScale = new Vector3(0, 0, 0);
infoManager.DisplayInfo(null, true);
}
开发者ID:Xyag,项目名称:Keep-Defending-TD,代码行数:7,代码来源:SelectionManager.cs
示例7: Add_FirstDisk_AddsOneDiskToTower
public void Add_FirstDisk_AddsOneDiskToTower()
{
var tower = new Tower();
tower.AddDisk("A");
tower.Count.ShouldEqual(1);
tower.TopDisk().ShouldEqual("A");
}
开发者ID:bgriswold,项目名称:CodeClub-TowerOfHanio,代码行数:7,代码来源:TowerTests.cs
示例8: GetDamagedSections
public override List<Section> GetDamagedSections(Tower t, int center)
{
int ranNum1 = Random.Range(1, Mathf.RoundToInt(100/missPercentage) + 1);
List<Section> list = new List<Section>();
if (ranNum1 == 1)//If missed, miss
{
int ranNum2 = Random.Range(1, 3);
CombatLog.addLine ("ran1 = " + ranNum1 + ". ran2 = " + ranNum2);
if (ranNum2 == 1)//miss high
{
CombatLog.addLine("Miss Higher (blind)");
if (center + 1 < t.GetHeight())//Missed above tower
{
list.Add(t.GetSection(center+1));
}
}
else//miss low
{
CombatLog.addLine("Miss Lower (blind)");
if (center - 1 >= 0) //Missed below tower
{
list.Add (t.GetSection(center - 1));
}
}
}
else{
list.Add(t.GetSection(center));
}
return list;
}
开发者ID:austinblakeslee,项目名称:verthex,代码行数:31,代码来源:Blinded.cs
示例9: DisplayInfo
public void DisplayInfo(Tower t, bool preview)
{
if (t == null)
{
NameText.text = "";
CostText.text = "";
DamageText.text = "";
FireRateText.text = "";
DPSText.text = "";
RangeText.text = "";
ProjectileFollowsText.text = "";
SellText.text = "";
SellButton.gameObject.SetActive(false);
return;
}
NameText.text = t.TowerName;
CostText.text = "Cost: $" + t.Cost.ToString();
DamageText.text = "Damage: " + t.ProjectileDamage.ToString();
FireRateText.text = "Fire Rate: " + t.FireRate.ToString();
DPSText.text = "Optimal DPS: " + (t.ProjectileDamage * t.FireRate).ToString();
RangeText.text = "Range: " + t.Range.ToString();
if (t.ProjectileFollows)
ProjectileFollowsText.text = "Projectile follows";
else
ProjectileFollowsText.text = "Projectile doesn't follow";
if (!preview)
{
SellButton.gameObject.SetActive(true);
SellText.text = "Sell For: $" + (t.Cost / 2).ToString();
}
}
开发者ID:Xyag,项目名称:Keep-Defending-TD,代码行数:33,代码来源:TowerInfoManager.cs
示例10: Run
public void Run()
{
// Set up code.
int n = 5;
Tower[] towers = new Tower[3];
for (int i = 0; i < 3; i++)
{
towers[i] = new Tower(i);
towers[i].Label = string.Format("{0}", i); ;
}
for (int i = n - 1; i >= 0; i--)
{
towers[0].Add(i);
}
// Copy and paste output into a .XML file and open it with internet explorer.
towers[0].Print();
towers[1].Print();
towers[2].Print();
towers[0].MoveDisks(n, towers[2], towers[1]);
towers[0].Print();
towers[1].Print();
towers[2].Print();
}
开发者ID:0x0all,项目名称:ctci,代码行数:26,代码来源:Q03_4.cs
示例11: SetTurret
public virtual void SetTurret(Tower turret)
{
Velocity = turret.ProjectileSpeed;
Damage = turret.Damage;
currentTarget = turret.CurrentEnemy;
range = Vector3.Distance(transform.position, currentTarget.transform.position);
}
开发者ID:AkuKuylaars,项目名称:Tower-Defense,代码行数:7,代码来源:Projectile.cs
示例12: buttonAction
protected void buttonAction(int i){
if(tower == null){
tower = GameObject.FindObjectOfType<Tower>();
}
switch (i){
case 0: //Golem 1
if(InventroyManager.instance.getCount(Element.DIRT) >= DIRT_GOLEM_COST){
InventroyManager.instance.removeFromInventory(Element.DIRT, DIRT_GOLEM_COST);
// make a CUTIE
unitSpawner.spawnObject();
}
break;
case 1: //Golem 2
break;
case 2: //Golem 3
//return ;
break;
case 3: //Tower 1
if(tower != null && InventroyManager.instance.getCount(Element.DIRT) >= DIRT_TOWER_COST){
InventroyManager.instance.removeFromInventory(Element.DIRT, DIRT_TOWER_COST);
tower.increaseHeight();
}
break;
case 4: //Tower 2
//
break;
case 5: //Tower 3
//
break;
}
}
开发者ID:JBillingsley,项目名称:eecs-390-rts,代码行数:32,代码来源:CraftingBarActions.cs
示例13: OnMouseUp
// Update is called once per frame
void OnMouseUp()
{
if (!hasTower) {
if (GameManager.argent >= turret.Valeur()) {
//Vector3 vect = new Vector3 (transform.position.x, transform.position.y + 0.5f, transform.position.z);
CurrentTurret = (Tower)Instantiate (turret, transform.position, Quaternion.identity);
CurrentTurret.name = "Turret";
CurrentTurret.transform.parent = gameObject.transform;
GameManager.argent -= turret.Valeur();
hasTower = true;
}
else{
this.GetComponent<Renderer>().material.mainTexture = textureError;
}
}
else {
Destroy(transform.FindChild("Turret").gameObject);
GameManager.argent+= CurrentTurret.Valeur()/2;
hasTower = false;
}
}
开发者ID:Alvee92,项目名称:Unity-Tower-Defense,代码行数:28,代码来源:PlacementTour.cs
示例14: DoDamage
public override void DoDamage(Tower t, int center, int damage, Tower self, int firingSection)
{
if(t.GetSections().Count >= 1) {
//t.DamageSection(center, damage);
Section s = t.GetSection (center);
if (!modifiedSecs.ContainsKey(s)) //if not modified before...
{
ModifyWeight(s, t, damage, self);
modifiedSecs.Add(s, 1);
}
else if (modifiedSecs[s] >= numTimesModifiable)
{
ModifyWeight(s, t, damage, self);
modifiedSecs[s]++;
}
else
{
//TODO: Make this a warning and let them go back to their turn
CombatLog.addLine("This section has already altered the weight " + modifiedSecs[s] + "times.");
}
}
else if(center < 0) {
CombatLog.addLine("Attack was too low");
CombatLog.addLine("Fill the aim bar more.");
} else if(center >= t.GetSections().Count) {
CombatLog.addLine("Attack was too high");
CombatLog.addLine("Lower the aim bar.");
}
}
开发者ID:austinblakeslee,项目名称:verthex,代码行数:30,代码来源:AlterWeight.cs
示例15: Build
public bool Build(Tower prefab)
{
bool result = false;
if (this.Tower == null && prefab == null)
{
GameObject.Destroy(this.gameObject);
result = true;
}
else
{
if (this.Tower != null)
{
GameObject.Destroy(this.Tower.gameObject);
result = true;
}
if (prefab != null)
{
var tower = GameObject.Instantiate<Tower>(prefab);
tower.transform.parent = this.transform;
tower.transform.localPosition = Vector3.zero;
tower.transform.localRotation = Quaternion.identity;
this.Tower = tower;
result = true;
}
}
return result;
}
开发者ID:Axuim,项目名称:Tower-Defense,代码行数:30,代码来源:Wall.cs
示例16: Print
private static void Print(Tower[] t)
{
for (int i = 0; i < 3; ++i) {
Console.WriteLine (t[i]);
}
Console.WriteLine ();
}
开发者ID:slao-learn,项目名称:ctci,代码行数:7,代码来源:Q8_6.cs
示例17: PreviousTower
public Tower PreviousTower(Game game, Tower tower)
{
if (game.Towers.Tower2 == tower) return game.Towers.Tower1;
return game.Towers.Tower3 == tower
? game.Towers.Tower2
: game.Towers.Tower3;
}
开发者ID:bgriswold,项目名称:CodeClub-TowerOfHanio,代码行数:8,代码来源:TowerFinder.cs
示例18: FreezeShot
public FreezeShot(Game game, Tower parent, Creep target, List<Creep> creeps, Vector2 position,
string shotTextName, float speed, float damage, float percentage, float time)
: base(game, parent, target, creeps, position, shotTextName, speed, damage)
{
FreezePercentage = percentage;
FreezeTime = time;
Parent = (FreezeTower) parent;
}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:8,代码来源:FreezeShot.cs
示例19: GetDamagedSections
public override List<Section> GetDamagedSections(Tower t, int center)
{
List<Section> list = new List<Section>();
if(center >= 0 && center < t.GetSections().Count) {
list.Add(t.GetSections()[center]);
}
return list;
}
开发者ID:austinblakeslee,项目名称:verthex,代码行数:8,代码来源:DefaultWeaponEffect.cs
示例20: NextTower
public Tower NextTower(Game game, Tower tower)
{
if (game.Towers.Tower1 == tower) return game.Towers.Tower2;
return game.Towers.Tower2 == tower
? game.Towers.Tower3
: game.Towers.Tower1;
}
开发者ID:bgriswold,项目名称:CodeClub-TowerOfHanio,代码行数:8,代码来源:TowerFinder.cs
注:本文中的Tower类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论