public static string TypeToAbbreviation(MyDetectedEntityType type) { switch (type) { case MyDetectedEntityType.Planet: case MyDetectedEntityType.Asteroid: return("AST"); //astral case MyDetectedEntityType.CharacterHuman: case MyDetectedEntityType.CharacterOther: return("ORG"); //organic case MyDetectedEntityType.LargeGrid: return("LRG"); //large grid case MyDetectedEntityType.Meteor: case MyDetectedEntityType.Missile: return("PRJ"); //projectile case MyDetectedEntityType.SmallGrid: return("SML"); //small grid case MyDetectedEntityType.FloatingObject: case MyDetectedEntityType.Unknown: case MyDetectedEntityType.None: default: return("MSC"); //misc. } }
public Entry(double X, double Y, double Z) { this.TimeNum = -42044469; this.TSB = 0; this.Id = -1; this.Location = new Vector3D(X, Y, Z); this.Velocity = new Vector3D(0, 0, 0); this.Type = MyDetectedEntityType.LargeGrid; this.Relation = MyRelationsBetweenPlayerAndBlock.Enemies; }
public Entry(MyDetectedEntityInfo entity) { this.TimeNum = 0; this.TSB = 0; this.Id = entity.EntityId; this.Location = entity.Position; this.Velocity = entity.Velocity; this.Type = entity.Type; this.Relation = entity.Relationship; }
public MyDetectedEntityInfo(long entityId, string name, MyDetectedEntityType type, Vector3D?hitPosition, MatrixD orientation, Vector3 velocity, MyRelationsBetweenPlayerAndBlock relationship, BoundingBoxD boundingBox, long timeStamp) { this.EntityId = entityId; this.Name = name; this.Type = type; this.HitPosition = hitPosition; this.Orientation = orientation; this.Velocity = velocity; this.Relationship = relationship; this.BoundingBox = boundingBox; this.TimeStamp = timeStamp; }
public string GetCurrentScanResult() { string aResult = ""; if (mScanIDs.Count != 0) { long aID = mScanIDs[mCurrentScanIndex]; MyDetectedEntityInfo aScan = mScanResults[aID]; TimeSpan aTime = new TimeSpan(aScan.TimeStamp); string aName = aScan.Name; MyDetectedEntityType aType = aScan.Type; Vector3D aPos = aScan.Position; Vector3D aVelo = aScan.Velocity; Nullable <Vector3D> aHitPosition = aScan.HitPosition; // TODO: the camera should not thr first one in the list IMyCameraBlock aCamera = mCameras[mCurrentCameraIndex]; double aDistance = Vector3D.Distance(aPos, aCamera.GetPosition()); string aVeloString = "Velocity: static"; if (aVelo != Vector3D.Zero) { aVeloString = String.Format("Velocity:\n {0:00.00}\n {1:00.00}\n {2:00.00}", aVelo.X, aVelo.Y, aVelo.Z); } string aHitString = "HitPosition: undefined"; if (aHitPosition.HasValue) { aHitString = String.Format("HitPosition:\n {0:0.00}\n {1:0.00}\n {2:0.00}", aHitPosition.Value.X, aHitPosition.Value.Y, aHitPosition.Value.Z); } aResult += String.Format("Scan Index: {0:00}/{1:00}\n ID: {2}\n Name: {3}\n Type: {4}\n Time: {5:hh\\:mm\\:ss}\n Distance: {6:0.0} km\n{7}\n {8}\n", mCurrentScanIndex + 1, mScanIDs.Count, aID, aName, aType, aTime, aDistance / 1000, aVeloString, aHitString); } return(aResult); }
public static int getEntityTypeInteger(MyDetectedEntityType type) { if (type == MyDetectedEntityType.None) { return(0); } else if (type == MyDetectedEntityType.Unknown) { return(1); } else if (type == MyDetectedEntityType.SmallGrid) { return(2); } else if (type == MyDetectedEntityType.LargeGrid) { return(3); } else if (type == MyDetectedEntityType.CharacterHuman) { return(4); } else if (type == MyDetectedEntityType.CharacterOther) { return(5); } else if (type == MyDetectedEntityType.FloatingObject) { return(6); } else if (type == MyDetectedEntityType.Asteroid) { return(7); } else if (type == MyDetectedEntityType.Planet) { return(8); } else if (type == MyDetectedEntityType.Meteor) { return(9); } else if (type == MyDetectedEntityType.Missile) { return(10); } else { return(11); } }
private bool CheckTargetOnFilter(MyDetectedEntityInfo target) { double targetSizeSQ = target.BoundingBox.Size.LengthSquared(); double distanceSQ = Vector3D.DistanceSquared(reference.GetPosition(), target.Position); MyDetectedEntityType type = target.Type; if (distanceSQ < tFilter.minDistance * tFilter.minDistance) { return(false); } if (!tFilter.allowedType.Contains(type)) { return(false); } return(true); }
public MyDetectedEntityInfo(long entityId, string name, MyDetectedEntityType type, Vector3D?hitPosition, MatrixD orientation, Vector3 velocity, MyRelationsBetweenPlayerAndBlock relationship, BoundingBoxD boundingBox, long timeStamp) { if (timeStamp <= 0) { throw new ArgumentException("Invalid Timestamp", "timeStamp"); } EntityId = entityId; Name = name; Type = type; HitPosition = hitPosition; Orientation = orientation; Velocity = velocity; Relationship = relationship; BoundingBox = boundingBox; TimeStamp = timeStamp; }
public static MyDetectedEntityInfo ParseDetectedEntity(string serialized) { string[] parts = serialized.Split(':'); Vector3D boundingBoxMin = ParseVector(parts[0]); Vector3D boundingBoxMax = ParseVector(parts[1]); long entityId = long.Parse(parts[2]); Vector3D?hitPosition = parts[3].Length == 0 ? (Vector3D?)null : ParseVector(parts[3]); string name = parts[4]; MatrixD orientation = ParseMatrix(parts[5]); MyRelationsBetweenPlayerAndBlock relationship = (MyRelationsBetweenPlayerAndBlock)int.Parse(parts[6]); long timestamp = long.Parse(parts[7]); MyDetectedEntityType type = (MyDetectedEntityType)int.Parse(parts[8]); Vector3D velocity = ParseVector(parts[9]); return(new MyDetectedEntityInfo(entityId, name, type, hitPosition, orientation, velocity, relationship, new BoundingBoxD(boundingBoxMin, boundingBoxMax), timestamp)); }
public FilteredOutput(string str) { string[] filters = str.Split(','); foreach (string flt in filters) { try { MyDetectedEntityType entType = (MyDetectedEntityType)Enum.Parse(typeof(MyDetectedEntityType), flt); entityTypeFlags |= 1 << (int)entType; } catch (ArgumentException e) { } try { MyRelationsBetweenPlayerAndBlock entType = (MyRelationsBetweenPlayerAndBlock)Enum.Parse(typeof(MyRelationsBetweenPlayerAndBlock), flt); relationshipFlags |= 1 << (int)entType; } catch (ArgumentException e) { } if (flt.Equals("Fresh")) { fresh = true; } } }