clean : deleted all useless scripts

This commit is contained in:
2026-05-26 15:57:53 +01:00
parent a6d3ab2f8a
commit 32172f4437
121 changed files with 48 additions and 8108 deletions
@@ -1,67 +0,0 @@
using UnityEngine;
using Unheimlich.Core;
using Unheimlich.Core.Utils;
using InputManager = Unheimlich.Core.Input.InputManager;
namespace Unheimlich.Core.Interaction
{
public class InteractionHandler : Singleton<InteractionHandler>
{
[Header("Settings")]
[SerializeField] private float _interactionRange = 1f;
[SerializeField] private LayerMask _interactableLayers;
[SerializeField] private float _raycastInterval = 0.1f;
private InteractableBase _currentInteractable;
private Camera _playerCamera;
private float _raycastTimer;
protected override void OnAwake()
{
_playerCamera = GetComponent<Camera>();
}
private bool _didHit;
private void Update()
{
_didHit = RaycastHelper.ThrottledRaycastComponent(
ref _raycastTimer,
_raycastInterval,
_playerCamera,
_interactionRange,
_interactableLayers,
out InteractableBase interactable);
if (_didHit)
_currentInteractable = interactable;
else if (!_didHit && _raycastTimer <= 0f)
_currentInteractable = null;
HandleInteractionInput();
}
private void HandleInteractionInput()
{
var interactAction = InputManager.GetInteractAction();
if (interactAction != null && interactAction.WasPressedThisFrame())
{
if (_currentInteractable != null)
_currentInteractable.Interact();
}
}
private void OnDrawGizmosSelected()
{
if (_playerCamera != null)
{
Gizmos.color = _currentInteractable != null ? Color.green : Color.red;
Vector3 viewportCenter = new Vector3(0.5f, 0.5f, 0f);
Ray ray = _playerCamera.ViewportPointToRay(viewportCenter);
Gizmos.DrawRay(ray.origin, ray.direction * _interactionRange);
}
}
}
}
@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: d96ceb0ee513b1e4197e55e9b926269b
@@ -1,17 +0,0 @@
using UnityEngine;
namespace Unheimlich.Core.Interaction
{
/// <summary>
/// Base class for all interactable objects in the game.
/// Derived classes must implement Interact() to define interaction behavior.
/// </summary>
public abstract class InteractableBase : MonoBehaviour
{
[Header("Interaction Settings")]
[Tooltip("Text displayed when the player looks at the object")]
public string InteractionText = "Interact";
public abstract void Interact();
}
}
@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: c2bd6cb9667f8674294172efbdf8afd3
@@ -1,8 +1,6 @@
using UnityEngine;
using System.Collections.Generic;
using Unheimlich.Features.Dialogue.Data;
using Unheimlich.Features.DetectiveBoard.Data;
using Unheimlich.Features.DetectiveBoard;
using Unheimlich.Features.Player;
using Unheimlich.Features.Dialogue;
using Unheimlich.Features.Dialogue.UI;
@@ -29,10 +27,6 @@ namespace Unheimlich.Core.Interaction
[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>();
@@ -327,21 +321,12 @@ namespace Unheimlich.Core.Interaction
.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()
{
@@ -1,173 +0,0 @@
using System.Collections;
using UnityEngine;
using UnityEngine.InputSystem;
using Unheimlich.Core;
using Unheimlich.Features.Items;
using Unheimlich.Features.Player;
using InputManager = Unheimlich.Core.Input.InputManager;
namespace Unheimlich.Core.Interaction
{
/// <summary>
/// Handles player item inspection mode.
/// </summary>
public class PlayerInspectionHandler : Singleton<PlayerInspectionHandler>
{
[Header("Components")]
[SerializeField] private Transform _inspectionHoldPoint;
[Header("State")]
public bool IsInspecting { get; private set; } = false;
private InspectableItem _currentInspectedItem;
private Coroutine _interactionListener;
private bool _isUsingGamepad = false;
public void ToggleInspection(InspectableItem item)
{
if (!IsInspecting)
{
StartInspection(item);
}
else
{
if (_interactionListener != null)
StopInspection();
}
}
private void StartInspection(InspectableItem item)
{
IsInspecting = true;
_currentInspectedItem = item;
// Set Inspection context (handles cursor automatically)
InputManager.SetContext(InputManager.InputContext.Inspection);
// Disable OctoPlayer to prevent movement and look
if (PlayerController.Instance?.Movement != null)
{
PlayerController.Instance.Movement.enabled = false;
}
item.PrepareForInspection(_inspectionHoldPoint);
if (_interactionListener == null)
_interactionListener = StartCoroutine(ListenForInteraction());
}
private void StopInspection()
{
if (_interactionListener != null)
{
StopCoroutine(_interactionListener);
_interactionListener = null;
}
StopInspectionInternal();
}
private void StopInspectionInternal()
{
if (_currentInspectedItem != null)
{
_currentInspectedItem.Release();
_currentInspectedItem = null;
StartCoroutine(DelayedToggleInput(true));
}
IsInspecting = false;
}
private IEnumerator DelayedToggleInput(bool enable)
{
yield return new WaitForEndOfFrame();
// Re-enable OctoPlayer
if (PlayerController.Instance?.Movement != null)
{
PlayerController.Instance.Movement.enabled = true;
}
// Restore Normal context (handles cursor automatically)
InputManager.SetContext(InputManager.InputContext.Normal);
yield break;
}
private IEnumerator ListenForInteraction()
{
yield return null;
while (IsInspecting)
{
var interactAction = InputManager.GetInteractAction();
if (interactAction != null && interactAction.WasPressedThisFrame())
{
StopInspectionInternal();
yield break;
}
yield return null;
}
_interactionListener = null;
}
private void Update()
{
if (IsInspecting && _currentInspectedItem != null)
{
HandleObjectRotation();
}
}
private void HandleObjectRotation()
{
if (_currentInspectedItem == null) return;
Vector2 lookInput = Vector2.zero;
bool hasInput = false;
// Read input directly (not cached)
if (Gamepad.current != null)
{
Vector2 stickInput = Gamepad.current.rightStick.ReadValue();
if (stickInput.sqrMagnitude > 0.01f)
{
lookInput = stickInput;
hasInput = true;
_isUsingGamepad = true;
}
}
if (!hasInput && Mouse.current != null)
{
Vector2 mouseDelta = Mouse.current.delta.ReadValue();
if (mouseDelta.sqrMagnitude > 0.01f)
{
lookInput = mouseDelta;
hasInput = true;
_isUsingGamepad = false;
}
}
// Only rotate if there's actual input
if (hasInput)
{
// Normalize to get constant rotation speed regardless of input magnitude
Vector2 direction = lookInput.normalized;
float rotationMultiplier = _isUsingGamepad ? Time.deltaTime : 0.02f;
float rotX = direction.y * _currentInspectedItem.RotationSpeed * rotationMultiplier;
float rotY = direction.x * _currentInspectedItem.RotationSpeed * rotationMultiplier;
_currentInspectedItem.transform.Rotate(transform.up, -rotY, Space.World);
_currentInspectedItem.transform.Rotate(transform.right, rotX, Space.World);
}
}
}
}
@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 464960797e705e84a9eb87ecce4e9311