Esempio n. 1
0
        public void PlaySound(KindOfSound kind, String detail = "")
        {
            if (Time.time - lastPlayTime < 0.3f)    // check time
            {
                return;
            }

            switch (kind)
            {
            case KindOfSound.SINK_RATE:
                if (!IsPlaying(KindOfSound.SINK_RATE) && !IsPlaying(KindOfSound.SINK_RATE_PULL_UP))
                {
                    Captions.PlayYellow(kind);
                    PlayOneShot(kind);
                }
                break;

            case KindOfSound.SINK_RATE_PULL_UP:
                if (!IsPlaying(KindOfSound.SINK_RATE) && !IsPlaying(KindOfSound.SINK_RATE_PULL_UP))
                {
                    Captions.PlayRed(kind);
                    PlayOneShot(kind);
                }
                break;

            case KindOfSound.TERRAIN:
                if (!IsPlaying(KindOfSound.SINK_RATE) && !IsPlaying(KindOfSound.SINK_RATE_PULL_UP) &&
                    !IsPlaying(KindOfSound.TERRAIN) && !IsPlaying(KindOfSound.TERRAIN_PULL_UP))
                {
                    Captions.PlayYellow(kind);
                    PlayOneShot(kind);
                }
                break;

            case KindOfSound.TERRAIN_PULL_UP:
                if (!IsPlaying(KindOfSound.SINK_RATE) && !IsPlaying(KindOfSound.SINK_RATE_PULL_UP) &&
                    !IsPlaying(KindOfSound.TERRAIN_PULL_UP))
                {
                    Captions.PlayRed(kind);
                    PlayOneShot(kind);
                }
                break;

            case KindOfSound.DONT_SINK:
                if (!IsPlaying(KindOfSound.SINK_RATE) && !IsPlaying(KindOfSound.SINK_RATE_PULL_UP) &&
                    !IsPlaying(KindOfSound.TERRAIN) && !IsPlaying(KindOfSound.TERRAIN_PULL_UP) &&
                    !IsPlaying(KindOfSound.DONT_SINK))
                {
                    Captions.PlayYellow(kind);
                    PlayOneShot(kind);
                }
                break;

            case KindOfSound.TOO_LOW_GEAR:
                if (!IsPlaying(KindOfSound.TOO_LOW_GEAR) &&
                    !IsPlaying(KindOfSound.TOO_LOW_TERRAIN) &&
                    !IsPlaying(KindOfSound.TOO_LOW_FLAPS))
                {
                    Captions.PlayRed(kind);
                    PlayOneShot(kind);
                }
                break;

            case KindOfSound.TOO_LOW_TERRAIN:
                if (!IsPlaying(KindOfSound.SINK_RATE) && !IsPlaying(KindOfSound.SINK_RATE_PULL_UP) &&
                    !IsPlaying(KindOfSound.TERRAIN) && !IsPlaying(KindOfSound.TERRAIN_PULL_UP) &&
                    !IsPlaying(KindOfSound.TOO_LOW_GEAR) && !IsPlaying(KindOfSound.TOO_LOW_TERRAIN) &&
                    !IsPlaying(KindOfSound.TOO_LOW_FLAPS))
                {
                    Captions.PlayRed(kind);
                    PlayOneShot(kind);
                }
                break;

            case KindOfSound.TRAFFIC:
                if (!IsPlaying(KindOfSound.TRAFFIC))
                {
                    Captions.PlayYellow(kind);
                    PlayOneShot(kind);
                }
                break;

            case KindOfSound.STALL:
                if (!IsPlaying(KindOfSound.STALL) && !IsPlaying(KindOfSound.TOO_LOW_FLAPS) &&
                    !IsPlaying(KindOfSound.SINK_RATE) && !IsPlaying(KindOfSound.SINK_RATE_PULL_UP) &&
                    !IsPlaying(KindOfSound.TERRAIN) && !IsPlaying(KindOfSound.TERRAIN_PULL_UP) &&
                    !IsPlaying(KindOfSound.TOO_LOW_GEAR) && !IsPlaying(KindOfSound.TOO_LOW_TERRAIN))
                {
                    Captions.PlayRed(kind);
                    PlayOneShot(kind);
                }
                break;

            case KindOfSound.ALTITUDE_CALLOUTS:
                this.detail = detail;
                Captions.PlayGreen(kind, detail);
                PlayOneShot(kind, detail);
                break;

            case KindOfSound.BANK_ANGLE:
                if (!IsPlaying(KindOfSound.BANK_ANGLE))
                {
                    Captions.PlayYellow(kind);
                    PlayOneShot(kind);
                }
                break;

            case KindOfSound.HORIZONTAL_SPEED:
                if (!IsPlaying(KindOfSound.SINK_RATE) && !IsPlaying(KindOfSound.SINK_RATE_PULL_UP) &&
                    !IsPlaying(KindOfSound.HORIZONTAL_SPEED))
                {
                    Captions.PlayYellow(kind);
                    PlayOneShot(kind);
                }
                break;

            case KindOfSound.RETARD:
                if (!IsPlaying(KindOfSound.SINK_RATE) && !IsPlaying(KindOfSound.SINK_RATE_PULL_UP) &&
                    !IsPlaying(KindOfSound.TERRAIN) && !IsPlaying(KindOfSound.TERRAIN_PULL_UP) &&
                    !IsPlaying(KindOfSound.DONT_SINK) && !IsPlaying(KindOfSound.RETARD))
                {
                    Captions.PlayYellow(kind);
                    PlayOneShot(kind);
                }
                break;

            case KindOfSound.V1:
                if (!IsPlaying(KindOfSound.SINK_RATE) && !IsPlaying(KindOfSound.SINK_RATE_PULL_UP) &&
                    !IsPlaying(KindOfSound.TERRAIN) && !IsPlaying(KindOfSound.TERRAIN_PULL_UP) &&
                    !IsPlaying(KindOfSound.DONT_SINK) && !IsPlaying(KindOfSound.V1) && !IsPlaying(KindOfSound.ROTATE))
                {
                    Captions.PlayGreen(kind);
                    PlayOneShot(kind);
                }
                break;

            case KindOfSound.ROTATE:
                if (!IsPlaying(KindOfSound.SINK_RATE) && !IsPlaying(KindOfSound.SINK_RATE_PULL_UP) &&
                    !IsPlaying(KindOfSound.TERRAIN) && !IsPlaying(KindOfSound.TERRAIN_PULL_UP) &&
                    !IsPlaying(KindOfSound.DONT_SINK) && !IsPlaying(KindOfSound.ROTATE))
                {
                    Captions.PlayGreen(kind);
                    PlayOneShot(kind);
                }
                break;

            case KindOfSound.GEAR_UP:
                if (!IsPlaying(KindOfSound.SINK_RATE) && !IsPlaying(KindOfSound.SINK_RATE_PULL_UP) &&
                    !IsPlaying(KindOfSound.TERRAIN) && !IsPlaying(KindOfSound.TERRAIN_PULL_UP) &&
                    !IsPlaying(KindOfSound.DONT_SINK) && !IsPlaying(KindOfSound.GEAR_UP))
                {
                    Captions.PlayYellow(kind);
                    PlayOneShot(kind);
                }
                break;

            default:
                break;
            }
        }