Exemplo n.º 1
0
    void Update()
    {
        animator.SetFloat("Speed", nvAgent.velocity.magnitude);

        //Footstep sound
        if (!GameData.isPaused && nvAgent.velocity.magnitude > 1f && !audioSrc.isPlaying)
        {
            audioSrc.PlayOneShot(SoundDatabase.GetRandomFootstep());
        }
        //Clicks
        if (!GameData.isInMenu)
        {
            if (Input.touchCount == 1)
            {
                Touch touch = Input.GetTouch(0);

                if (touch.phase == TouchPhase.Began)
                {
                    ClickOnPosition(touch.position);
                    return;
                }
            }
            if (GameData.gameMode == GameData.Mode.Free)
            {
                if (Input.GetKeyDown(KeyCode.Mouse0))
                {
                    ClickOnPosition(Input.mousePosition);
                }
            }
        }
    }