public override void Update(GameTime gameTime) { root.update(gameTime); foreach (KeyValuePair<string, CActor> kvp in actors) { //first get messages from the commNet if (CMasterControl.commNet[(int)_address].Count() > 0) { CActorPacket[] packetData = new CActorPacket[CMasterControl.commNet[(int)_address].Count()]; CMasterControl.commNet[(int)_address].CopyTo(packetData); var group = from packets in packetData where kvp.Key == packets.actor select packets; foreach (var result in group) { //pass the message to the actor CActor temp = kvp.Value; passMessage(ref temp, (uint)result.userEventID, result.getParams()); CMasterControl.commNet[(int)_address].Remove(result); } } //update position relative to the root kvp.Value.position += root.distanceFromLastFrame; //update the f****t kvp.Value.update(gameTime); } }
public override void Update(GameTime gameTime) { root.update(gameTime); foreach (KeyValuePair <string, CActor> kvp in actors) { //first get messages from the commNet if (CMasterControl.commNet[(int)_address].Count() > 0) { CActorPacket[] packetData = new CActorPacket[CMasterControl.commNet[(int)_address].Count()]; CMasterControl.commNet[(int)_address].CopyTo(packetData); var group = from packets in packetData where kvp.Key == packets.actor select packets; foreach (var result in group) { //pass the message to the actor CActor temp = kvp.Value; passMessage(ref temp, (uint)result.userEventID, result.getParams()); CMasterControl.commNet[(int)_address].Remove(result); } } //update position relative to the root if (kvp.Value._followRoot) { kvp.Value.position += root.distanceFromLastFrame; } //update kvp.Value.update(gameTime); } }
private void _checkCommNet(string type, CActor actor) { if (CMasterControl.commNet[(int)_address].Count() > 0) { CActorPacket[] packetData = new CActorPacket[CMasterControl.commNet[(int)_address].Count()]; CMasterControl.commNet[(int)_address].CopyTo(packetData); var group = from packets in packetData where type == packets.actor select packets; foreach (var result in group) { //pass the message to the actor CActor temp = actor; passMessage(ref temp, result.sender, (uint)result.userEventID, result.getParams()); CMasterControl.commNet[(int)_address].Remove(result); } } }