public override void ReceiveUpdate(BSONObject bsonObj) { // Store the received position if valid. if (bsonObj.TryGetValue("pos", out var pos) && Vector3.IsValid(pos.Vector3Value)) { this.Position = pos; } // If the Lure has no controller or has descended below the world, destroy it. bsonObj.TryGetValue("controlled", out var controlled); if ((this.Position.y < -30.0f) || !controlled) { this.Destroy(); } base.ReceiveUpdate(bsonObj); }
private Event.Event createEventFromNetworkRPCEvent(INetClient client, NetworkEvent netEvent, BSONObject bson) { BSONValue value; bson.TryGetValue("method", out value); string methodname = value.StringValue; switch (methodname) { case "KeepAlive": return(FireEventTool.call(new KeepAliveEvent(client, netEvent, bson, methodname))); case "PlayerInteract": return(FireEventTool.call(new PlayerInteract(client, netEvent, bson, methodname))); default: return(FireEventTool.call(new NotregistredRPCMethodEvent(client, netEvent, bson, methodname))); } return(null); }
public override void ReceiveUpdate(BSONObject bsonObj) { BSONValue cageUpdate; if (bsonObj.TryGetValue("cage", out cageUpdate)) { this.cagePos = cageUpdate.ObjectValue["pos"].Vector3Value.y; bsonObj["time"] = cageUpdate.ObjectValue["time"].FloatValue; if (cageUpdate.ObjectValue.ContainsKey("v")) { this.v = cageUpdate.ObjectValue["v"].Vector3Value.y; } } base.ReceiveUpdate(bsonObj); if (bsonObj.ContainsKey("stop")) { this.v = 0f; this.AnimatedStates["dir"] = 0f; } this.SetDirty(); }