private void initIcons()
 {
     for (int i = 0; i < this.icons.Count; i++)
     {
         LevelSelectOption icon = this.icons[i];
         icon.transform.localPosition  = new Vector3(0, 0, icon.transform.localPosition.z);
         icon.transform.localPosition += (Vector3) new Vector2(this.distanceBetweenIcons * i, 0);
     }
 }
Exemple #2
0
    public void OnlevelSelected()
    {
        Button selectedButton = seletedButton;

        LevelSelectOption lo = selectedButton.GetComponent <LevelSelectOption>();

        if (lo != null)
        {
            SceneManager.LoadScene(lo.LevelName);
        }
        else
        {
            Debug.LogWarning("No option associated with:" + selectedButton.name);
        }
    }
    void Start()
    {
        EventManager.instance.onLevelSelectArrowClickedEvent += this.arrowClicked;

        this.icons = new List <LevelSelectOption>();
        foreach (Transform t in transform)
        {
            LevelSelectOption option = t.gameObject.GetComponent <LevelSelectOption>();
            option.disableAsSelectable();
            this.icons.Add(option);
        }
        this.selectedIndex = 0;
        this.icons[this.selectedIndex].enableAsSelectable();
        this.initIcons();
    }