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

public abstract class StructureController : MonoBehaviour
{
    [Tooltip("The maximum development level for the structure")]
    public int MaxLevel = 1;
    [Tooltip("The initial development level for the structure (0-MaxLevel)")]
    public int StartingLevel = 1;
    [Tooltip("The current durability level for the structure (0-100")]
    public int Durability = 1;
    public GameObject Halo;
    public Sprite ReadyHalo;
    public Sprite ActiveHalo;
    private const string Necromancer = "Necromancer";

    public bool Active { get; set; }


    // Awake is called when object initializes
    void Awake()
    {
    }

    // Update is called once per frame
    void Update()
    {
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        Debug.Log($"{this.name}:{collision.name} entered {this.name} space.");
        if(collision.name == Necromancer)
            SetActive();
    }

    private void OnTriggerExit2D(Collider2D collision)
    {
        Debug.Log($"{this.name}:{collision.name} exited {this.name} space.");
        if (collision.name == Necromancer)
            SetInactive();
    }
    public void SetActive() {
        Active = true;
        Halo.SetActive(Active);
    }  
    public void SetInactive() {
        Active = false;
        Halo.SetActive(Active);
    }

    public abstract bool PlayerAction(Necromancer player);
}
