Пример #1
0
        private void Collision_Handler(string Name1, string Name2)
        {
            if ((Name1 == "Player_Car") && (Name2 == "Enemy_Car"))
            {
                _playGame = false;
                SoundManager.Stop_All_Sound();
                CollisionManager.Work    = false;
                Breaking_Text.Text       = "Crash car";
                _finish.LoseAnim.Visible = true;
                _carPlayer.Freeze        = true;
                _carEnemy.Freeze         = true;
                EndGame_Label.Visible    = true;

                MusicManager.Change_Music("GameOver");
                VoiceManager.Change_Voice("GameOver");
                SoundManager.Play_Sound("BrokenCar");

                AnimationManager.Group_Visible(false, _carPlayer.Car.Id);
                AnimationManager.Set_Visible(true, _carPlayer.Car.Id + "Breaking");
                AnimationManager.Group_Visible(false, _carEnemy.Car.Id);
                AnimationManager.Set_Visible(true, _carEnemy.Car.Id + "Breaking");
                AnimationManager.Set_Visible(false, "PropBoostPlayer");
                AnimationManager.Set_Visible(false, "PropBoostEnemy");
            }

            if ((Name1 == "Player_Car") && ((Name2 == "Left_Board") || (Name2 == "Right_Board")))
            {
                _playGame = false;
                SoundManager.Stop_All_Sound();
                CollisionManager.Work    = false;
                Breaking_Text.Text       = "Crash Player on border";
                _finish.LoseAnim.Visible = true;
                _carPlayer.Freeze        = true;
                EndGame_Label.Visible    = true;

                MusicManager.Change_Music("GameOver");
                VoiceManager.Change_Voice("GameOver");
                SoundManager.Play_Sound("BrokenCar");

                AnimationManager.Group_Visible(false, _carPlayer.Car.Id);
                AnimationManager.Set_Visible(true, _carPlayer.Car.Id + "Breaking");
            }

            if ((Name1 == "Enemy_Car") && ((Name2 == "Left_Board") || (Name2 == "Right_Board")))
            {
                _playGame = false;
                SoundManager.Stop_All_Sound();
                CollisionManager.Work   = false;
                Breaking_Text.Text      = "Crash Enemy on border";
                _finish.WinAnim.Visible = true;
                _carEnemy.Freeze        = true;
                EndGame_Label.Visible   = true;

                MusicManager.Change_Music("Win");
                VoiceManager.Change_Voice("Winner");
                SoundManager.Play_Sound("BrokenCar");

                AnimationManager.Group_Visible(false, _carEnemy.Car.Id);
                AnimationManager.Set_Visible(true, _carEnemy.Car.Id + "Breaking");
            }
        }