|
|
@@ -15,7 +15,7 @@ public class AttackTrigger : MonoBehaviour
|
|
|
public int offsetY = 1;
|
|
|
public float hitRate = 1;
|
|
|
[HideInInspector]public GameObject Miss;
|
|
|
- public float criticalChance; //±©»÷ÂÊ
|
|
|
+
|
|
|
private void Awake()
|
|
|
{
|
|
|
owner = GetComponentInParent<Character>();
|
|
|
@@ -40,6 +40,25 @@ public class AttackTrigger : MonoBehaviour
|
|
|
trigedObjs.Add(hitTrigger);
|
|
|
if (Util.CheckCanHit(owner.tag, hitTrigger.owner.tag) && !hitTrigger.owner.isDie)
|
|
|
{
|
|
|
+ if (Random.Range(0f, 1f) < owner.criticalChance)
|
|
|
+ {
|
|
|
+ hitTrigger.BeHit((int)(damage * owner.criticalMultiplier), force
|
|
|
+ * owner.criticalMultiplier, changeHurt, repelValue);
|
|
|
+ GameObject effect = Instantiate(spiritsAttackEffect);
|
|
|
+ effect.transform.position = new Vector3(hitTrigger.transform.position.x,
|
|
|
+ transform.position.y + offsetY, 0);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ hitTrigger.BeHit(damage, force, changeHurt, repelValue);
|
|
|
+ if (spiritsAttackEffect != null)
|
|
|
+ {
|
|
|
+ GameObject effect = Instantiate(spiritsAttackEffect);
|
|
|
+ effect.transform.position = new Vector3(hitTrigger.transform.position.x,
|
|
|
+ transform.position.y + offsetY, 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /*
|
|
|
if (Random.Range(0f, 1f) < hitRate)
|
|
|
{
|
|
|
hitTrigger.BeHit(damage, force, changeHurt, repelValue);
|
|
|
@@ -55,6 +74,7 @@ public class AttackTrigger : MonoBehaviour
|
|
|
GameObject miss = Instantiate(Miss);
|
|
|
miss.transform.position = transform.position + Vector3.up * 0.5f;
|
|
|
}
|
|
|
+ */
|
|
|
}
|
|
|
}
|
|
|
}
|