本文整理汇总了C#中Entities.Attack方法的典型用法代码示例。如果您正苦于以下问题:C# Entities.Attack方法的具体用法?C# Entities.Attack怎么用?C# Entities.Attack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entities
的用法示例。
在下文中一共展示了Entities.Attack方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: handleChoices
IEnumerator handleChoices(GameObject[] ents, int unitCount, int i){
bool done = false;
for (int p = 0; p < unitCount; p++) {
done = false;
// It goes through the null slots too.
// The try prevents a crash for null slots.
if (ents [p] != null) {
try {
entity = ents [p].GetComponent<Entities> ();
if (entity.Choice == i) {
hit = entity.accuracyCheck ();
if (entity.Target != null){
switch (entity.Choice) {
case Entities.CHOICE_ATTACK:
entity.Attack (hit);
//Debug.Log("" + entity.ToString() + " Choice: ATTACK");
break;
case Entities.CHOICE_DEFEND:
entity.Defend ();
//Debug.Log("" + entity.ToString() + " Choice: DEFEND");
break;
case Entities.CHOICE_ITEM:
entity.Item ();
//Debug.Log("" + entity.ToString() + " Choice: ITEM");
break;
case Entities.CHOICE_SKILL:
entity.Skill (hit);
//Debug.Log("" + entity.ToString() + " Choice: SKILL");
break;
default:
Debug.Log("" + entity.ToString() + " Choice: ERROR");
break;
}
if (entity.Damage > 0 && hit) {
floatingNumbers (entity.Damage.ToString (), entity.Target.transform.position);
Debug.Log ("Hit! " + entity.Damage);
}
if (!hit) {
floatingNumbers ("Miss!", entity.Target.transform.position);
}
//Debug.Log ("" + entity.ToString () + " || " + entity.Choice);
done = true;
}
}
} catch (Exception ex) {
Debug.Log (ex);
}
if (done == true) {
yield return new WaitForSeconds (1.5f);
}
done = false;
}
}
}