Пример #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (stopTrigger)
        {
            return;
        }

        if (other.gameObject.CompareTag("Goal"))
        {
            stopTrigger = true;
            gms.CharacterReachedGoal(this.GetComponent <Statistics>());

            if (this.GetComponent <PlayerScript>() != null)
            {
                this.GetComponent <PlayerScript>().enabled = false;
            }

            if (this.GetComponent <AIScript>() != null)
            {
                this.GetComponent <AIScript>().enabled = false;
            }
        }

        if (other.gameObject.CompareTag("Death"))
        {
            if (hit)
            {
                return;
            }
            hit = true;
            lastDistanceTravelled = pf.distanceTravelled;
            StartCoroutine(Respawn());
        }
    }
Пример #2
0
    private void OnTriggerEnter(Collider other)
    {
        if (stopTrigger)
        {
            return;
        }

        if (other.gameObject.CompareTag("Goal"))
        {
            stopTrigger = true;
            gms.CharacterReachedGoal(this.GetComponent <Statistics>());

            if (this.GetComponent <PlayerScript>() != null)
            {
                this.GetComponent <PlayerScript>().raceFinished = true;
                characterAnim.SetTrigger("Idle");
                GetComponent <AIScript>().enabled          = true;
                this.GetComponent <PlayerScript>().enabled = false;
            }

            if (this.GetComponent <AIScript>() != null)
            {
                this.GetComponent <AIScript>().raceFinished = true;
                characterAnim.SetTrigger("Idle");
            }
        }
    }