Almost comletely working minigame, but still in progress, code almost done
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user