You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CrowdControl/Assets/Source/Scripts/LevelSelectionScreen.cs

42 lines
1.1 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[Serializable]
public class LevelButtonStates
{
public GameObject Locked;
public GameObject Unlocked;
public GameObject Completed;
}
public class LevelSelectionScreen : MonoBehaviour
{
public List<LevelButtonStates> levelButtonStatesList;
public void LockLevel(int levelIndex)
{
levelButtonStatesList[levelIndex].Completed.SetActive(false);
levelButtonStatesList[levelIndex].Unlocked.SetActive(false);
levelButtonStatesList[levelIndex].Locked.SetActive(true);
}
public void UnlockLevel(int levelIndex)
{
levelButtonStatesList[levelIndex].Completed.SetActive(false);
levelButtonStatesList[levelIndex].Unlocked.SetActive(true);
levelButtonStatesList[levelIndex].Locked.SetActive(false);
}
public void LevelCompleted(int levelIndex)
{
levelButtonStatesList[levelIndex].Completed.SetActive(true);
levelButtonStatesList[levelIndex].Unlocked.SetActive(false);
levelButtonStatesList[levelIndex].Locked.SetActive(false);
}
}