что нужно изменить чтобы срабатывал TakeDamage
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BossWeapon : MonoBehaviour
{
[SerializeField] private float damage;
public int enragedAttackDamage = 40;
public Vector3 attackOffset;
public float attackRange = 1;
public LayerMask attackMask;
public void Attack()
{
Vector3 pos = transform.position;
pos += transform.right * attackOffset.x;
pos += transform.up * attackOffset.y;
Collider2D colision = Physics2D.OverlapCircle(pos, attackRange, attackMask);
if (colision.tag == "Player")
{
colision.GetComponent<Health>().TakeDamage(damage);
}
}
public void EnragedAttack()
{
Vector3 pos = transform.position;
pos += transform.right * attackOffset.x;
pos += transform.up * attackOffset.y;
Collider2D colInfo = Physics2D.OverlapCircle(pos, attackRange, attackMask);
if (colInfo != null)
{
//colInfo.GetComponent<PlayerHealth>().TakeDamage(enragedAttackDamage);
}
}
void OnDrawGizmosSelected()
{
Vector3 pos = transform.position;
pos += transform.right * attackOffset.x;
pos += transform.up * attackOffset.y;
Gizmos.DrawWireSphere(pos, attackRange);
}
}