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

public class BuildingInterfaceBehavior : MonoBehaviour
{

    public List<Sprite> BuildingSprites;
    public int CurrentBuildingID;

    void Start()
    {

    }

    void Update()
    {

    }

    public void Next()
    {
        CurrentBuildingID++;
        if (CurrentBuildingID == BuildingSprites.Count)
            CurrentBuildingID = 0;
        Apply();
    }

    public void Prev()
    {
        CurrentBuildingID--;
        if (CurrentBuildingID < 0)
            CurrentBuildingID = BuildingSprites.Count - 1;
        Apply();
    }

    private void Apply()
    {
        transform.GetComponent<Image>().sprite = BuildingSprites[CurrentBuildingID];
    }

}
