added cables

This commit is contained in:
2026-02-21 13:07:16 +01:00
parent 8f62dc8873
commit 1957d26b1f
4 changed files with 223 additions and 8 deletions

View File

@@ -7,15 +7,15 @@ public class CableMiniGame : MonoBehaviour
[System.Serializable]
public class Cable
{
public string colorName; // Název barvy kabelu
public Button sourceButton; // Zdrojový konektor
public Button targetButton; // Cílový konektor
public Image cableImage; // Pro změnu barvy kabelu
public string colorName;
public Button sourceButton;
public Button targetButton;
public Image cableImage;
}
public Cable[] cables;
public string previousSceneName; // Scéna kam se vrátit při chybě
public Color wrongAttemptColor = Color.white; // Bliknutí při špatném pokusu
public string previousSceneName;
public Color wrongAttemptColor = Color.white;
public float blinkDuration = 0.2f;
private string selectedColor = null;
@@ -42,13 +42,11 @@ public class CableMiniGame : MonoBehaviour
if (selectedColor == cable.colorName)
{
// Správné propojení
Debug.Log("Správně!");
cable.cableImage.color = GetColorFromName(selectedColor);
}
else
{
// Špatné propojení reset scény
Debug.Log("Špatně, restart!");
StartCoroutine(BlinkAndReset(cable.cableImage));
}