Esempio n. 1
0
    // if crash with an object start crash animation
    private IEnumerator CrashAnimation()
    {
        if (movementCoroutine != null)
        {
            StopCoroutine(movementCoroutine);
        }
        GetComponent <Collider>().enabled = false;
        Destroy(movementFeedback.gameObject);
        groundMarker.SetActive(false);
        if (directionFeedback.activeSelf)
        {
            directionFeedback.SetActive(false);
        }
        explosionPS.Play();
        switch (fieldsMovement)
        {
        case 1:
            landingAnim.SetTrigger("Crash_Small");
            break;

        case 2:
            landingAnim.SetTrigger("Crash_Medium");
            break;

        case 3:
            landingAnim.SetTrigger("Crash_Fast");
            break;
        }
        yield return(new WaitForSeconds(2));

        burnPS.Play();
        smokePS.Play();
        if (AllowSound)
        {
            audioSource.clip = planeOnGroundClip;
            audioSource.Play();
        }

        yield return(new WaitForSeconds(1.5f));

        if (callCrashFinished)
        {
            planeMan.CrashFinished();
        }
    }