public GameplayScreen(ContentManager content, Game game, Client client) : base(content, game) { Client = client; ChampionsInfo = new ChampionsInfo(); GameTime = null; TimeSinceLastInputSent = 0.0; Match = new GameMatch(Path.Combine("Content", MapLoader.MAIN_MAP_PATH)); LastStateUpdateData = new List <StateUpdateData>(); RemarkableEvents = new List <RemarkableEventData>(); Spells = new Dictionary <ulong, DrawableSpell>(); TimeOfLastStateUpdate = 0.0; Champions = new List <ClientChampion>(); GameWorld = new Container(); Structures = new List <DrawableStructure>(); Camera = new CameraService(); Services.AddService(typeof(CameraService), Camera); ((SoundService)Services.GetService(typeof(SoundService))).CameraService = Camera; Parallax = new Parallax(); KillDisplay = new KillDisplay(ChampionsInfo); GameScore = new GameScore(); Sound = (SoundService)Services.GetService(typeof(SoundService)); }
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; } } }