static public void DoAttack(GameObject attacker, GameObject defender, int skillIndex) { AttackComponent attackerCom = attacker.GetComponent <Basic>().attackCom; if (defender == null || (skillIndex >= skillListSize && skillIndex < 0)) { return; } AttackComponent defenderCom = defender.GetComponent <Basic>().attackCom; if (attackerCom.skillListRegistered[skillIndex]) { AttackInfo attackInfo = attackerCom.attackSkillList[skillIndex](); attackerCom.attackSkillEffectList[skillIndex](); float resist = defenderCom.GetResistance(attackInfo.attackType); float tempDamage = (1.0f - resist) * (float)attackInfo.attackPoint; if ((int)(attackInfo.attackType & AttackType.physics) != 0) { int dfdpoint = defenderCom.GetDefend(); tempDamage = (tempDamage > dfdpoint) ? tempDamage - dfdpoint : 0; } //Debug.Log("Damage:" + (int)tempDamage); defender.GetComponent <Basic>().ChangeHealth(-(int)tempDamage); } }