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

public class TilePlacementButton : UnitPlacementButton
{
    public LevelTile tile;
    protected override void Place()
    {
        var placeholder = new GameObject(tile.name);
        var comp = placeholder.AddComponent<TilePlaceholder>();
        comp.Tile = tile;
        var rend = placeholder.AddComponent<SpriteRenderer>();
        rend.sprite = tile.Sprite;
        rend.sortingLayerName = "Character";
        rend.sortingOrder = 2;

        var outline = new GameObject("Outline");
        rend = outline.AddComponent<SpriteRenderer>();
        rend.sortingLayerName = "Character";
        rend.sortingOrder = 2;

        outline.transform.SetParent(placeholder.transform);
        outline.transform.localPosition = Vector2.zero;
        outline.transform.localScale = Vector2.one * 1.1f;

        comp.Outline = outline.transform;

    }
}
