Added 2 minigames
This commit is contained in:
28
Assets/Scripts/keyslot.cs
Normal file
28
Assets/Scripts/keyslot.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class KeySlot : MonoBehaviour, IDropHandler
|
||||
{
|
||||
public string correctKeyID;
|
||||
|
||||
public void OnDrop(PointerEventData eventData)
|
||||
{
|
||||
DraggableKey key = eventData.pointerDrag.GetComponent<DraggableKey>();
|
||||
|
||||
if (key != null)
|
||||
{
|
||||
if (key.keyID == correctKeyID)
|
||||
{
|
||||
key.transform.position = transform.position;
|
||||
key.enabled = false;
|
||||
|
||||
KeyminigameManager.Instance.CheckWin();
|
||||
}
|
||||
else
|
||||
{
|
||||
KeyminigameManager.Instance.Fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user