private void Update() { if (isGrounded && !isAttacking) State = States.idle;
if (!isAttacking && Input.GetButton("Horizontal")) run(); if (!isAttacking && isGrounded && Input.GetButtonDown("Jump")) Jump(); if (Input.GetButtonDown("Fire1")) Attack();
второй скрипт
public virtual void GetDamage() { lives--; if (lives < 1) Die();
Скрипт
private bool isAttacking = false;
private bool isRecharged = true;
public Transform attackPos;
public float attackRange;
public LayerMask enemy;
Класс для монтсров выбрал
private void Update()
{
if (isGrounded && !isAttacking) State = States.idle;
if (!isAttacking && Input.GetButton("Horizontal"))
run();
if (!isAttacking && isGrounded && Input.GetButtonDown("Jump"))
Jump();
if (Input.GetButtonDown("Fire1"))
Attack();
второй скрипт
public virtual void GetDamage()
{
lives--;
if (lives < 1)
Die();
}