Esempio n. 1
0
		void OnChampionDied(ChampionDiedEventData e)
		{
			ClientChampion killed = null;
			ClientChampion killer = null;
			foreach (var champ in Champions) {
				if (champ.ID == e.ChampID) {
					champ.ForceCurrentPosition();
					killed = champ;
				} else if (champ.ID == e.Killer) {
					killer = champ;
				}
			}
			Debug.Assert(killed != null);
			if (killed == null)
				return;
			if (OurChampion != null &&
				e.ChampID == OurChampion.Champion.ID) { // we died
				DeathScreen.DisplayScreen(e.RespawnTime);
			}

			if (OurChampion != null) {
				KillDisplay.Display(killer != null ? (ChampionTypes?)killer.Type : null,
				                    killed.Type,
				                    killed.Team != OurChampion.Champion.Team);
			}

			// Ideally, this would be part of the champion info and not in an horrible if here, but
			// we are soon presenting and I am tired.
			if (killed.Type == ChampionTypes.ManMega)
				PlaySound(Sounds.ManMega_Death, killed.Position);
			else if (killed.Type == ChampionTypes.Zoro)
				PlaySound(Sounds.Zero_Death, killed.Position);

			if (OurChampion != null) {
				if (killed.ID == OurChampion.Champion.ID) { // we died
					GameScore.PlayerDeaths = (int)e.Deaths;
					DelayedPlaySound(Sounds.YouDied, VOICE_SOUND_DELAY);
				} else if (killed.Team == OurChampion.Champion.Team) { // an ally died
					DelayedPlaySound(Sounds.AllyDied, VOICE_SOUND_DELAY);
				} else { // enemy died
					DelayedPlaySound(Sounds.EnemyDied, VOICE_SOUND_DELAY);
				}
				if (killer != null &&
				    killer.ID == OurChampion.Champion.ID) { // we killed someone
					GameScore.PlayerKills = (int)e.Kills;
					DelayedPlaySound(Sounds.YouKilled, VOICE_SOUND_DELAY);
				}
				if (OurChampion.Champion.Team == Teams.Left) { // our team is on the left
					GameScore.TeamKills = (int)e.LeftKills;
					GameScore.TeamDeaths = (int)e.RightKills;
				} else { // our team is on the right
					GameScore.TeamKills = (int)e.RightKills;
					GameScore.TeamDeaths = (int)e.LeftKills;
				}
			}
		}
Esempio n. 2
0
        void OnChampionDied(ChampionDiedEventData e)
        {
            ClientChampion killed = null;
            ClientChampion killer = null;

            foreach (var champ in Champions)
            {
                if (champ.ID == e.ChampID)
                {
                    champ.ForceCurrentPosition();
                    killed = champ;
                }
                else if (champ.ID == e.Killer)
                {
                    killer = champ;
                }
            }
            Debug.Assert(killed != null);
            if (killed == null)
            {
                return;
            }
            if (OurChampion != null &&
                e.ChampID == OurChampion.Champion.ID)                   // we died
            {
                DeathScreen.DisplayScreen(e.RespawnTime);
            }

            if (OurChampion != null)
            {
                KillDisplay.Display(killer != null ? (ChampionTypes?)killer.Type : null,
                                    killed.Type,
                                    killed.Team != OurChampion.Champion.Team);
            }

            // Ideally, this would be part of the champion info and not in an horrible if here, but
            // we are soon presenting and I am tired.
            if (killed.Type == ChampionTypes.ManMega)
            {
                PlaySound(Sounds.ManMega_Death, killed.Position);
            }
            else if (killed.Type == ChampionTypes.Zoro)
            {
                PlaySound(Sounds.Zero_Death, killed.Position);
            }

            if (OurChampion != null)
            {
                if (killed.ID == OurChampion.Champion.ID)                   // we died
                {
                    GameScore.PlayerDeaths = (int)e.Deaths;
                    DelayedPlaySound(Sounds.YouDied, VOICE_SOUND_DELAY);
                }
                else if (killed.Team == OurChampion.Champion.Team)                     // an ally died
                {
                    DelayedPlaySound(Sounds.AllyDied, VOICE_SOUND_DELAY);
                }
                else                     // enemy died
                {
                    DelayedPlaySound(Sounds.EnemyDied, VOICE_SOUND_DELAY);
                }
                if (killer != null &&
                    killer.ID == OurChampion.Champion.ID)                   // we killed someone
                {
                    GameScore.PlayerKills = (int)e.Kills;
                    DelayedPlaySound(Sounds.YouKilled, VOICE_SOUND_DELAY);
                }
                if (OurChampion.Champion.Team == Teams.Left)                   // our team is on the left
                {
                    GameScore.TeamKills  = (int)e.LeftKills;
                    GameScore.TeamDeaths = (int)e.RightKills;
                }
                else                     // our team is on the right
                {
                    GameScore.TeamKills  = (int)e.RightKills;
                    GameScore.TeamDeaths = (int)e.LeftKills;
                }
            }
        }