using UnityEngine;

[SelectionBase]
public sealed class NavigationPointView : MonoBehaviour
{
    [SerializeField]
    private TextMesh textLabel = null;
    [SerializeField]
    private MeshRenderer meshRenderer = null;
    [SerializeField]
    private FactionDataProvider factions = null;
    public NavigationPoint Point { get; private set; }

    public void Init(NavigationPoint point) {
        Point = point;
        name = $"nav_point_{point.Id}";
        transform.position = point.SystemPostition;
        if (textLabel != null)
            textLabel.text = point.GetMarkerLetter();
        if (meshRenderer != null)
            meshRenderer.material.color = factions[point.FactionId].Color;
    }
}