void Attack(Slashing slash) { int numVictims = Physics2D.LinecastNonAlloc(slash.startPoint, slash.endPoint, slashResults, slashMask); for (int i = 0; i < numVictims; i++) { Enemy_Controller victim = slashResults[i].collider.GetComponent <Enemy_Controller>(); if (victim.InputUserSlash((slash.endPoint - slash.startPoint).normalized)) { // hit UISlashShow.Slash(Vector2.Lerp(slash.endPoint, slash.startPoint, 0.5f), (slash.endPoint - slash.startPoint).normalized); if (victim.CompareTag("BasicEnemy")) { Player_Controller.instance.Attack(victim); } } else { if (victim.CompareTag("BasicEnemy")) { Player_Controller.instance.Attack(victim); } } } }
void Awake() { instance = this; }