Exemplo n.º 1
0
    void Update()
    {
        try
        {
            float   multip = Radious / 2f;
            Vector3 dir    = (Input.mousePosition - _startVector3).normalized * multip + _startVector3;

            if ((Input.mousePosition - _startVector3).y > 0)
            {
                transform.position = new Vector3(dir.x, Mathf.Abs(dir.y), dir.z);

                for (int i = 0; i < VariosTexts.Length; i++)
                {
                    float localDist = Vector3.Distance(transform.position, VariosTexts[i].transform.position);

                    if (localDist < Vector3.Distance(transform.position, VariosTexts[_choosenVar].transform.position))
                    {
                        VariosTexts[_choosenVar].color = Color.white;
                        _choosenVar = i;
                        VariosTexts[_choosenVar].color = Color.red;
                    }
                }

                if (Input.GetKeyDown(KeyCode.Mouse0) && !EventSystem.current.IsPointerOverGameObject(DialogSystemExemp.GetInstanceID()))
                {
                    DialogSystemExemp.DialogNextIndex(DialogSystemExemp.VariationString[_choosenVar]);
                    Debug.Log(DialogSystemExemp.VariationString[_choosenVar]);
                    foreach (Text n in VariosTexts)
                    {
                        Destroy(n.gameObject);
                    }
                    DialogSystemExemp.VariationString.Clear();
                    transform.parent.gameObject.SetActive(false);
                }
            }
        }
        catch
        {
        }
    }