Mini demo with all features
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using Unheimlich.Data.Dialogues;
|
||||
using Unheimlich.Data.DetectiveBoard;
|
||||
using Unheimlich.Gameplay.Player;
|
||||
using Unheimlich.Managers;
|
||||
using OctoCore.Localization;
|
||||
|
||||
namespace Unheimlich.Interactions.FloatingWords
|
||||
@@ -17,6 +19,7 @@ namespace Unheimlich.Interactions.FloatingWords
|
||||
|
||||
[Header("Settings")]
|
||||
[SerializeField] private ObjectDescriptionSettings _settings;
|
||||
[SerializeField] private float _raycastDistance = 100f;
|
||||
|
||||
[Header("Anchor")]
|
||||
[SerializeField] private Transform _descriptionAnchor;
|
||||
@@ -24,6 +27,10 @@ namespace Unheimlich.Interactions.FloatingWords
|
||||
[Header("Prefab")]
|
||||
[SerializeField] private ChoiceFocusHandler _wordPrefab;
|
||||
|
||||
[Header("Detective Board Integration")]
|
||||
[Tooltip("Clue to unlock when words are fully merged (optional)")]
|
||||
[SerializeField] private ClueData _clueToUnlock;
|
||||
|
||||
private Transform _playerTransform;
|
||||
private Camera _mainCamera;
|
||||
private List<ChoiceFocusHandler> _spawnedWords = new List<ChoiceFocusHandler>();
|
||||
@@ -42,7 +49,7 @@ namespace Unheimlich.Interactions.FloatingWords
|
||||
|
||||
void Start()
|
||||
{
|
||||
_playerTransform = Player.Instance.transform;
|
||||
_playerTransform = PlayerController.Instance.transform;
|
||||
_mainCamera = Camera.main;
|
||||
|
||||
if (_playerTransform == null)
|
||||
@@ -113,7 +120,8 @@ namespace Unheimlich.Interactions.FloatingWords
|
||||
{
|
||||
dummyChoices.Add(new DialogueChoiceData
|
||||
{
|
||||
ChoiceText = _descriptionTextLocalized,
|
||||
ChoiceText = null,
|
||||
ChoiceTextOverride = descText,
|
||||
NextNode = null
|
||||
});
|
||||
}
|
||||
@@ -162,7 +170,7 @@ namespace Unheimlich.Interactions.FloatingWords
|
||||
|
||||
bool isHoveringObject = false;
|
||||
|
||||
if (Physics.Raycast(ray, out hit, 100f, layerMask))
|
||||
if (Physics.Raycast(ray, out hit, _raycastDistance, layerMask))
|
||||
{
|
||||
if (hit.collider.gameObject == gameObject || hit.collider.transform.IsChildOf(transform))
|
||||
isHoveringObject = true;
|
||||
@@ -266,12 +274,22 @@ namespace Unheimlich.Interactions.FloatingWords
|
||||
.setOnComplete(() =>
|
||||
{
|
||||
_hasCompletedMergeOnce = true;
|
||||
UnlockClue();
|
||||
DespawnWords();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UnlockClue()
|
||||
{
|
||||
if (_clueToUnlock != null && DetectiveBoardManager.Instance != null)
|
||||
{
|
||||
DetectiveBoardManager.Instance.UnlockClue(_clueToUnlock);
|
||||
Debug.Log($"[ObjectDescription] Unlocked clue: {_clueToUnlock.name} from description merge");
|
||||
}
|
||||
}
|
||||
|
||||
private void UnmergeWords()
|
||||
{
|
||||
if (!_isMerged) return;
|
||||
|
||||
Reference in New Issue
Block a user