本文整理汇总了C#中Entities.setMp方法的典型用法代码示例。如果您正苦于以下问题:C# Entities.setMp方法的具体用法?C# Entities.setMp怎么用?C# Entities.setMp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entities
的用法示例。
在下文中一共展示了Entities.setMp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Heal
public void Heal(Entities t){
//GameObject tar = gm.localPlayer.GetComponent<PlayerHandler> ().Target;
if (t != null) {
//Entities t = tar.GetComponent<Entities> (); // Figure out how abstract works better
// i.Special is to check if percentage is used. Special is a bool to indicate a special case.
// This section checks what item type it is, then goes ahead and does the appropriate calculations.
// t is the PlayerHandler script of the targeted player.
// Maybe add healing enemy functionality?
if ((ItemType)type == ItemType.HP) {
if (Special) {
// Divided by 100f because if it were only by 100 it would not work. It needs to be read as a float.
t.setHp((int)((Amt / 100f) * t.MaxHp));
} else {
t.setHp(Amt);
}
} else if ((ItemType)type == ItemType.MP) {
if (Special) {
t.setMp((int)((Amt / 100f) * t.MaxMp));
} else {
t.setMp(Amt);
}
}
Quantity -= 1;
} else {
Debug.Log("Target is not valid!");
}
}
示例2: skillAction
public void skillAction(Entities user, Entities[] tar, bool hit){
if (MpCost > 0 && HpCost > 0) {
if (user.getHp() >= HpCost) {
user.setHp(-HpCost);
} else {
Debug.Log ("Not enough HP!");
return;
}
if (user.getMp() >= MpCost) {
user.setMp(-MpCost);
} else {
Debug.Log ("Not enough MP!");
return;
}
} else if (HpCost > 0) {
if (user.getHp() >= HpCost) {
user.setHp(-HpCost);
} else {
Debug.Log ("Not enough HP!");
return;
}
} else if (MpCost > 0) {
if (user.getMp() >= MpCost) {
user.setMp(-MpCost);
} else {
Debug.Log ("Not enough MP!");
return;
}
}
// If it hit, do damage.
if (hit) {
if (DamageType == damage_type.single) {
if (DamageEffect == damage_effect.hp) {
tar [0].setHp(-(Damage - (tar [0].End / 3)));
} else if (DamageEffect == damage_effect.mp) {
tar [0].setMp( -(Damage - (tar [0].End / 3)));
} else {
Debug.Log ("TURN DAMAGER NOT IMPLEMENTED YET");
}
} else if (DamageType == damage_type.aoe) {
foreach (Entities e in tar) {
if (DamageEffect == damage_effect.hp) {
e.setHp(-(Damage - (e.End / 3)));
} else if (DamageEffect == damage_effect.mp) {
e.setMp( -(Damage - (e.End / 3)));
} else {
Debug.Log ("TURN DAMAGER NOT IMPLEMENTED YET");
}
}
} else if (DamageType == damage_type.dot) {
Debug.Log ("Turn based effects not implemented yet");
}
user.Damage = Damage;
}
}