Exemplo n.º 1
0
        public IEnumerator ToggleOption(Text selected, bool isRemove, bool value)
        {
            selected.gameObject.SetActive(value);

            processing = true;

            Animator animator;


            if (isRemove)
            {
                switch (option)
                {
                case 0:
                    break;

                case 1:
                    option = 1;
                    break;

                case 2:
                    Display();

                    menuButtons.Clear();
                    texts.Clear();

                    for (int i = 0; i < transform.childCount; i++)
                    {
                        menuButtons.Add(transform.GetChild(i).gameObject);
                    }

                    for (int i = 0; i < anim.Length; i++)
                    {
                        texts.Add(menuButtons[i].GetComponent <Text>());
                    }

                    option = 2;
                    break;

                case null:
                    break;
                }

                SelectedOption.RemoveAt(SelectedOption.Count - 1);
            }
            else
            {
                switch (option)
                {
                case 0:
                    break;

                case 1:

                    Text[] status = selected.GetComponentsInChildren <Text>();
                    Player player = FindObjectOfType <Player>();

                    status[1].text = player.stat.STR.ToString();
                    status[2].text = player.stat.AGI.ToString();
                    status[3].text = player.stat.INT.ToString();
                    status[4].text = player.stat.LUK.ToString();

                    option = null;
                    break;

                case 2:
                    menuSound.PlayOneShot(confirm);
                    yield return(new WaitForSecondsRealtime(0.8f));

                    Time.timeScale = 1f;
                    Destroy(GameObject.Find("UI"));
                    SceneManager.LoadScene("TitleScene");
                    break;

                case null:
                    break;
                }
            }

            if (option != 2)
            {
                animator = selected.GetComponent <Animator>();
                animator.SetTrigger("Move");
            }

            yield return(new WaitForSecondsRealtime(0.5f));

            processing = false;
        }
Exemplo n.º 2
0
 private void Start()
 {
     _resourceBar.fillAmount = PlayerStats.Fuel / PlayerStats.MaxFuel;
     _lerpFuelText           = _lowFuelText.GetComponent <ColorLerp>();
 }