Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        anim.SetFloat("Blend", input.Speed);
        UserInterface();

        if (!input.canMove)
        {
            return;
        }

        if (screenTargets.Count < 1)
        {
            return;
        }

        if (!isLocked)
        {
            target = screenTargets[targetIndex()];
        }

        if (Input.GetMouseButtonDown(1))
        {
            LockInterface(true);
            isLocked = true;
        }

        if (Input.GetMouseButtonUp(1) && input.canMove)
        {
            LockInterface(false);
            isLocked = false;
        }

        if (!isLocked)
        {
            return;
        }

        if (Input.GetMouseButtonDown(0))
        {
            input.RotateTowards(target);
            input.canMove = false;
            swordParticle.Play();
            swordMesh.enabled = true;
            anim.SetTrigger("slash");
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Cursor.visible = false;
        }
    }