using UnityEngine;
public abstract class UnitPlaceholder : DraggablePlaceholder
{
    public int Food { get; set; }
    public int Rock { get; set; }
    public int Wood { get; set; }

    public override void Place()
    {
        ResourceManager.Instance.Remove(Rock, Wood, Food);
        WasPlaced?.Invoke(this);
    }

    public override bool CanBePlacedHere()
    {
        return base.CanBePlacedHere() && ResourceManager.Instance.EnoughFor(Rock, Wood, Food) 
            && !LevelManager.Instance.Has<ILevelObject>(obj => obj.Position.IsContainedIn(transform.position));
    }

    public event System.Action<UnitPlaceholder> WasPlaced;
}