rabidus-test/Assets/Scripts/MonumentMini.cs

42 lines
887 B
C#
Raw Permalink Normal View History

2023-11-08 16:21:39 +03:00
using BNG;
2023-09-11 15:44:17 +03:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MonumentMini : MonoBehaviour
{
public MonumentInfo Info;
2023-11-08 16:21:39 +03:00
private Grabbable _grabbable;
private VFXController _vFXController;
private void Awake()
{
_vFXController = FindObjectOfType<VFXController>();
_grabbable = GetComponent<Grabbable>();
}
private void OnEnable()
{
_grabbable.OnUniqueGrabbed.AddListener(ShowVFX);
_grabbable.OnReleased.AddListener(HideVFX);
}
private void OnDisable()
{
_grabbable.OnUniqueGrabbed.RemoveListener(ShowVFX);
_grabbable.OnReleased.RemoveListener(HideVFX);
}
private void ShowVFX(Grabber grabber)
{
_vFXController.ShowVFX(transform);
}
private void HideVFX(Grabber grabber)
{
_vFXController.HideVFX();
}
2023-09-11 15:44:17 +03:00
}