﻿using TMPro;
using UnityEngine;

public class PositionText : MonoBehaviour
{
    [SerializeField] DotProductDisplay _dotProductDisplay;
    [SerializeField] TMP_Text _text;

    void OnValidate()
    {
        _dotProductDisplay = FindObjectOfType<DotProductDisplay>();
        _text = GetComponent<TMP_Text>();
    }

    void Update()
    {
        if (_dotProductDisplay.Behind)
            _text.SetText("Behind");
        else if (_dotProductDisplay.InFront)
            _text.SetText("In Front!");
        else
            _text.SetText("");
    }
}