|
|
@@ -11,30 +11,14 @@ public class AttackTrigger : MonoBehaviour
|
|
|
public Vector3 force;
|
|
|
public bool changeHurt;
|
|
|
public float repelValue;
|
|
|
- public GameObject spiritsAttackEffect;
|
|
|
public int offsetY = 1;
|
|
|
public float hitRate = 1;
|
|
|
- [HideInInspector]public GameObject Miss;
|
|
|
- public float criticalRandom;
|
|
|
- public bool isRandom;
|
|
|
|
|
|
private void Awake()
|
|
|
{
|
|
|
owner = GetComponentInParent<Character>();
|
|
|
|
|
|
}
|
|
|
- private void Update()
|
|
|
- {
|
|
|
- if (!isRandom)
|
|
|
- {
|
|
|
- criticalRandom = Random.Range(0f, 1f);
|
|
|
- isRandom = true;
|
|
|
- }
|
|
|
- }
|
|
|
- private void OnDisable()
|
|
|
- {
|
|
|
- isRandom = false;
|
|
|
- }
|
|
|
private void OnTriggerEnter(Collider other)
|
|
|
{
|
|
|
BeHitTrigger hitTrigger = other.GetComponent<BeHitTrigger>();
|
|
|
@@ -54,25 +38,7 @@ public class AttackTrigger : MonoBehaviour
|
|
|
trigedObjs.Add(hitTrigger);
|
|
|
if (Util.CheckCanHit(owner.tag, hitTrigger.owner.tag) && !hitTrigger.owner.isDie)
|
|
|
{
|
|
|
- if (criticalRandom < 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);
|
|
|
- }
|
|
|
- }
|
|
|
+ hitTrigger.BeHit(damage, force, changeHurt, repelValue);
|
|
|
/*
|
|
|
if (Random.Range(0f, 1f) < hitRate)
|
|
|
{
|