Advanced POC - portals, dialogue system + floating words, room loading

This commit is contained in:
2026-01-26 20:31:27 +01:00
parent b5ca4763b3
commit 203b00578a
426 changed files with 123482 additions and 29 deletions
@@ -0,0 +1,102 @@
using UnityEngine;
using Unheimlich.Interactions.Core;
using Unheimlich.Interactions.FloatingWords;
namespace Unheimlich.Gameplay.Items
{
/// <summary>
/// Interactable item that can be picked up and examined closely by the player.
/// Temporarily moves to inspection position and allows rotation via look input.
/// </summary>
[RequireComponent(typeof(Collider), typeof(Rigidbody))]
public class InspectableItem : InteractableBase
{
[Header("Inspection Settings")]
[SerializeField] private float _inspectionDistance = 1f;
[SerializeField] private float _rotationSpeed = 100f;
[Header("Animation Settings")]
[SerializeField] private bool _blockInteractionDuringAnimation = true;
private Vector3 _originalPosition;
private Quaternion _originalRotation;
private Transform _originalParent;
private Rigidbody _rigidbody;
private bool _isAnimationPlaying = false;
private ObjectDescriptionTrigger _objectDescriptionTrigger;
public bool IsAnimationPlaying => _isAnimationPlaying;
private void Start()
{
_rigidbody = GetComponent<Rigidbody>();
_rigidbody.isKinematic = true;
_originalPosition = transform.position;
_originalRotation = transform.rotation;
_originalParent = transform.parent;
_objectDescriptionTrigger = GetComponent<ObjectDescriptionTrigger>();
}
public override void Interact(GameObject interactor)
{
if (_blockInteractionDuringAnimation)
{
if (_isAnimationPlaying)
return;
if (_objectDescriptionTrigger != null &&
_objectDescriptionTrigger.IsInMergeOnceMode &&
_objectDescriptionTrigger.IsAnimationActive)
{
return;
}
}
if (PlayerInspectionHandler.Instance != null)
PlayerInspectionHandler.Instance.ToggleInspection(this);
}
public void SetAnimationState(bool isPlaying)
{
_isAnimationPlaying = isPlaying;
}
/// <summary>
/// Prepares the item for inspection by parenting it to the hold point and making it kinematic.
/// </summary>
public void PrepareForInspection(Transform holdPoint)
{
_originalPosition = transform.position;
_originalRotation = transform.rotation;
_originalParent = transform.parent;
_rigidbody.isKinematic = true;
transform.SetParent(holdPoint);
transform.localPosition = Vector3.forward * _inspectionDistance;
transform.localRotation = Quaternion.identity;
}
public void Release()
{
transform.SetParent(_originalParent);
transform.position = _originalPosition;
transform.rotation = _originalRotation;
_rigidbody.isKinematic = true;
}
public float RotationSpeed => _rotationSpeed;
private void OnEnable()
{
LeanTween.init();
}
private void OnDestroy()
{
LeanTween.cancel(gameObject);
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: cd19509bd29a28648a08eaf7f6146ef1