Add items, Pickup logic works
This commit is contained in:
23
Assets/EmptyCounter/CounterSelecedVisual.cs
Normal file
23
Assets/EmptyCounter/CounterSelecedVisual.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user