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

public partial class AttackController : MonoBehaviour
{
    private PlayerController _playerController;
    private Collider _weapon;
    private List<Collider> _hitTargets = new List<Collider>();

    private void Awake()
    {
        _weapon = GetComponent<Collider>();
        _playerController = GetComponentInParent<PlayerController>();
        
        if (_weapon == null)
        {
            Debug.LogError("Weapon Collider not found!");
        }
        else
        {
            _weapon.isTrigger = true; // Ensure the collider is set as a trigger
        }

    }

    private void Start()
    {
        
    }

    private void OnTriggerEnter(Collider other)
    {
        throw new NotImplementedException();
    }


    private void DisableCollider()
    {
    }
}

public partial class AttackController
{
    public void EnableCollider()
    {
        if (_weapon != null)
        {
            _weapon.enabled = true;
            _hitTargets.Clear(); // Clear previous hit targets when enabling
        }
        
        
        if (_playerController == null)
        {
            Debug.LogError("PlayerController not found in parent!");
        }
        else
        {
            Debug.Log($"{_playerController.Status.AtkSpeed}");
        }
    }

    private void OnTriggerExit(Collider other)
    {
        if (_weapon != null && other == _weapon)
        {
            _weapon.enabled = false;
        }
    }
}