using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Creature : MonoBehaviour
{
    [SerializeField] private float creatureSize = 50f;
    [SerializeField] protected float disappearTimerMax;

    private float disappearTimer;

    //[SerializeField] private float disappearDistance = 1000f;
    //[SerializeField] private float detTimerMax = 5f;
    //private float detTimer;

    private CircleCollider2D creatureColider;

    private void Awake()
    {
        creatureColider = GetComponent<CircleCollider2D>();
    }

    protected virtual void Start()
    {
        creatureColider.radius = creatureSize;
        disappearTimer = disappearTimerMax;
    }

    protected virtual void Update()
    {
        HandleDisappear();
    }

    private void HandleDisappear()
    {
        disappearTimer -= Time.deltaTime;
        if(disappearTimer < 0)
        {
            Destroy(gameObject);
            Debug.Log("Selfdes");
        }
    }
}
