|
@@ -6,19 +6,34 @@ using UnityEngine;
|
|
|
public class DashEffect : MonoBehaviour
|
|
public class DashEffect : MonoBehaviour
|
|
|
{
|
|
{
|
|
|
public bool canHit;
|
|
public bool canHit;
|
|
|
- public int damage;
|
|
|
|
|
- public Vector3 force;
|
|
|
|
|
- public bool changeHurt;
|
|
|
|
|
- public float repelValue;
|
|
|
|
|
|
|
+ public bool isEnemy;
|
|
|
|
|
+ public bool isDash;
|
|
|
|
|
+ public bool isDashAttack;
|
|
|
|
|
+ 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 List<GameObject> enemy = new List<GameObject>();
|
|
|
public float offset;
|
|
public float offset;
|
|
|
public GameObject rushEffect;
|
|
public GameObject rushEffect;
|
|
|
public float targetY;
|
|
public float targetY;
|
|
|
|
|
+ private void Awake()
|
|
|
|
|
+ {
|
|
|
|
|
+ if (isEnemy)
|
|
|
|
|
+ {
|
|
|
|
|
+ attackInfo = GetComponentInParent<Enemy>().attack1Infos[0];
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ attackInfo = GetComponentInParent<Demonic>().attack1Infos[0];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
private void Update()
|
|
private void Update()
|
|
|
{
|
|
{
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
if (canHit)
|
|
if (canHit)
|
|
|
{
|
|
{
|
|
|
|
|
+
|
|
|
transform.gameObject.SetActive(false);
|
|
transform.gameObject.SetActive(false);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -43,16 +58,56 @@ public class DashEffect : MonoBehaviour
|
|
|
// }
|
|
// }
|
|
|
// }
|
|
// }
|
|
|
//}
|
|
//}
|
|
|
|
|
+ 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(other.gameObject.layer == 8 && other.name == "BodyCollider")
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if(!isEnemy && other.gameObject.layer == 8 && other.name == "BodyCollider")
|
|
|
|
|
+ {
|
|
|
|
|
+ Character character = other.GetComponentInParent<Character>();
|
|
|
|
|
+ beHitTriggers.Add(character);
|
|
|
|
|
+ //enemy.Add(other.transform.parent.parent.parent.gameObject);
|
|
|
|
|
+ DashAttack(character);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (isEnemy && (other.gameObject.layer == 6|| other.gameObject.layer == 7)
|
|
|
|
|
+ && other.name == "BodyCollider")
|
|
|
{
|
|
{
|
|
|
- //beHitTriggers.Add(other.GetComponentInParent<Character>());
|
|
|
|
|
|
|
+ Character character = other.GetComponentInParent<Character>();
|
|
|
|
|
+ //beHitTriggers.Add(character);
|
|
|
//enemy.Add(other.transform.parent.parent.parent.gameObject);
|
|
//enemy.Add(other.transform.parent.parent.parent.gameObject);
|
|
|
- other.GetComponentInParent<Character>().BeHit(damage, force, changeHurt, repelValue);
|
|
|
|
|
- GameObject effect = Instantiate(rushEffect);
|
|
|
|
|
- effect.transform.position = new Vector3(other.transform.position.x,
|
|
|
|
|
- transform.position.y + targetY,0);
|
|
|
|
|
|
|
+ if (isDashAttack)
|
|
|
|
|
+ {
|
|
|
|
|
+ DashAttack(character);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ private void OnTriggerExit(Collider other)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (other.gameObject.layer == 8 && other.name == "BodyCollider")
|
|
|
|
|
+ {
|
|
|
|
|
+ beHitTriggers.Remove(other.GetComponentInParent<Character>());
|
|
|
|
|
+ //enemy.Add(other.transform.parent.parent.parent.gameObject);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ public void DashAttack(Character character)
|
|
|
|
|
+ {
|
|
|
|
|
+ character.BeHit(attackInfo.damage,attackInfo.force * attackInfo.attackDir * offset,
|
|
|
|
|
+ attackInfo.changeHurt,attackInfo.repelValue);
|
|
|
|
|
+ GameObject effect = Instantiate(rushEffect);
|
|
|
|
|
+ effect.transform.position = new Vector3(character.transform.position.x,
|
|
|
|
|
+ transform.position.y + targetY, 0);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|