public override void Update(float elapsedSeconds) { foreach (Entity e in this.actives.Values) { ScoreComponent score = e.GetComponent <ScoreComponent>(); LifeComponent life = e.GetComponent <LifeComponent>(); System.Diagnostics.Debug.Assert(score != null, "ScoreComponent not found"); System.Diagnostics.Debug.Assert(life != null, "LifeComponent not found"); this.scoreboard.AddOrUpdate(e.EntityId, score.Value, life.Lives); } }
private void HandlePlayerPingPacket(PlayerPingPacket p) { Entity e = this.entityWorld.EntityManager.GetEntity(p.EntityId); if (e != null) { ScoreComponent score = e.GetComponent <ScoreComponent>(); LifeComponent life = e.GetComponent <LifeComponent>(); System.Diagnostics.Debug.Assert(score != null, "PositionComponent not found"); System.Diagnostics.Debug.Assert(life != null, "VelocityComponent not found"); this.scoreboardUI.AddOrUpdate(p.EntityId, p.Ping); } }
private void HandleScoreboardData(ScoreboardDataPacket p) { Entity e = this.entityWorld.EntityManager.GetEntity(p.EntityId); if (e != null) { ScoreComponent score = e.GetComponent <ScoreComponent>(); LifeComponent life = e.GetComponent <LifeComponent>(); System.Diagnostics.Debug.Assert(score != null, "PositionComponent not found"); System.Diagnostics.Debug.Assert(life != null, "VelocityComponent not found"); score.Value = p.Score; life.Lives = p.Lives; if (p.EntityRespawned) { e.AddComponent(new ShieldComponent()); e.GetComponent <RespawnComponent>().TimeSinceRespawn = 0; } } }