示例#1
0
 private void OnCollisionEnter(Collision other)
 {
     if (other.transform.CompareTag("Finish")) //Finish is the terrain's tag, when the player flies and falls on the floor
     {
         _movements.enabled = false;
         _inGameUi.End();
     }
 }
示例#2
0
    /// <summary>
    /// The function is called when the character reaches the end of the circuit
    /// </summary>
    void PlayEnd()
    {
        //Final jump animation setup
        Transform characterHolder = new GameObject().transform;

        characterHolder.parent   = transform.parent;
        characterHolder.position = transform.position;
        Vector3 scale = characterHolder.localScale;

        scale.z *= Random.Range(1f, 1.2f);
        characterHolder.localScale       = scale;
        characterHolder.localEulerAngles = Vector3.up * (transform.eulerAngles.y + Random.Range(-5f, 5f));

        transform.parent  = characterHolder.transform;
        enabled           = false;
        _animator.enabled = true;

        if (_player)
        {
            _inGameUi.End();
        }
    }