public ContactPoint(Vector3 position, Vector3 surfaceNormal, float penetrationDepth, ActorTypes type) { Type = type; Position = position; SurfaceNormal = surfaceNormal; PenetrationDepth = penetrationDepth; }
public void WriteToFile(BinaryWriter writer) { Dictionary <int, int> sanitizedIDs = new Dictionary <int, int>(); // Cutscenes to save at the end of the file. List <ActorEntry> cutsceneEntries = new List <ActorEntry>(); Sanitize(); pool = BuildDefinitions(); writer.Write(pool.Length); StringHelpers.WriteString(writer, pool, false); writer.Write(definitions.Count); for (int i = 0; i < definitions.Count; i++) { definitions[i].WriteToFile(writer); } long instancePos = writer.BaseStream.Position; writer.Write(0); writer.Write(const6); writer.Write(const2); writer.Write(const16); writer.Write(int.MinValue); //size writer.Write(int.MinValue); //unk12 int instanceOffset = ((extraData.Count * sizeof(int)) + 8); writer.Write(0); //could do it so we seek to offset and save each one, but that would decrease performance. for (int i = 0; i < extraData.Count; i++) { writer.Write(instanceOffset); instanceOffset += (extraData[i].Data != null ? extraData[i].Data.GetSize() : extraData[i].GetDataInBytes().Length) + 8; } for (int i = 0; i < extraData.Count; i++) { extraData[i].WriteToFile(writer); } int itemOffset = instanceOffset + (items.Count * sizeof(int)) + 16; long itemPos = writer.BaseStream.Position; writer.Write(items.Count); for (int i = 0; i < items.Count; i++) { writer.Write(itemOffset); itemOffset += items[i].CalculateSize(); } for (int i = 0; i < items.Count; i++) { items[i].WriteToFile(writer); // We need to store cutscenes so we can save them for later. ActorTypes actorType = (ActorTypes)items[i].ActorTypeID; if (actorType == ActorTypes.C_Cutscene) { cutsceneEntries.Add(items[i]); } } // Now we try and save the cutscene data which is stored at the bottom of the file. long cutsceneEntryOffset = writer.BaseStream.Position; long[] cutsceneOffsets = new long[cutsceneEntries.Count]; writer.Write(cutsceneEntries.Count); // TODO: Maybe consider doing one loop rather than two. for (int i = 0; i < cutsceneEntries.Count; i++) { ActorEntry cutscene = cutsceneEntries[i]; // Save our 'TEMP' offset; this stored the ptr to the string. cutsceneOffsets[i] = writer.BaseStream.Position; writer.Write(-1); } for (int i = 0; i < cutsceneEntries.Count; i++) { ActorEntry cutscene = cutsceneEntries[i]; // Now we save the cutscene entity name and save the new offset; uint nameOffset = (uint)writer.BaseStream.Position; StringHelpers.WriteString(writer, cutscene.EntityName); writer.Write((ushort)0); long completeOffset = writer.BaseStream.Position; // Update our new offset and then return to our original offset; writer.BaseStream.Seek(cutsceneOffsets[i], SeekOrigin.Begin); uint newOffset = (uint)(nameOffset - (instancePos + 4)); writer.Write(newOffset); writer.BaseStream.Seek(completeOffset, SeekOrigin.Begin); } //for that unknown value. long endPos = cutsceneEntryOffset - instancePos - 4; long instanceLength = writer.BaseStream.Position - instancePos - 4; long unk = writer.BaseStream.Position - itemPos; long size = instanceLength - unk; writer.BaseStream.Seek(instancePos, SeekOrigin.Begin); writer.Write((int)(instanceLength)); writer.Write(const6); writer.Write(const2); writer.Write(const16); writer.Write((int)size); //size writer.Write((int)(endPos)); //unk12 }
public d.Contact GetContactPoint (ActorTypes actorType) { d.Contact contact = new d.Contact (); //Defaults contact.surface.mode |= d.ContactFlags.SoftERP; contact.surface.soft_cfm = 0.010f; contact.surface.soft_erp = 0.010f; float restSquared = _parent_entity.Restitution * _parent_entity.Restitution; contact.surface.bounce = _parent_entity.Restitution * (Velocity.Z * -(restSquared));//Its about 1:1 surprisingly, even though this constant was for havok if (contact.surface.bounce > 1.5f) contact.surface.bounce = 0.75f; //Limit the bouncing please... contact.surface.bounce_vel = 0.05f * _parent_entity.Restitution * (-Velocity.Z * restSquared); //give it a good amount of bounce and have it depend on how much velocity is there too contact.surface.mode |= d.ContactFlags.Bounce; //Add bounce contact.surface.mu = 800; if(actorType == ActorTypes.Prim) contact.surface.mu *= _parent_entity.Friction; if (m_vehicle.Type != Vehicle.TYPE_NONE) contact.surface.mu *= 0.05f; contact.surface.mu2 = contact.surface.mu; return contact; }
// I've collided with something public void Collide(uint collidingWith, ActorTypes type, OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth) { // m_log.DebugFormat("{0}: Collide: ms={1}, id={2}, with={3}", LogHeader, _subscribedEventsMs, LocalID, collidingWith); // The following lines make IsColliding() and IsCollidingGround() work _collidingStep = _scene.SimulationStep; if (collidingWith == BSScene.TERRAIN_ID || collidingWith == BSScene.GROUNDPLANE_ID) { _collidingGroundStep = _scene.SimulationStep; } if (_subscribedEventsMs == 0) return; // nothing in the object is waiting for collision events // throttle the collisions to the number of milliseconds specified in the subscription int nowTime = _scene.SimulationNowTime; if (nowTime < (_lastCollisionTime + _subscribedEventsMs)) return; _lastCollisionTime = nowTime; // create the event for the collision Dictionary<uint, ContactPoint> contactPoints = new Dictionary<uint, ContactPoint>(); contactPoints.Add(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); CollisionEventUpdate args = new CollisionEventUpdate(contactPoints); base.SendCollisionUpdate(args); }
/// <summary> /// Set the Comparators needed to handle each message in the Transaction. /// </summary> /// <param name="comparatorCollection">Comparator collection to fill.</param> public void SetComparators(Dvtk.Comparator.BaseComparatorCollection comparatorCollection) { if (_transaction is DicomTransaction) { System.String name = System.String.Empty; DicomTransaction dicomTransaction = (DicomTransaction)_transaction; switch (dicomTransaction.Direction) { case TransactionDirectionEnum.TransactionReceived: name = System.String.Format("Received by {0}:{1} from {2}:{3}", ActorTypes.Type(_toActorName.Type), _toActorName.Id, ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); break; case TransactionDirectionEnum.TransactionSent: name = System.String.Format("Sent from {0}:{1} to {2}:{3}", ActorTypes.Type(_toActorName.Type), _toActorName.Id, ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); break; default: break; } for (int i = 0; i < dicomTransaction.DicomMessages.Count; i++) { DicomMessage dicomMessage = (DicomMessage)dicomTransaction.DicomMessages[i]; DvtkHighLevelInterface.Comparator.Comparator comparator = new DvtkHighLevelInterface.Comparator.Comparator(name); Dvtk.Comparator.DicomComparator dicomComparator = comparator.InitializeDicomComparator(dicomMessage); if (dicomComparator != null) { comparatorCollection.Add(dicomComparator); } } } else if (_transaction is Hl7Transaction) { System.String name = System.String.Empty; Hl7Transaction hl7Transaction = (Hl7Transaction)_transaction; switch (hl7Transaction.Direction) { case TransactionDirectionEnum.TransactionReceived: name = System.String.Format("Received by {0}:{1} from {2}:{3}", ActorTypes.Type(_toActorName.Type), _toActorName.Id, ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); break; case TransactionDirectionEnum.TransactionSent: name = System.String.Format("Sent from {0}:{1} to {2}:{3}", ActorTypes.Type(_toActorName.Type), _toActorName.Id, ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); break; default: break; } Hl7Message hl7Message = hl7Transaction.Request; DvtkHighLevelInterface.Comparator.Comparator comparator = new DvtkHighLevelInterface.Comparator.Comparator(name); Dvtk.Comparator.Hl7Comparator hl7Comparator = comparator.InitializeHl7Comparator(hl7Message); if (hl7Comparator != null) { comparatorCollection.Add(hl7Comparator); } } }
/// <summary> /// Log the transaction to the given stream. /// </summary> /// <param name="sw">Stream Writer - log the transaction to this stream.</param> public void LogToStream(StreamWriter sw) { sw.WriteLine("<<- {0} -------------------------------------------------------------->>", _transactionNumber); if (_transaction is DicomTransaction) { DicomTransaction dicomTransaction = (DicomTransaction)_transaction; switch (dicomTransaction.Direction) { case TransactionDirectionEnum.TransactionSent: sw.WriteLine("DICOM Transaction received by {0}:{1}", ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); sw.WriteLine("from {0}:{1}", ActorTypes.Type(_toActorName.Type), _toActorName.Id); break; case TransactionDirectionEnum.TransactionReceived: sw.WriteLine("DICOM Transaction sent from {0}:{1}", ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); sw.WriteLine("to {0}:{1}", ActorTypes.Type(_toActorName.Type), _toActorName.Id); break; default: break; } sw.WriteLine("{0} errors, {1} warnings", _nrErrors, _nrWarnings); for (int i = 0; i < dicomTransaction.DicomMessages.Count; i++) { sw.WriteLine("DICOM Message {0}...", i + 1); DicomMessage dicomMessage = (DicomMessage)dicomTransaction.DicomMessages[i]; if (dicomMessage.CommandSet != null) { sw.WriteLine("Command: {0} \"{1}\"", dicomMessage.CommandSet.DimseCommandName, dicomMessage.CommandSet.GetSopClassUid()); } if (dicomMessage.DataSet != null) { sw.WriteLine("Dataset Attributes: {0}", dicomMessage.DataSet.Count); } } } else { Hl7Transaction hl7Transaction = (Hl7Transaction)_transaction; switch (hl7Transaction.Direction) { case TransactionDirectionEnum.TransactionSent: sw.WriteLine("HL7 Transaction received by {0}:{1}", ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); sw.WriteLine("from {0}:{1}", ActorTypes.Type(_toActorName.Type), _toActorName.Id); break; case TransactionDirectionEnum.TransactionReceived: sw.WriteLine("HL7 Transaction sent from {0}:{1}", ActorTypes.Type(_fromActorName.Type), _fromActorName.Id); sw.WriteLine("to {0}:{1}", ActorTypes.Type(_toActorName.Type), _toActorName.Id); break; default: break; } sw.WriteLine("{0} errors, {1} warnings", _nrErrors, _nrWarnings); } sw.WriteLine("Results Filename: \"{0}\"", _resultsFilename); sw.WriteLine("Results Pathname: \"{0}\"", _resultsPathname); sw.WriteLine("<<------------------------------------------------------------------>>"); }
public static string GetActorId(Actor.Modes mode, ActorTypes type, string name) { return(mode.ToString() + "_" + type + "_" + name); }
public PossibleSelection(ActorTypes type, IBaseMemoryOffset address, string actorId, string name, Modes mode) : base(type, address, actorId, name, mode) { }
public void ReadFromFile(BinaryReader reader) { buffer = null; data = null; bufferType = (ActorTypes)reader.ReadInt32(); uint bufferLength = reader.ReadUInt32(); buffer = reader.ReadBytes((int)bufferLength); bool parsed = false; using (MemoryStream stream = new MemoryStream(buffer)) { bool isBigEndian = false; //we'll change this once console parsing is complete. if (bufferType == ActorTypes.Pinup && bufferLength == 4) { data = new ActorPinup(stream, isBigEndian); parsed = true; } else if (bufferType == ActorTypes.ScriptEntity && bufferLength == 100) { data = new ActorScriptEntity(stream, isBigEndian); parsed = true; } //else if (bufferType == ActorTypes.Radio && bufferLength == 1028) //{ // data = new ActorRadio(stream, isBigEndian); //} else if (bufferType == ActorTypes.Airplane && bufferLength == 4) { data = new ActorAircraft(stream, isBigEndian); parsed = true; } else if (bufferType == ActorTypes.SpikeStrip && bufferLength == 4) { data = new ActorSpikeStrip(stream, isBigEndian); parsed = true; } else if (bufferType == ActorTypes.Door && bufferLength == 364) { data = new ActorDoor(stream, isBigEndian); parsed = true; } else if (bufferType == ActorTypes.Wardrobe && bufferLength == 208) { data = new ActorWardrobe(stream, isBigEndian); parsed = true; } else if (bufferType == ActorTypes.TrafficTrain && bufferLength == 180) { data = new ActorTrafficTrain(stream, isBigEndian); parsed = true; } else if (bufferType == ActorTypes.TrafficHuman && bufferLength == 160) { data = new ActorTrafficHuman(stream, isBigEndian); parsed = true; } else if (bufferType == ActorTypes.TrafficCar && bufferLength == 220) { data = new ActorTrafficCar(stream, isBigEndian); parsed = true; } else if (bufferType == ActorTypes.LightEntity && bufferLength == 2316) { data = new ActorLight(stream, isBigEndian); parsed = true; } else if (bufferType == ActorTypes.Item && bufferLength == 152) { data = new ActorItem(stream, isBigEndian); parsed = true; } else if (bufferType == ActorTypes.Sound && bufferLength == 592) { data = new ActorSoundEntity(stream, isBigEndian); parsed = true; } else if (bufferType == ActorTypes.CleanEntity && bufferLength == 20) { data = new ActorCleanEntity(stream, isBigEndian); parsed = true; } } if (parsed) { buffer = null; } }
private void GetEntities() { try { Selection.Modes mode = this.selection.GetMode(); ActorTableOffset actorTableOffset; BaseOffset targetOffset; // clear the entity list this.Entities.Clear(); if (mode == Selection.Modes.GPose) { actorTableOffset = Offsets.GposeActorTable; targetOffset = Offsets.Gpose; } else if (mode == Selection.Modes.Overworld) { actorTableOffset = Offsets.ActorTable; targetOffset = Offsets.Target; } else { throw new Exception("Unknown selection mode: " + mode); } byte count = actorTableOffset.GetCount(); HashSet <string> ids = new HashSet <string>(); for (byte i = 0; i < count; i++) { ActorTypes type = actorTableOffset.GetActorValue(i, Offsets.ActorType); string name = actorTableOffset.GetActorValue(i, Offsets.Name); string id = mode.ToString() + "_" + type + "_" + name; if (ids.Contains(id)) { continue; } ids.Add(id); if (string.IsNullOrEmpty(name)) { name = "Unknown"; } PossibleSelection selection = new PossibleSelection(type, targetOffset, id, name, mode); selection.IsSelected = !this.selection.UseGameTarget && this.selection.CurrentSelection != null && this.selection.CurrentSelection.Name == name; this.Entities.Add(selection); } this.AutoRadio.IsChecked = this.selection.UseGameTarget; if (this.selection.CurrentGameTarget != null) { this.InGameSelection = this.selection.CurrentGameTarget.Name; this.InGameIcon = this.selection.CurrentGameTarget.Type.GetIcon(); } else { this.InGameSelection = null; this.InGameIcon = IconChar.None; } } catch (Exception ex) { Log.Write(ex); } }
public static IActorExtraDataInterface LoadExtraData(ActorTypes type, MemoryStream stream, bool isBigEndian) { switch (type) { case ActorTypes.Human: return(new ActorHuman(stream, isBigEndian)); case ActorTypes.C_TrafficCar: return(new ActorTrafficCar(stream, isBigEndian)); case ActorTypes.C_TrafficHuman: return(new ActorTrafficHuman(stream, isBigEndian)); case ActorTypes.C_TrafficTrain: return(new ActorTrafficTrain(stream, isBigEndian)); case ActorTypes.C_Item: return(new ActorItem(stream, isBigEndian)); case ActorTypes.C_Door: return(new ActorDoor(stream, isBigEndian)); case ActorTypes.C_Sound: return(new ActorSoundEntity(stream, isBigEndian)); case ActorTypes.Radio: return(new ActorRadio(stream, isBigEndian)); case ActorTypes.StaticEntity: return(new ActorStaticEntity(stream, isBigEndian)); case ActorTypes.FrameWrapper: return(new ActorFrameWrapper(stream, isBigEndian)); case ActorTypes.C_ActorDetector: return(new ActorActorDetector(stream, isBigEndian)); case ActorTypes.C_StaticParticle: return(new ActorStaticParticle(stream, isBigEndian)); case ActorTypes.LightEntity: return(new ActorLight(stream, isBigEndian)); case ActorTypes.C_ScriptEntity: return(new ActorScriptEntity(stream, isBigEndian)); case ActorTypes.C_Pinup: return(new ActorPinup(stream, isBigEndian)); case ActorTypes.SpikeStrip: return(new ActorSpikeStrip(stream, isBigEndian)); case ActorTypes.Wardrobe: return(new ActorWardrobe(stream, isBigEndian)); case ActorTypes.CleanEntity: return(new ActorCleanEntity(stream, isBigEndian)); default: return(null); } }
public void Collide(uint collidingWith, ActorTypes type, Vector3 contactPoint, Vector3 contactNormal, float pentrationDepth) { // MainConsole.Instance.DebugFormat("{0}: Collide: ms={1}, id={2}, with={3}", LogHeader, _subscribedEventsMs, LocalID, collidingWith); // The following makes IsColliding() and IsCollidingGround() work _collidingStep = _scene.SimulationStep; if (collidingWith == BSScene.TERRAIN_ID || collidingWith == BSScene.GROUNDPLANE_ID) { _collidingGroundStep = _scene.SimulationStep; } Dictionary<uint, ContactPoint> contactPoints = new Dictionary<uint, ContactPoint>(); AddCollisionEvent(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth, type)); }
public void GetContactParam(ActorTypes actorType, ref d.Contact contact) { if ((_parent != null && _parent.VehicleType != (int)Vehicle.TYPE_NONE) || VehicleType != (int)Vehicle.TYPE_NONE) { contact.surface.bounce = vehicleContactParam.bounce; contact.surface.bounce_vel = 0; contact.surface.mu = vehicleContactParam.mu; } else { float restSquared = _parent_entity.Restitution * _parent_entity.Restitution * _parent_entity.Restitution; float maxVel = Velocity.Z < -1f ? -1f : Velocity.Z > 1f ? 1f : Velocity.Z; contact.surface.bounce = (maxVel * -(restSquared));//Its about 1:1 surprisingly, even though this constant was for havok if (contact.surface.bounce > 1.5f) contact.surface.bounce = 0.5f; //Limit the bouncing please... if (contact.surface.bounce <= 0) { contact.surface.bounce = 0; contact.surface.bounce_vel = 0; } else contact.surface.bounce_vel = 0.01f * restSquared * (-maxVel * restSquared); //give it a good amount of bounce and have it depend on how much velocity is there too contact.surface.mu = 800; if (contact.surface.bounce_vel != 0) contact.surface.mode |= d.ContactFlags.Bounce; else contact.surface.mode &= d.ContactFlags.Bounce; if (actorType == ActorTypes.Prim) contact.surface.mu *= _parent_entity.Friction; else if (actorType == ActorTypes.Ground) contact.surface.mu *= 2; else contact.surface.mu /= 2; if (m_vehicle.Type != Vehicle.TYPE_NONE && actorType != ActorTypes.Agent) contact.surface.mu *= 0.05f; } }
public Role(Person person, string rolename, ActorTypes actortype) : base(person, CreditTypes.Actor) { this.rolename = rolename; this.actortype = actortype; }
/// <summary> /// Initializes a new instance of the <see cref="PersonDetails"/> class. /// </summary> /// <param name="type"><see cref="ActorTypes"/>.</param> public PersonDetails(ActorTypes type) { this.PersonType = type; }
public static IActorExtraDataInterface LoadExtraData(ActorTypes type, MemoryStream stream, bool isBigEndian) { switch (type) { case ActorTypes.Human: return(new ActorHuman(stream, isBigEndian)); case ActorTypes.C_CrashObject: return(new ActorCrashObject(stream, isBigEndian)); case ActorTypes.C_TrafficCar: return(new ActorTrafficCar(stream, isBigEndian)); case ActorTypes.C_TrafficHuman: return(new ActorTrafficHuman(stream, isBigEndian)); case ActorTypes.C_TrafficTrain: return(new ActorTrafficTrain(stream, isBigEndian)); case ActorTypes.ActionPoint: return(new ActorActionPoint(stream, isBigEndian)); case ActorTypes.ActionPointScript: return(new ActorActionPointScript(stream, isBigEndian)); case ActorTypes.ActionPointSearch: return(new ActorActionPointSearch(stream, isBigEndian)); case ActorTypes.C_Item: return(new ActorItem(stream, isBigEndian)); case ActorTypes.C_Door: return(new ActorDoor(stream, isBigEndian)); case ActorTypes.Tree: return(new ActorTree(stream, isBigEndian)); case ActorTypes.C_Sound: return(new ActorSoundEntity(stream, isBigEndian)); case ActorTypes.Radio: return(new ActorRadio(stream, isBigEndian)); case ActorTypes.StaticEntity: return(new ActorStaticEntity(stream, isBigEndian)); case ActorTypes.Garage: return(new ActorGarage(stream, isBigEndian)); case ActorTypes.FrameWrapper: return(new ActorFrameWrapper(stream, isBigEndian)); case ActorTypes.C_ActorDetector: return(new ActorActorDetector(stream, isBigEndian)); case ActorTypes.Blocker: return(new ActorBlocker(stream, isBigEndian)); case ActorTypes.C_StaticParticle: return(new ActorStaticParticle(stream, isBigEndian)); case ActorTypes.LightEntity: return(new ActorLight(stream, isBigEndian)); case ActorTypes.C_Cutscene: return(new ActorCutscene(stream, isBigEndian)); case ActorTypes.C_ScriptEntity: return(new ActorScriptEntity(stream, isBigEndian)); case ActorTypes.C_Pinup: return(new ActorPinup(stream, isBigEndian)); case ActorTypes.SpikeStrip: return(new ActorSpikeStrip(stream, isBigEndian)); case ActorTypes.Wardrobe: return(new ActorWardrobe(stream, isBigEndian)); case ActorTypes.CleanEntity: return(new ActorCleanEntity(stream, isBigEndian)); default: Console.WriteLine("Cannot read type: " + type); return(null); } }
public static IActorExtraDataInterface CreateExtraData(ActorTypes type) { switch (type) { case ActorTypes.Human: return(new ActorHuman()); case ActorTypes.C_CrashObject: return(new ActorCrashObject()); case ActorTypes.C_TrafficCar: return(new ActorTrafficCar()); case ActorTypes.C_TrafficHuman: return(new ActorTrafficHuman()); case ActorTypes.C_TrafficTrain: return(new ActorTrafficTrain()); case ActorTypes.ActionPoint: return(new ActorActionPoint()); case ActorTypes.ActionPointScript: return(new ActorActionPointScript()); case ActorTypes.ActionPointSearch: return(new ActorActionPointSearch()); case ActorTypes.C_Item: return(new ActorItem()); case ActorTypes.C_Door: return(new ActorDoor()); case ActorTypes.Tree: return(new ActorTree()); case ActorTypes.C_Sound: return(new ActorSoundEntity()); case ActorTypes.StaticEntity: return(new ActorStaticEntity()); case ActorTypes.Garage: return(new ActorGarage()); case ActorTypes.FrameWrapper: return(new ActorFrameWrapper()); case ActorTypes.C_ActorDetector: return(new ActorActorDetector()); case ActorTypes.Blocker: return(new ActorBlocker()); case ActorTypes.C_StaticParticle: return(new ActorStaticParticle()); case ActorTypes.LightEntity: return(new ActorLight()); case ActorTypes.C_Cutscene: return(new ActorCutscene()); case ActorTypes.C_ScriptEntity: return(new ActorScriptEntity()); case ActorTypes.C_Pinup: return(new ActorPinup()); default: throw new NotImplementedException(); } }
public void Collide(uint collidingWith, ActorTypes type, Vector3 contactPoint, Vector3 contactNormal, float pentrationDepth) { // m_log.DebugFormat("{0}: Collide: ms={1}, id={2}, with={3}", LogHeader, _subscribedEventsMs, LocalID, collidingWith); // The following makes IsColliding() and IsCollidingGround() work _collidingStep = _scene.SimulationStep; if (collidingWith == BSScene.TERRAIN_ID || collidingWith == BSScene.GROUNDPLANE_ID) { _collidingGroundStep = _scene.SimulationStep; } // throttle collisions to the rate specified in the subscription if (_subscribedEventsMs == 0) return; // don't want collisions int nowTime = _scene.SimulationNowTime; if (nowTime < (_lastCollisionTime + _subscribedEventsMs)) return; _lastCollisionTime = nowTime; Dictionary<uint, ContactPoint> contactPoints = new Dictionary<uint, ContactPoint>(); contactPoints.Add(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); CollisionEventUpdate args = new CollisionEventUpdate(LocalID, (int)type, 1, contactPoints); base.SendCollisionUpdate(args); }
/// <summary> /// Load the Actor Configuration into the Integration Profile. /// </summary> /// <param name="configurationFilename">Configuration Filename</param> public void Load(System.String configurationFilename) { _actorConfigCollection = new ActorConfigCollection(); _peerToPeerConfigCollection = new BasePeerToPeerConfigCollection(); try { XmlTextReader reader = new XmlTextReader(configurationFilename); while (reader.EOF == false) { reader.ReadStartElement("IheIntegrationProfile"); _profileName = reader.ReadElementString("IntegrationProfileName"); _commonConfig.RootedBaseDirectory = reader.ReadElementString("RootedBaseDirectory"); _commonConfig.ResultsDirectory = reader.ReadElementString("ResultsDirectory"); // read OverwriteResults - added later - some config files may not contain this parameter reader.ReadString(); if (reader.Name == "OverwriteResults") { System.String overwriteResults = reader.ReadElementString("OverwriteResults"); if (overwriteResults == "True") { _commonConfig.OverwriteResults = true; } else { _commonConfig.OverwriteResults = false; } } _commonConfig.CredentialsFilename = reader.ReadElementString("CredentialsFilename"); _commonConfig.CertificateFilename = reader.ReadElementString("CertificateFilename"); _commonConfig.NistWebServiceUrl = reader.ReadElementString("NistWebServiceUrl"); _commonConfig.Hl7ProfileDirectory = reader.ReadElementString("Hl7ProfileDirectory"); _commonConfig.Hl7ProfileStoreName = reader.ReadElementString("Hl7ProfileStoreName"); _commonConfig.Hl7ValidationContextFilename = reader.ReadElementString("Hl7ValidationContextFilename"); System.String interactive = reader.ReadElementString("Interactive"); if (interactive == "True") { _commonConfig.Interactive = true; } else { _commonConfig.Interactive = false; } while ((reader.IsStartElement()) && (reader.Name == "ActorConfiguration")) { reader.ReadStartElement("ActorConfiguration"); reader.ReadStartElement("ActorName"); ActorTypeEnum actorType = ActorTypes.TypeEnum(reader.ReadElementString("ActorType")); System.String id = reader.ReadElementString("ActorId"); ActorName actorName = new ActorName(actorType, id); reader.ReadEndElement(); ActorConfigStateEnum configState = ActorConfigState.ConfigStateEnum(reader.ReadElementString("ConfigState")); ActorConfig actorConfig = new ActorConfig(actorName, configState); _actorConfigCollection.Add(actorConfig); reader.ReadEndElement(); } while ((reader.IsStartElement()) && ((reader.Name == "DicomPeerToPeerConfiguration") || (reader.Name == "Hl7PeerToPeerConfiguration"))) { if (reader.Name == "DicomPeerToPeerConfiguration") { DicomPeerToPeerConfig dicomPeerToPeerConfig = new DicomPeerToPeerConfig(); reader.ReadStartElement("DicomPeerToPeerConfiguration"); reader.ReadStartElement("FromActor"); reader.ReadStartElement("ActorName"); ActorTypeEnum actorType = ActorTypes.TypeEnum(reader.ReadElementString("ActorType")); System.String id = reader.ReadElementString("ActorId"); ActorName actorName = new ActorName(actorType, id); dicomPeerToPeerConfig.FromActorName = actorName; reader.ReadEndElement(); dicomPeerToPeerConfig.FromActorAeTitle = reader.ReadElementString("AeTitle"); reader.ReadEndElement(); reader.ReadStartElement("ToActor"); reader.ReadStartElement("ActorName"); actorType = ActorTypes.TypeEnum(reader.ReadElementString("ActorType")); id = reader.ReadElementString("ActorId"); actorName = new ActorName(actorType, id); dicomPeerToPeerConfig.ToActorName = actorName; reader.ReadEndElement(); dicomPeerToPeerConfig.ToActorAeTitle = reader.ReadElementString("AeTitle"); dicomPeerToPeerConfig.ToActorIpAddress = reader.ReadElementString("IpAddress"); reader.ReadEndElement(); dicomPeerToPeerConfig.PortNumber = UInt16.Parse(reader.ReadElementString("PortNumber")); System.String secureConnection = reader.ReadElementString("SecureConnection"); if (secureConnection == "True") { dicomPeerToPeerConfig.SecureConnection = true; } else { dicomPeerToPeerConfig.SecureConnection = false; } // read AutoValidate - added later - some config files may not contain this parameter reader.ReadString(); if (reader.Name == "AutoValidate") { System.String autoValidate = reader.ReadElementString("AutoValidate"); if (autoValidate == "True") { dicomPeerToPeerConfig.AutoValidate = true; } else { dicomPeerToPeerConfig.AutoValidate = false; } } dicomPeerToPeerConfig.ActorOption1 = reader.ReadElementString("ActorOption1"); dicomPeerToPeerConfig.ActorOption2 = reader.ReadElementString("ActorOption2"); dicomPeerToPeerConfig.ActorOption3 = reader.ReadElementString("ActorOption3"); dicomPeerToPeerConfig.SessionId = UInt16.Parse(reader.ReadElementString("SessionId")); dicomPeerToPeerConfig.SourceDataDirectory = reader.ReadElementString("SourceDataDirectory"); dicomPeerToPeerConfig.StoreDataDirectory = reader.ReadElementString("StoreDataDirectory"); System.String storeData = reader.ReadElementString("StoreData"); if (storeData == "True") { dicomPeerToPeerConfig.StoreData = true; } else { dicomPeerToPeerConfig.StoreData = false; } reader.ReadStartElement("DefinitionFiles"); bool readingDefinitionFiles = true; while (readingDefinitionFiles == true) { dicomPeerToPeerConfig.AddDefinitionFile(reader.ReadElementString("DefinitionFile")); reader.Read(); if ((reader.NodeType == XmlNodeType.EndElement) && (reader.Name == "DefinitionFiles")) { reader.Read(); readingDefinitionFiles = false; } } _peerToPeerConfigCollection.Add(dicomPeerToPeerConfig); reader.ReadEndElement(); } else { Hl7PeerToPeerConfig hl7PeerToPeerConfig = new Hl7PeerToPeerConfig(); reader.ReadStartElement("Hl7PeerToPeerConfiguration"); reader.ReadStartElement("FromActor"); reader.ReadStartElement("ActorName"); ActorTypeEnum actorType = ActorTypes.TypeEnum(reader.ReadElementString("ActorType")); System.String id = reader.ReadElementString("ActorId"); ActorName actorName = new ActorName(actorType, id); hl7PeerToPeerConfig.FromActorName = actorName; reader.ReadEndElement(); hl7PeerToPeerConfig.FromActorAeTitle = reader.ReadElementString("AeTitle"); reader.ReadEndElement(); reader.ReadStartElement("ToActor"); reader.ReadStartElement("ActorName"); actorType = ActorTypes.TypeEnum(reader.ReadElementString("ActorType")); id = reader.ReadElementString("ActorId"); actorName = new ActorName(actorType, id); hl7PeerToPeerConfig.ToActorName = actorName; reader.ReadEndElement(); hl7PeerToPeerConfig.ToActorAeTitle = reader.ReadElementString("AeTitle"); hl7PeerToPeerConfig.ToActorIpAddress = reader.ReadElementString("IpAddress"); reader.ReadEndElement(); hl7PeerToPeerConfig.PortNumber = UInt16.Parse(reader.ReadElementString("PortNumber")); hl7PeerToPeerConfig.MessageDelimiters.FromString(reader.ReadElementString("MessageDelimiters")); System.String secureConnection = reader.ReadElementString("SecureConnection"); if (secureConnection == "True") { hl7PeerToPeerConfig.SecureConnection = true; } else { hl7PeerToPeerConfig.SecureConnection = false; } // read AutoValidate - added later - some config files may not contain this parameter reader.ReadString(); if (reader.Name == "AutoValidate") { System.String autoValidate = reader.ReadElementString("AutoValidate"); if (autoValidate == "True") { hl7PeerToPeerConfig.AutoValidate = true; } else { hl7PeerToPeerConfig.AutoValidate = false; } } hl7PeerToPeerConfig.ActorOption1 = reader.ReadElementString("ActorOption1"); hl7PeerToPeerConfig.ActorOption2 = reader.ReadElementString("ActorOption2"); hl7PeerToPeerConfig.ActorOption3 = reader.ReadElementString("ActorOption3"); hl7PeerToPeerConfig.SessionId = UInt16.Parse(reader.ReadElementString("SessionId")); _peerToPeerConfigCollection.Add(hl7PeerToPeerConfig); reader.ReadEndElement(); } } reader.ReadEndElement(); } reader.Close(); } catch (System.Exception e) { System.String message = System.String.Format("Failed to read configuration file: \"{0}\". Error: \"{1}\"", configurationFilename, e.Message); throw new System.SystemException(message, e); } }