예제 #1
0
		/// <summary>
		/// Parses the next tick of the demo.
		/// </summary>
		/// <returns><c>true</c>, if this wasn't the last tick, <c>false</c> otherwise.</returns>
		public bool ParseNextTick()
		{
			if (Header == null)
				throw new InvalidOperationException ("You need to call ParseHeader first before you call ParseToEnd or ParseNextTick!");

			bool b = ParseTick();
			
			for (int i = 0; i < RawPlayers.Length; i++) {
				if (RawPlayers[i] == null)
					continue;

				var rawPlayer = RawPlayers[i];

				int id = rawPlayer.UserID;

				if (PlayerInformations[i] != null) { //There is an good entity for this
					bool newplayer = false;
					if (!Players.ContainsKey(id)){
						Players[id] = PlayerInformations[i];
						newplayer = true;
					}

					Player p = Players[id];
					p.Name = rawPlayer.Name;
					p.SteamID = rawPlayer.XUID;

					p.AdditionaInformations = additionalInformations [p.EntityID];

					if (p.IsAlive) {
						p.LastAlivePosition = p.Position.Copy();
					}

					if (newplayer && p.SteamID != 0){
						PlayerBindEventArgs bind = new PlayerBindEventArgs();
						bind.Player = p;
						RaisePlayerBind(bind);
					}
				}
			}

			if (b) {
				if (TickDone != null)
					TickDone(this, new TickDoneEventArgs());
			}

			return b;
		}
예제 #2
0
		internal void RaisePlayerBind(PlayerBindEventArgs bind)
		{
			if (PlayerBind != null)
				PlayerBind(this, bind);
		}