48 lines
1.1 KiB
C#
48 lines
1.1 KiB
C#
using BNG;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class MonumentPreviewController : MonoBehaviour
|
|
{
|
|
private Grabbable _grabbable;
|
|
private MonumentMini _monumentMini;
|
|
private MonumentPreview _monumentPreview;
|
|
|
|
private MonumentPreviewSound _previewSound;
|
|
|
|
private void Awake()
|
|
{
|
|
_previewSound = FindObjectOfType<MonumentPreviewSound>();
|
|
|
|
_grabbable = GetComponent<Grabbable>();
|
|
_monumentMini = GetComponent<MonumentMini>();
|
|
_monumentPreview = GetComponent<MonumentPreview>();
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
_grabbable.OnUniqueGrabbed.AddListener(OnGrab);
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
_grabbable.OnUniqueGrabbed.RemoveListener(OnGrab);
|
|
}
|
|
|
|
private void OnGrab(Grabber arg)
|
|
{
|
|
_monumentPreview.ShowInfo(_monumentMini.Info);
|
|
_previewSound.PlaySound(_monumentMini.Info.ShortClip);
|
|
}
|
|
|
|
#if UNITY_EDITOR
|
|
[ContextMenu("Debug show preview")]
|
|
private void DebugShow()
|
|
{
|
|
OnGrab(null);
|
|
}
|
|
#endif
|
|
}
|