Advertisement
AlezM

Untitled

Mar 19th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6. public class LevelNumber : MonoBehaviour {
  7.  
  8.     public int id = 0;
  9.     public Color doneButtonColor;
  10.     public Color closeButtonColor;
  11.  
  12.     LevelList levelList;
  13.  
  14.     public void SetID (int _id, LevelList _levelList, LevelInfo.LevelStatus status) {
  15.         Debug.Log ("SetID");
  16.  
  17.         id = _id;
  18.         levelList = _levelList;
  19.         GetComponentInChildren<Text> ().text = id.ToString();
  20.         GetComponent<Button> ().onClick.AddListener ( LoadLvl );
  21.         if (status == LevelInfo.LevelStatus.Close) {
  22.             GetComponent<Button> ().interactable = false;
  23.             GetComponent<Image> ().color = closeButtonColor;
  24.         }
  25.         if (status == LevelInfo.LevelStatus.Done)
  26.             GetComponent<Image> ().color = doneButtonColor;        
  27.     }
  28.  
  29.     void LoadLvl () {
  30.         levelList.LoadLevel (id);
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement