|
@@ -7,11 +7,8 @@ public class DashEffect : MonoBehaviour
|
|
|
{
|
|
{
|
|
|
public bool canHit;
|
|
public bool canHit;
|
|
|
public bool isEnemy;
|
|
public bool isEnemy;
|
|
|
- public bool isDash;
|
|
|
|
|
- public bool isDashAttack;
|
|
|
|
|
public AttackInfo attackInfo;
|
|
public AttackInfo attackInfo;
|
|
|
public List<Character> beHitTriggers = new List<Character>();
|
|
public List<Character> beHitTriggers = new List<Character>();
|
|
|
- public List<GameObject> enemy = new List<GameObject>();
|
|
|
|
|
public float offset;
|
|
public float offset;
|
|
|
public GameObject rushEffect;
|
|
public GameObject rushEffect;
|
|
|
public float targetY;
|
|
public float targetY;
|
|
@@ -29,77 +26,46 @@ public class DashEffect : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
private void Update()
|
|
private void Update()
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
if (canHit)
|
|
if (canHit)
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
- transform.gameObject.SetActive(false);
|
|
|
|
|
|
|
+ for (int i = 0; i < beHitTriggers.Count; i++)
|
|
|
|
|
+ {
|
|
|
|
|
+ DashAttack(beHitTriggers[i]);
|
|
|
|
|
+ }
|
|
|
|
|
+ beHitTriggers = new List<Character>();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- //private void Update()
|
|
|
|
|
- //{
|
|
|
|
|
- // if (canHit)
|
|
|
|
|
- // {
|
|
|
|
|
- // for (int i = 0; i < beHitTriggers.Count; i++)
|
|
|
|
|
- // {
|
|
|
|
|
- // beHitTriggers[i].BeHit(damage, force, changeHurt, repelValue);
|
|
|
|
|
- // }
|
|
|
|
|
-
|
|
|
|
|
- // transform.parent.gameObject.SetActive(false);
|
|
|
|
|
- // }
|
|
|
|
|
- // else
|
|
|
|
|
- // {
|
|
|
|
|
-
|
|
|
|
|
- // for (int i = 0; i < enemy.Count; i++)
|
|
|
|
|
- // {
|
|
|
|
|
-
|
|
|
|
|
- // enemy[i].transform.position = transform.position + Vector3.right * offset;
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
- //}
|
|
|
|
|
- //private void OnTriggerStay(Collider other)
|
|
|
|
|
- //{
|
|
|
|
|
- // if (isDash)
|
|
|
|
|
- // {
|
|
|
|
|
- // if (isEnemy && (other.gameObject.layer == 6 || other.gameObject.layer == 7)
|
|
|
|
|
- // && other.name == "BodyCollider")
|
|
|
|
|
- // {
|
|
|
|
|
- // Character character = other.GetComponentInParent<Character>();
|
|
|
|
|
- // DashAttack(character);
|
|
|
|
|
- // }
|
|
|
|
|
- // isDash = false;
|
|
|
|
|
- // }
|
|
|
|
|
- //}
|
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
private void OnTriggerEnter(Collider other)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
if(!isEnemy && other.gameObject.layer == 8 && other.name == "BodyCollider")
|
|
if(!isEnemy && other.gameObject.layer == 8 && other.name == "BodyCollider")
|
|
|
{
|
|
{
|
|
|
Character character = other.GetComponentInParent<Character>();
|
|
Character character = other.GetComponentInParent<Character>();
|
|
|
- beHitTriggers.Add(character);
|
|
|
|
|
- //enemy.Add(other.transform.parent.parent.parent.gameObject);
|
|
|
|
|
- DashAttack(character);
|
|
|
|
|
|
|
+ if (!beHitTriggers.Exists(t => t == character))
|
|
|
|
|
+ {
|
|
|
|
|
+ beHitTriggers.Add(character);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
if (isEnemy && (other.gameObject.layer == 6|| other.gameObject.layer == 7)
|
|
if (isEnemy && (other.gameObject.layer == 6|| other.gameObject.layer == 7)
|
|
|
&& other.name == "BodyCollider")
|
|
&& other.name == "BodyCollider")
|
|
|
{
|
|
{
|
|
|
Character character = other.GetComponentInParent<Character>();
|
|
Character character = other.GetComponentInParent<Character>();
|
|
|
- //beHitTriggers.Add(character);
|
|
|
|
|
- //enemy.Add(other.transform.parent.parent.parent.gameObject);
|
|
|
|
|
- if (isDashAttack)
|
|
|
|
|
|
|
+ if(!beHitTriggers.Exists(t => t == character))
|
|
|
{
|
|
{
|
|
|
- DashAttack(character);
|
|
|
|
|
|
|
+ beHitTriggers.Add(character);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
private void OnTriggerExit(Collider other)
|
|
private void OnTriggerExit(Collider other)
|
|
|
{
|
|
{
|
|
|
if (other.gameObject.layer == 8 && other.name == "BodyCollider")
|
|
if (other.gameObject.layer == 8 && other.name == "BodyCollider")
|
|
|
{
|
|
{
|
|
|
- beHitTriggers.Remove(other.GetComponentInParent<Character>());
|
|
|
|
|
- //enemy.Add(other.transform.parent.parent.parent.gameObject);
|
|
|
|
|
|
|
+ Character character = other.GetComponentInParent<Character>();
|
|
|
|
|
+ if (beHitTriggers.Exists(t => t == character))
|
|
|
|
|
+ {
|
|
|
|
|
+ beHitTriggers.Remove(character);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
public void DashAttack(Character character)
|
|
public void DashAttack(Character character)
|