本文整理汇总了C#中Weapon.getDamage方法的典型用法代码示例。如果您正苦于以下问题:C# Weapon.getDamage方法的具体用法?C# Weapon.getDamage怎么用?C# Weapon.getDamage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Weapon
的用法示例。
在下文中一共展示了Weapon.getDamage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: initialize
public void initialize(Vector3 position, Weapon weapon, Transform hand)
{
transform.position = position;
this.hand = hand;
this.speed = weapon.getProjectileSpeed();
this.damage = weapon.getDamage();
this.lifeSpan = weapon.getLifeSpan();
}
示例2: attack
public void attack(Weapon w, Attackable a, bool flatFooted, bool touch)
{
//function actually attacks
AC = getArmorClass(flatFooted, touch, a);
rollAttack();
Debug.Log(e.getName()+" attack roll = "+TattackRoll);
if(TattackRoll == 1) { //critical miss, add some sort of fumble later
Debug.Log(e.getName()+"'s attack critically misses :(");
if(transform.gameObject.tag == "Player") {
hitter.SetTrigger("playerAttack");
} else if(transform.gameObject.tag == "Fightable") {
hitter.SetTrigger("fightableAttack");
}
} else if(TattackRoll >= 21 - w.getCriticalRange()) { //critical hit
rollAttack();
Debug.Log(e.getName()+" critical roll = "+TattackRoll);
if(TattackRoll == 20 || TattackRoll+attackBonus(w) > AC) {
Debug.Log(e.getName()+" lands a critical hit!");
for(int i = 0; i < w.getCriticalRolls(); i++) {
rollDamage(w.getDamage(), w.getDamageRolls(), a);
}
}
try {
hitee = hit.transform.gameObject.GetComponent<Animator>();
if(hit.transform.gameObject.tag == "Player") {
hitee.SetTrigger("playerHit");
}
} catch (Exception ex) {
Debug.Log(ex);
}
if(transform.gameObject.tag == "Player") {
hitter.SetTrigger("playerAttack");
} else if(transform.gameObject.tag == "Fightable") {
hitter.SetTrigger("fightableAttack");
}
rollDamage(w.getDamage(), w.getDamageRolls(), a);
} else if(TattackRoll == 20 || TattackRoll+attackBonus(w) > AC) { //hit
try {
hitee = hit.transform.gameObject.GetComponent<Animator>();
if(hit.transform.gameObject.tag == "Player") {
hitee.SetTrigger("playerHit");
}
} catch (Exception ex) {
Debug.Log(ex);
}
if(transform.gameObject.tag == "Player") {
hitter.SetTrigger("playerAttack");
} else if(transform.gameObject.tag == "Fightable") {
hitter.SetTrigger("fightableAttack");
}
rollDamage(w.getDamage(), w.getDamageRolls(), a);
} else {
if(transform.gameObject.tag == "Player") {
hitter.SetTrigger("playerAttack");
} else if(transform.gameObject.tag == "Fightable") {
hitter.SetTrigger("fightableAttack");
}
}
if(w.getTwoAttackRolls()) {
rollAttack();
Debug.Log(e.getName()+" attack roll = "+TattackRoll);
if(TattackRoll == 1) {
Debug.Log(e.getName()+"'s attack critically misses :(");
if(transform.gameObject.tag == "Player") {
hitter.SetTrigger("playerAttack");
} else if(transform.gameObject.tag == "Fightable") {
hitter.SetTrigger("fightableAttack");
}
} else if(TattackRoll < 21 - w.getCriticalRange()) {
rollAttack();
Debug.Log(e.getName()+" critical roll = "+TattackRoll);
if(TattackRoll == 20 || TattackRoll+attackBonus(w) > AC) {
Debug.Log(e.getName()+" lands a critical hit!");
if(w.getTwoCriticalRolls()) {
for(int i = 0; i < w.getSecondAttackCritical(); i++) {
rollDamage(w.getSecondAttackDamage(), w.getDamageRolls(), a);
}
} else {
for(int i = 0; i < w.getCriticalRolls(); i++) {
rollDamage(w.getSecondAttackDamage(), w.getDamageRolls(), a);
}
}
}
try {
hitee = hit.transform.gameObject.GetComponent<Animator>();
if(hit.transform.gameObject.tag == "Player") {
hitee.SetTrigger("playerHit");
}
} catch (Exception ex) {
Debug.Log(ex);
}
if(transform.gameObject.tag == "Player") {
hitter.SetTrigger("playerAttack");
} else if(transform.gameObject.tag == "Fightable") {
hitter.SetTrigger("fightableAttack");
}
rollDamage(w.getSecondAttackDamage(), w.getDamageRolls(), a);
} else if(TattackRoll == 20 || TattackRoll+attackBonus(w) > AC) {
try {
hitee = hit.transform.gameObject.GetComponent<Animator>();
//.........这里部分代码省略.........