|
|
@@ -13,6 +13,7 @@ public class AttackTrigger : MonoBehaviour
|
|
|
public float repelValue;
|
|
|
public GameObject spiritsAttackEffect;
|
|
|
public int offsetY = 1;
|
|
|
+ public float hitRate = 1;
|
|
|
private void Awake()
|
|
|
{
|
|
|
owner = GetComponentInParent<Character>();
|
|
|
@@ -37,14 +38,19 @@ public class AttackTrigger : MonoBehaviour
|
|
|
trigedObjs.Add(hitTrigger);
|
|
|
if (Util.CheckCanHit(owner.tag, hitTrigger.owner.tag) && !hitTrigger.owner.isDie)
|
|
|
{
|
|
|
- hitTrigger.BeHit(damage, force, changeHurt, repelValue);
|
|
|
- if (spiritsAttackEffect != null)
|
|
|
+ if (Random.Range(0, 1) < hitRate)
|
|
|
{
|
|
|
- GameObject effect = Instantiate(spiritsAttackEffect);
|
|
|
- effect.transform.position = new Vector3(hitTrigger.transform.position.x,
|
|
|
- transform.position.y + offsetY, 0);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|