>Added level locking/Unlocking

nuruz-dev
Hazim Bin Ijaz 2 months ago
parent 3ae454cf7f
commit 2c4496e721

@ -35657,9 +35657,70 @@ MonoBehaviour:
m_GameObject: {fileID: 1780496680} m_GameObject: {fileID: 1780496680}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 20c583ef6dfb0014ba8e903e3c524d2f, type: 3} m_Script: {fileID: 11500000, guid: bbc01220aec21af42b658c8f7e1394b4, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
levelButtonStatesList:
- Locked: {fileID: 1929610440}
Unlocked: {fileID: 1332971986}
Completed: {fileID: 444569478}
- Locked: {fileID: 1788151842}
Unlocked: {fileID: 1535183447}
Completed: {fileID: 1476911097}
- Locked: {fileID: 1794735186}
Unlocked: {fileID: 1928894768}
Completed: {fileID: 191513299}
- Locked: {fileID: 1996921123}
Unlocked: {fileID: 265164210}
Completed: {fileID: 1204215995}
- Locked: {fileID: 1703976288}
Unlocked: {fileID: 653091084}
Completed: {fileID: 2048644369}
- Locked: {fileID: 1546442775}
Unlocked: {fileID: 358645670}
Completed: {fileID: 1388204550}
- Locked: {fileID: 759969899}
Unlocked: {fileID: 1813115399}
Completed: {fileID: 475154345}
- Locked: {fileID: 2065824762}
Unlocked: {fileID: 2017097871}
Completed: {fileID: 1260602678}
- Locked: {fileID: 1309489079}
Unlocked: {fileID: 1959940118}
Completed: {fileID: 340085412}
- Locked: {fileID: 426892049}
Unlocked: {fileID: 444941659}
Completed: {fileID: 821336363}
- Locked: {fileID: 806270146}
Unlocked: {fileID: 1486555263}
Completed: {fileID: 2001763897}
- Locked: {fileID: 1523267509}
Unlocked: {fileID: 1878934031}
Completed: {fileID: 1774304840}
- Locked: {fileID: 1925523366}
Unlocked: {fileID: 820727160}
Completed: {fileID: 1126456150}
- Locked: {fileID: 551843513}
Unlocked: {fileID: 2047664198}
Completed: {fileID: 139987263}
- Locked: {fileID: 2022041416}
Unlocked: {fileID: 335174088}
Completed: {fileID: 730183919}
- Locked: {fileID: 331774113}
Unlocked: {fileID: 68099417}
Completed: {fileID: 353052220}
- Locked: {fileID: 132478589}
Unlocked: {fileID: 1336815597}
Completed: {fileID: 490035123}
- Locked: {fileID: 1618354688}
Unlocked: {fileID: 869651978}
Completed: {fileID: 886029138}
- Locked: {fileID: 768304873}
Unlocked: {fileID: 701129813}
Completed: {fileID: 1142862741}
- Locked: {fileID: 159502466}
Unlocked: {fileID: 1418597769}
Completed: {fileID: 823371453}
--- !u!23 &1787493491 stripped --- !u!23 &1787493491 stripped
MeshRenderer: MeshRenderer:
m_CorrespondingSourceObject: {fileID: 3250460047876692766, guid: 22094cc6dd603d942832401b762230e8, type: 3} m_CorrespondingSourceObject: {fileID: 3250460047876692766, guid: 22094cc6dd603d942832401b762230e8, type: 3}

@ -15,6 +15,7 @@ public class GameProgress : GameStateMachineUser
[SerializeField] private Vector2 levelUpTimeRange; [SerializeField] private Vector2 levelUpTimeRange;
[SerializeField] private Button[] levelButtons; // Array for buttons [SerializeField] private Button[] levelButtons; // Array for buttons
[SerializeField] private Text[] levelTexts; // Array for corresponding Text objects [SerializeField] private Text[] levelTexts; // Array for corresponding Text objects
[SerializeField] private LevelSelectionScreen levelSelectionScreen;
int levelIndex; int levelIndex;
private float XPforLevelUp; private float XPforLevelUp;
private float totalXP; private float totalXP;

@ -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…
Cancel
Save