Also fix the clear counter spawning items, next I'm going to implament the logic for placing food onto them instead.
42 lines
982 B
C#
42 lines
982 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class SelectedCounterVisual : MonoBehaviour
|
|
{
|
|
|
|
[SerializeField] private BaseCounter baseCounter;
|
|
[SerializeField] private GameObject[] visualGameObjectArray;
|
|
|
|
private void Start()
|
|
{
|
|
Player.Instance.OnSelectedcounterChanged += Player_OnSelectedcounterChanged;
|
|
}
|
|
|
|
private void Player_OnSelectedcounterChanged(object sender, Player.OnSelectedCounterChangedEventArgs e)
|
|
{
|
|
if (e.selectedCounter == baseCounter)
|
|
{
|
|
Show();
|
|
} else
|
|
{
|
|
Hide();
|
|
}
|
|
}
|
|
|
|
private void Show()
|
|
{
|
|
foreach (GameObject visualGameObject in visualGameObjectArray)
|
|
{
|
|
visualGameObject.SetActive(true);
|
|
}
|
|
}
|
|
|
|
private void Hide()
|
|
{
|
|
foreach (GameObject visualGameObject in visualGameObjectArray)
|
|
{
|
|
visualGameObject.SetActive(false);
|
|
}
|
|
}
|
|
}
|