Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class LevelNumber : MonoBehaviour {
- public int id = 0;
- public Color doneButtonColor;
- public Color closeButtonColor;
- LevelList levelList;
- public void SetID (int _id, LevelList _levelList, LevelInfo.LevelStatus status) {
- Debug.Log ("SetID");
- id = _id;
- levelList = _levelList;
- GetComponentInChildren<Text> ().text = id.ToString();
- GetComponent<Button> ().onClick.AddListener ( LoadLvl );
- if (status == LevelInfo.LevelStatus.Close) {
- GetComponent<Button> ().interactable = false;
- GetComponent<Image> ().color = closeButtonColor;
- }
- if (status == LevelInfo.LevelStatus.Done)
- GetComponent<Image> ().color = doneButtonColor;
- }
- void LoadLvl () {
- levelList.LoadLevel (id);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement