//public void CarDoorOpen()
    //{
    //
    //    Animator carAnimator = racingCar.GetComponent<Animator>();
    //    carAnimator.enabled = true;
    //    carAnimator.Play("open");
    //}

    void CarDoorClose()
    {
        if (racingCar == null)
        {
            MyHelpNode.FindTransform(transform, "racingCar", out racingCar);
        }
        Animator carAnimator = racingCar.GetComponent <Animator>();

        carAnimator.enabled = true;
        carAnimator.Play("close");

        carAudio.PlaySound("CarDoorClose", soundVolume, 0, 1.0f);
    }
Exemplo n.º 2
0
    void CarDoorSwitch()
    {
        if (racingCar == null)
        {
            MyHelpNode.FindTransform(transform, "racingCar", out racingCar);
        }
        Animator carAnimator = racingCar.GetComponent <Animator>();

        carAnimator.enabled = true;
        bool isopen = carAnimator.GetBool("open");

        isopen = !isopen;
        carAnimator.SetBool("open", isopen);
        carAudio.PlaySound(
            (isopen) ? "CarDoorOpen" : "CarDoorClose", 1, 0,
            (isopen) ? 0.3f : 1.0f);
    }