>Added level locking/Unlocking
parent
3ae454cf7f
commit
2c4496e721
@ -0,0 +1,41 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bbc01220aec21af42b658c8f7e1394b4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue