Just Atlas_UI.cs No Vicroty.cs No Json ### Atlas_UI (didn't work) ```cs using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using TMPro; using UnityEngine.SceneManagement; using Unity.VisualScripting; public class AtlasUI : MonoBehaviour { // UI layouts change public GameObject CanvasMain; public GameObject CanvasWithOrangButton; public GameObject CanvasOrangery; public GameObject starfishNew; private GameObject starfishNewClone; // Hint public TMP_Text expRulesObj; public float hintLength; public string rulesDescr; public string hintDescr; // Orangery public GameObject orangeryPetals; public Button orangeryButton; public string orangerySceneName; private int petalRotZ = 0; private int petalRotNum = 0; private bool petalsRotate = false; // Victory public Animator atlasAnimator; public string atlAnimationBool; public GameObject victoryPanel; public Button restartButton; // ToDo // Victory panel instead of rules panel // Summary = Genre // Rules = RestartButton public bool atlasCorrect = false; // a victory condition private bool orangPressed; int nameNumber = 2; public void OnRestart() { // Deactivate the completed atlas GameObject starfishCompleted = GameObject.Find("Starfish" + nameNumber); starfishCompleted.SetActive(false); // Instantiate a new Atlas from prefab starfishNewClone = Instantiate(starfishNew); for (int i = 0; i < 100; i++) { starfishNewClone.name = "Starfish" + nameNumber; } nameNumber++; victoryPanel.SetActive(false); atlasCorrect = false; } public void InAtlasButton() // OrangeryB in Atlas { // Activate all current atlases for (int i = nameNumber; i > 0; i--) { GameObject atlasCompleted = GameObject.Find("Starfish" + nameNumber); if (atlasCompleted != null) { atlasCompleted.SetActive(true); } } // Deactivate the current atlas orangPressed = true; InvokeRepeating("RotatePetal", 0, 0.008f); } public void InOrangery() // OrangeryB in Orangery { // Deactivate completed atlases for (int i = nameNumber; i > 0; i--) { GameObject atlasCompleted = GameObject.Find("Starfish" + nameNumber); if (atlasCompleted != null) { atlasCompleted.SetActive(false); } } // Activate the current atlas GameObject currentAtlas = GameObject.Find("Starfish" + (nameNumber - 1)); currentAtlas.SetActive(true); CanvasMain.SetActive(true); CanvasWithOrangButton.SetActive(true); CanvasOrangery.SetActive(false); } private void CheckPetalRotation() { if (petalRotNum >= 180) { CancelInvoke("RotatePetal"); petalRotNum = 0; orangeryButton.interactable = true; if (orangPressed) { CanvasMain.SetActive(false); CanvasWithOrangButton.SetActive(false); CanvasOrangery.SetActive(true); GameObject currentAtlas = GameObject.Find("Starfish" + (nameNumber - 1)); currentAtlas.SetActive(false); } orangPressed = false; } } // VICTORY private void IsVictoryActive() { if (atlasCorrect && !petalsRotate) { Debug.Log("Complete!!!"); petalsRotate = true; // Changes flag to stop petal's rotation // Animation atlasAnimator.SetBool(atlAnimationBool, true); StartCoroutine("ShowVictoryPanel"); } } // Shows input field // and starts the rotation of the UI flower public IEnumerator ShowVictoryPanel() { yield return new WaitForSeconds(6.2f); // Rotates Orangery UI InvokeRepeating("RotatePetal", 0, 0.008f); yield return new WaitForSeconds(0.5f); // Shows input panel victoryPanel.SetActive(true); // Stops rotating Orangery UI yield return new WaitForSeconds(1f); CancelInvoke("RotatePetal"); } private void RotatePetal() { petalRotZ = petalRotZ - 4; orangeryPetals.GetComponent<Transform>().rotation = Quaternion.Euler(0, 0, petalRotZ); petalRotNum = petalRotNum + 1; } // UPDATE private void Update() { CheckPetalRotation(); IsVictoryActive(); } } ```