Files
TheAuction-GS/Assets/EmptyCounter/CounterSelecedVisual.cs

23 lines
775 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CounterSelecedVisual : MonoBehaviour {
[SerializeField] private EmptyCounter _emptyCounter;
[SerializeField] private GameObject _visualCounterSelected;
private void Start() {
//Using start to I can assure the player exists
PlayerController.Instance.GetComponent<InteractionBehaviour>().OnSelectedCounter += OnOnSelectedCounterChange;
}
private void OnOnSelectedCounterChange(object sender, InteractionBehaviour.OnSelectedCounterArgs e) {
if (e.selectedCounter == _emptyCounter) {
_visualCounterSelected.SetActive(true);
}
else {
_visualCounterSelected.SetActive(false);
}
}
}