Exemple #1
0
        /// <summary>
        /// Check for recent server update to apply to our local perception of the game (movement
        /// correction, etc.)
        /// </summary>
        void ApplyServerModifications()
        {
            if (OurChampion != null && LastStateUpdateData.Count > 0)
            {
                foreach (StateUpdateData state in LastStateUpdateData)
                {
                    if (Match.CurrentState.ContainsEntity(state.ID))
                    {
                        IEntity        entity = Match.CurrentState.GetEntity(state.ID);
                        ClientChampion champ  = (ClientChampion)entity;
                        champ.AuthoritativeChangePosition(state, TimeOfLastStateUpdate);
                    }
                }
                LastStateUpdateData.Clear();

                ApplyRemarkableEvents();
            }
        }
Exemple #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;
                }
            }
        }