Как исправить чтобы код работал , атака бота и нанесение урона игроку
The type or namespace name 'Player' could not be found (are you missing a using directive or an assembly reference ?) вылазит ошибка , всё проверял ничего не работает , вот код всё проверил и тег на игрока поставил , не работает. Проверял имя игра переписывал код но не выходит. Как исправить чтобы код работал , атака бота и нанесение урона игроку.
private float timeBtwAttack;
public float startTimeBtwAttack;
public int health;
public float speed;
public GameObject deathEffect;
public int damage;
private float stopTime;
public float startStopTime;
public float normalSpeed;
private Player player;
private Animator anim;
private void Start()
{
anim = GetComponent<Animator>();
player = FindObjectOfType<Player>();
normalSpeed = speed;
}
private void Update()
{
if(stopTime <= 0)
{
speed = normalSpeed;
}
else
{
speed = 0;
stopTime -= Time.deltaTime;
}
if(health <= 0)
{
Destroy(gameObject);
}
transform.Translate(Vector2.left * speed * Time.deltaTime);
}
public void TakeDamage(int damage)
{
Instantiate(deathEffect, transform.position, Quaternion.identity);
health -= damage;
}
public void OnTriggerStay2D(Collider2D other)
{
if (other.CompareTag("Player"))
{
if(timeBtwAttack <= 0)
{
anim.SetTrigger("attack");
}
else
{
timeBtwAttack -= Time.deltaTime;
}
}
}
public void OnEnemyAttack()
{
}
}
Источник: Stack Overflow на русском