Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.E))
        {
            th.PlayCurrent(TranslationHandler.State.toEnd);
        }
        else if (Input.GetKeyDown(KeyCode.D))
        {
            th.PlayCurrent(TranslationHandler.State.toDebut);
        }
        else if (Input.GetKeyDown(KeyCode.I))
        {
            th.Invert();
        }
        else if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            th.SetCurrent(th.BrowseTranslations());
        }
        else if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            th.SetCurrent(th.BrowseTranslations(true));
        }

        if (Input.GetMouseButtonDown(0))
        {
            RaycastHit hit;
            Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit);
            if (hit.transform != null)
            {
                TranslationHandler.Translation trans = th.listTranslation.Find(t => t.name == hit.transform.name);
                if (trans != null)
                {
                    th.Play(trans.name, TranslationHandler.State.toEnd, true);
                }
            }
        }
    }