Almost comletely working minigame, but still in progress, code almost done

This commit is contained in:
2026-05-08 10:20:22 +02:00
parent 8948cbdb14
commit 2f86bab336
6 changed files with 219 additions and 3 deletions

View File

@@ -3,6 +3,8 @@ using UnityEngine;
public class KeyHole : MonoBehaviour
{
public int index;
public Key key;
public InserKeysMinigameManager manager;
void Start()
{
@@ -15,9 +17,28 @@ public class KeyHole : MonoBehaviour
}
private void OnMouseDown()
void OnMouseDown()
{
Debug.Log("KeyHole " + index + " was tapped!");
if (manager.isInputLocked) return;
Debug.Log("Keyhole " + index + " was tapped.");
if (key.isSelected)
{
key.transform.parent.position = transform.position + key.insertedOffset;
key.transform.parent.eulerAngles = key.insertedRotation;
Debug.Log("Key teleported to keyhole " + index);
if (manager.CheckKeyHole(index))
{
Debug.Log("Correct, You Win");
}
else
{
Debug.Log("Wrong");
key.StartCoroutine(key.HandleWrongAttempt());
}
}
}
}