void Awake() { anim = GetComponent <Animator>(); aHit = GetComponentInChildren <AttackHit>(); attackEffect = aHit.GetComponent <SpriteRenderer>(); weapon = transform.Find("Player Attack Effect"); light2D = attackEffect.GetComponentInChildren <Light2D>(); }
void LaunchAttack(Collider collider) { Collider[] colliders = Physics.OverlapBox(collider.bounds.center, collider.bounds.extents, collider.transform.rotation, LayerMask.GetMask("EnemyHurtbox")); foreach (Collider c in colliders) { if (c.name == "Head") { AttackHit?.Invoke(10); Debug.Log("hit head"); } else if (c.name == "Torso") { AttackHit?.Invoke(7); Debug.Log("hit torso"); } else if (c.name == "Feet") { AttackHit?.Invoke(4); Debug.Log("hit feet"); } } }
void Awake() { current_health = max_health; Shield = GetComponentInChildren<ShieldController>(); AHC = GetComponentInChildren<AttackHit>(); if (Shield != null) HasShield = true; }