void Update()
    {
        Module lastTrack = instanceGround.RenderedTracksGetLast();

        mushroomNav.SetDestination(lastTrack.End.transform.position);

        if (!animationMushroom.isPlaying)
        {
            animationMushroom.Play("Run");
            GetComponent <AudioSource>().Play();
        }

        check += Time.deltaTime;

        if (Mathf.Floor(check) == delayCheck)
        {
            if (Mathf.RoundToInt(theTransform.x) == Mathf.RoundToInt(this.transform.position.x) & Mathf.RoundToInt(theTransform.z) == Mathf.RoundToInt(this.transform.position.z))
            {
                if (instanceGround.PlayerRayCheck() != null)
                {
                    this.transform.position = instanceGround.PlayerRayCheck().End.position;
                    Debug.Log("Entrei");
                }
            }
            theTransform = this.transform.position;
            check        = 0;
        }
    }
Esempio n. 2
0
 public void WrongWay() //O player está indo no sentido errado.
 {
     if (groundStanding.PlayerRayCheck() != null && player.transform.forward.z == (-groundStanding.PlayerRayCheck().Start.forward.z))
     {
         //Debug.Log("Facing Wrong Way");
         menu.Score(6);
     }
 }