private void RegisterRemoting() { { try { BinaryServerFormatterSinkProvider server_provider = new BinaryServerFormatterSinkProvider(); server_provider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; BinaryClientFormatterSinkProvider client_provider = new BinaryClientFormatterSinkProvider(); IDictionary properties = new Hashtable(); properties["port"] = "0"; TcpChannel channel = new TcpChannel(properties, client_provider, server_provider); ChannelServices.RegisterChannel(channel, false); user = (IUser)Activator.GetObject(typeof(IUser), "tcp://localhost:9998/UserHandeling"); portal = (IPortal)Activator.GetObject(typeof(IPortal), "tcp://localhost:9998/PortalHandeling"); ftserver = (IFTserver)Activator.GetObject(typeof(IFTserver), "tcp://localhost:9998/TransferHandeling"); } catch (RemotingException e) { MessageBox.Show("Connection Error"); } } }
public WebBrowserModule(IApplicationContext container, IPortal portal, IDsConfigurationSection dsconfig, IShell shell, ILoadingManage loadingManage, IDsEnvironment dsEnvironment, IRegionManager regionManager , IEventAggregator eventAggregator, ILoggerFacade logger) : base(container, dsconfig) { AddinPath = base.AddinInfo.AddinPath.Substring(0, base.AddinInfo.AddinPath.LastIndexOf('\\')); EventAggregator = eventAggregator; Container = base.Container; UIRegionManager = regionManager; MainWindow = shell; portaldata = portal; DsConfiguration = dsconfig; Logger = logger; DsEnvironment = dsEnvironment; DsAddinConfig = base.CurrentAddinConfiguration.GetSection("ds/base") as IDsAddinConfigurationSection; string Language = string.Empty; var LanguagePar = DsConfiguration.Params["Language"]; if (LanguagePar != null) { Language = LanguagePar.Value; } // CefManager.Strat(); string dxcx = (new DS.AFP.Common.Core.ResManager()).GetResource("DS.AFP.WebBrowser", "Close").ToString(); }
public void AssertPortalJoint(Body enterBody, Body exitBody, IPortal portalEnter) { Portal.Enter(portalEnter, enterBody); Assert.IsTrue((exitBody.Position - enterBody.Position).Length() < Delta); Assert.IsTrue((exitBody.LinearVelocity - enterBody.LinearVelocity).Length() < Delta); Assert.AreEqual(exitBody.Rotation, enterBody.Rotation, Delta); Assert.AreEqual(exitBody.AngularVelocity, enterBody.AngularVelocity, Delta); }
//public ContentForm() //{ // InitializeComponent(); //} public ContentForm(IWindowInformation windowInformation, IPortal portal) { _windowInformation = windowInformation; InitializeComponent(); SetParent(); this.HostingContainer.Children.Add((UserControl)portal); }
/// <summary> /// You need to specify an anchor point where they are attached. /// The position of the anchor point is important for computing the reaction torque. /// </summary> /// <param name="parentBody">The first body</param> /// <param name="childBody">The second body</param> /// <param name="anchorA">The first body anchor.</param> /// <param name="anchorB">The second body anchor.</param> /// <param name="useWorldCoordinates">Set to true if you are using world coordinates as anchors.</param> public PortalJoint(Body parentBody, Body childBody, IPortal portalEnter) : base(parentBody, childBody) { JointType = JointType.Portal; PortalEnter = portalEnter; LocalAnchorA = new Vector2(0, 0); LocalAnchorB = new Vector2(0, 0); CollideConnected = true; }
private void Setup() { //driver = BuildFireFoxDriver(); this._driver = BuildChromeDriver(); // this.portal = new EgifterPortal(driver); this._portal = new FakePortal(_driver); var session = _sessionsRepository.GetSession(); _portal.NavigateTo(); SetAuthCookie(session); }
public static void Enter(IPortal portal, Body body, bool ignorePortalVelocity = false) { Transform2 transform = new Transform2(body.Position, 1, body.Rotation); Transform2 velocity = Transform2.CreateVelocity((Vector2)body.LinearVelocity, body.AngularVelocity); velocity = EnterVelocity(portal, 0.5f, velocity, ignorePortalVelocity); transform = Enter(portal, transform); body.Position = (Xna.Vector2)transform.Position; body.Rotation = transform.Rotation; body.LinearVelocity = (Xna.Vector2)velocity.Position; body.AngularVelocity = velocity.Rotation; BodyExt.ScaleFixtures(body, transform.Scale); }
public PortalForm(IPortal prtl, Login lgn, IFTserver ftsrvr) { InitializeComponent(); portal = prtl; ftserver = ftsrvr; login = lgn; //portal.portalEvent += new PortalEvent(HandlePortalEvent); SetWindowTheme(treeView1.Handle, "explorer", null); SetWindowTheme(listView1.Handle, "explorer", null); SetWindowTheme(listView2.Handle, "explorer", null); this.treeView1.HotTracking = true; this.treeView1.FullRowSelect = true; }
/// <param name="depth">Number of iterations.</param> /// <param name="clipModels">Adds the ClipModel instances to this list.</param> private static List<ClipModel> _getClipModels(IRenderable entity, Model model, IList<IPortal> portalList, Vector2 centerPoint, IPortal portalEnter, Matrix4 modelMatrix, int depth, int count) { List<ClipModel> clipModels = new List<ClipModel>(); if (depth <= 0) { return clipModels; } List<IPortal> collisions = Portal.GetCollisions( centerPoint, Vector2Ext.Transform(model.GetWorldConvexHull(), entity.GetWorldTransform().GetMatrix() * modelMatrix), portalList, PORTAL_CLIP_MARGIN); List<LineF> clipLines = new List<LineF>(); foreach (IPortal portal in collisions) { Vector2[] pv = Portal.GetWorldVerts(portal); LineF clipLine = new LineF(pv); LineF portalLine = new LineF(pv); Vector2 normal = portal.WorldTransform.GetRight(); if (portal.WorldTransform.MirrorX) { normal = -normal; } Vector2 portalNormal = portal.WorldTransform.Position + normal; if (portalLine.GetSideOf(centerPoint) != portalLine.GetSideOf(portalNormal)) { normal *= Portal.EnterMinDistance; } else { clipLine = clipLine.Reverse(); normal *= -Portal.EnterMinDistance; } clipLines.Add(clipLine); if (portalEnter == null || portal != portalEnter.Linked) { Vector2 centerPointNext = Vector2Ext.Transform(portal.WorldTransform.Position + normal, Portal.GetLinkedMatrix(portal)); clipModels.AddRange(_getClipModels(entity, model, portalList, centerPointNext, portal, modelMatrix * Portal.GetLinkedMatrix(portal), depth - 1, count + 1)); } } clipModels.Add(new ClipModel(entity, model, clipLines.ToArray(), modelMatrix)); return clipModels; }
private static ConsoleText GetItemConsoleText(IRoomObject roomObject) { return(roomObject switch { ISankaraStone _ => new ConsoleText("S", ConsoleColor.DarkYellow), IDisappearingTrap _ => new ConsoleText("@"), IBoobyTrap _ => new ConsoleText("Ο"), IKey key => new ConsoleText("K", key.Color), IPressurePlate _ => new ConsoleText("T"), IPortal _ => new ConsoleText("Π", ConsoleColor.Magenta), IConveyorBelt conveyorBelt => new ConsoleText( Util.ConvertDirectionConveyorBeltIcon(conveyorBelt.Direction)), _ => new ConsoleText("?") });
public void OnDisconnectPortal(uint portalID) { if (portalID <= (uint)connectedPortals.Count) { return; } // fetch the object from map, close the window, delete object IPortal portal = connectedPortals[portalID]; if (portal is null) { return; } portal.ShutdownPortal(); }
public static void Enter(IPortal portal, IPortalCommon portalable, float intersectT, bool ignorePortalVelocity = false, bool worldOnly = false) { Transform2 transform = portalable.GetTransform(); Transform2 velocity = portalable.GetVelocity(); //Copies are made just for debug purposes. The originals should not change before the EnterPortal callback. Transform2 transformCopy = transform.ShallowClone(); Transform2 velocityCopy = velocity.ShallowClone(); IPortalable cast = portalable as IPortalable; if (cast != null) { if (!worldOnly) { cast.SetTransform(Enter(portal, transform)); cast.SetVelocity(EnterVelocity(portal, intersectT, velocity, ignorePortalVelocity)); } } if (portalable.WorldTransform != null) { portalable.WorldTransform = Enter(portal, portalable.WorldTransform); portalable.WorldVelocity = EnterVelocity(portal, intersectT, portalable.WorldVelocity, ignorePortalVelocity); } //If a static actor enters a portal then it's no longer static. Actor actorCast = portalable as Actor; if (actorCast != null && actorCast.BodyType == BodyType.Static) { actorCast.SetBodyType(BodyType.Kinematic); } foreach (IPortalCommon p in portalable.Children) { p.Path.Enter(portal.Linked); } Debug.Assert(transform == transformCopy && velocity == velocityCopy); if (cast != null) { cast.EnterPortal?.Invoke(new EnterCallbackData(portal, cast, intersectT), transform, velocity); } }
internal static IPortal GetPortal(string providerName) { IPortal portal = null; /* * if (portals.Count == 0) * { * lock (_lockobj) * { * Init(); * } * }*/ if (string.IsNullOrWhiteSpace(providerName)) { providerName = defaultPortalProvider; } //portals.TryGetValue(providerName, out portal); portal = (IPortal)providersCollection[providerName]; return(portal); }
/// <summary> /// Determine a position that is sufficiently far away from all portals so that it isn't ambiguous which side of a /// portal the position is at. /// </summary> /// <param name="portals"></param> /// <param name="portalPrevious">The last portal that was exited.</param> /// <param name="transform"></param> /// <param name="velocity"></param> private static Transform2 AddMargin(IEnumerable<IPortal> portals, IPortal portalPrevious, Transform2 transform, Transform2 velocity) { transform = transform.ShallowClone(); foreach (IPortal p in portals) { if (!Portal.IsValid(p)) { continue; } LineF exitLine = new LineF(Portal.GetWorldVerts(p)); Vector2 position = transform.Position; double distanceToPortal = MathExt.PointLineDistance(position, exitLine, true); if (distanceToPortal < Portal.EnterMinDistance) { Vector2 exitNormal = p.WorldTransform.GetRight(); Side sideOf; if (p == portalPrevious) { sideOf = exitLine.GetSideOf(position + velocity.Position); } else { sideOf = exitLine.GetSideOf(position - velocity.Position); } if (sideOf != exitLine.GetSideOf(exitNormal + p.WorldTransform.Position)) { exitNormal = -exitNormal; } Vector2 pos = exitNormal * (Portal.EnterMinDistance - (float)distanceToPortal); transform.Position += pos; break; } } return transform; }
/// <summary> /// Get the portal's vertices in world coordinates. /// </summary> public static Vector2[] GetWorldVerts(IPortal portal, Transform2 worldTransform) { return Vector2Ext.Transform(GetVerts(portal), worldTransform.GetMatrix()); }
/// <summary> /// Get the portal's vertices in world coordinates. /// </summary> public static Vector2[] GetWorldVerts(IPortal portal) { return GetWorldVerts(portal, portal.WorldTransform); }
/// <summary> /// Returns an array of two Vectors defining the Portals local location /// </summary> public static Vector2[] GetVerts(IPortal portal) { return new Vector2[] { new Vector2(0, 0.5f), new Vector2(0, -0.5f) }; }
public static Transform2 GetLinkedTransform(IPortal portalEnter, IPortal portalExit) { Transform2 tExit = portalExit.WorldTransform; tExit.MirrorX = !tExit.MirrorX; Transform2 tEnter = portalEnter.WorldTransform; return tEnter.Inverted().Transform(tExit); }
public static Transform2 GetLinkedTransform(IPortal portalEnter) { Debug.Assert(portalEnter.Linked != null, "Portal must be linked to another portal."); return GetLinkedTransform(portalEnter, portalEnter.Linked); }
/// <summary>Returns matrix to transform between one portals coordinate space to another.</summary> public static Matrix4 GetLinkedMatrix(IPortal portalEnter, IPortal portalExit) { Transform2 transform = portalExit.WorldTransform; transform.MirrorX = !transform.MirrorX; Matrix4 m = portalEnter.WorldTransform.GetMatrix(); return m.Inverted() * transform.GetMatrix(); }
public static Matrix4 GetLinkedMatrix(IPortal portalEnter) { Debug.Assert(portalEnter.Linked != null, "Portal must be linked to another portal."); return GetLinkedMatrix(portalEnter, portalEnter.Linked); }
public static LineF[] GetFovLines(IPortal portal, Vector2 origin, float distance, Transform2 transform) { Vector2[] vertices = GetFov(portal, origin, distance); LineF[] lines = new LineF[] { new LineF(vertices[1], vertices[2]), new LineF(vertices[0], vertices[vertices.Length-1]) }; return lines; }
private static bool CalculatePortalViews(IPortal portal, IPortal portalEnter, IList<IPortal> portals, Matrix4 viewMatrix, Vector2 viewPos, Vector2 viewPosPrevious, PortalView portalView, Matrix4 portalMatrix, List<Func<bool>> actionList) { const float AREA_EPSILON = 0.0001f; Clipper c = new Clipper(); //The clipper must be set to strictly simple. Otherwise polygons might have duplicate vertices which causes poly2tri to generate incorrect results. c.StrictlySimple = true; if (!_isPortalValid(portalEnter, portal, viewPos)) { return false; } Vector2[] fov = Vector2Ext.Transform(Portal.GetFov(portal, viewPos, 500, 3), portalMatrix); if (MathExt.GetArea(fov) < AREA_EPSILON) { return false; } List<IntPoint> pathFov = ClipperConvert.ToIntPoint(fov); var viewNew = new List<List<IntPoint>>(); c.AddPath(pathFov, PolyType.ptSubject, true); c.AddPaths(portalView.Paths, PolyType.ptClip, true); c.Execute(ClipType.ctIntersection, viewNew); c.Clear(); if (viewNew.Count <= 0) { return false; } c.AddPaths(viewNew, PolyType.ptSubject, true); foreach (IPortal other in portals) { if (other == portal) { continue; } if (!_isPortalValid(portalEnter, other, viewPos)) { continue; } //Skip this portal if it's inside the current portal's FOV. LineF portalLine = new LineF(Portal.GetWorldVerts(portal)); LineF portalOtherLine = new LineF(Portal.GetWorldVerts(other)); if (portalLine.IsInsideFOV(viewPos, portalOtherLine)) { continue; } Vector2[] otherFov = Vector2Ext.Transform(Portal.GetFov(other, viewPos, 500, 3), portalMatrix); if (MathExt.GetArea(otherFov) < AREA_EPSILON) { continue; } otherFov = MathExt.SetWinding(otherFov, true); List<IntPoint> otherPathFov = ClipperConvert.ToIntPoint(otherFov); c.AddPath(otherPathFov, PolyType.ptClip, true); } var viewNewer = new List<List<IntPoint>>(); c.Execute(ClipType.ctDifference, viewNewer, PolyFillType.pftNonZero, PolyFillType.pftNonZero); c.Clear(); if (viewNewer.Count <= 0) { return false; } Vector2 viewPosNew = Vector2Ext.Transform(viewPos, Portal.GetLinkedMatrix(portal, portal.Linked)); Vector2 viewPosPreviousNew = Vector2Ext.Transform(viewPosPrevious, Portal.GetLinkedMatrix(portal, portal.Linked)); Matrix4 portalMatrixNew = Portal.GetLinkedMatrix(portal.Linked, portal) * portalMatrix; Matrix4 viewMatrixNew = portalMatrixNew * viewMatrix; LineF[] lines = Portal.GetFovLines(portal, viewPos, 500); lines[0] = lines[0].Transform(portalMatrix); lines[1] = lines[1].Transform(portalMatrix); LineF[] linesPrevious = Portal.GetFovLines(portal, viewPosPrevious, 500); linesPrevious[0] = linesPrevious[0].Transform(portalMatrix); linesPrevious[1] = linesPrevious[1].Transform(portalMatrix); LineF portalWorldLine = new LineF(Portal.GetWorldVerts(portal)); portalWorldLine = portalWorldLine.Transform(portalMatrix); PortalView portalViewNew = new PortalView(portalView, viewMatrixNew, viewNewer, lines, linesPrevious, portalWorldLine); foreach (IPortal p in portals) { actionList.Add(() => CalculatePortalViews(p, portal, portals, viewMatrix, viewPosNew, viewPosPreviousNew, portalViewNew, portalMatrixNew, actionList) ); } return true; }
/// <summary> /// Returns whether a portal can be entered. /// </summary> public static bool IsValid(IPortal portal) { return portal.Linked != null && portal.WorldTransform != null && portal.WorldVelocity != null && portal.Linked.WorldTransform != null && portal.Linked.WorldVelocity != null; }
/// <summary> /// Get the portal's vertices in world coordinates after being scaled. /// </summary> public static Vector2[] GetWorldVerts(IPortal portal, float scalar) { return Vector2Ext.Transform(Vector2Ext.Scale(GetVerts(portal), scalar), portal.WorldTransform.GetMatrix()); }
private static bool _isPortalValid(IPortal previous, IPortal next, Vector2 viewPos) { //skip this portal if it isn't linked if (!Portal.IsValid(next)) { return false; } //or it's the exit portal if (previous != null && next == previous.Linked) { return false; } //or if the portal is one sided and the view point is on the wrong side Vector2[] pv2 = Portal.GetWorldVerts(next); LineF portalLine = new LineF(pv2); if (next.OneSided) { if (portalLine.GetSideOf(pv2[0] + next.WorldTransform.GetRight()) != portalLine.GetSideOf(viewPos)) { return false; } } //or if this portal isn't inside the fov of the exit portal if (previous != null) { LineF portalEnterLine = new LineF(Portal.GetWorldVerts(previous.Linked)); if (!portalEnterLine.IsInsideFOV(viewPos, portalLine)) { return false; } } return true; }
public EnterCallbackData(IPortal entrancePortal, IPortalCommon instance, double portalT) { EntrancePortal = entrancePortal; Instance = instance; PortalT = portalT; }
public static Transform2 Enter(IPortal portal, Transform2 transform) { Debug.Assert(IsValid(portal)); return transform.Transform(GetLinkedTransform(portal, portal.Linked)); }
/// <summary> /// Returns new velocity from entering portal. /// </summary> /// <param name="portal">Portal being entered.</param> /// <param name="intersectT">Intersection point on the portal.</param> /// <param name="velocity">Velocity before entering.</param> public static Transform2 EnterVelocity(IPortal portal, float intersectT, Transform2 velocity, bool ignorePortalVelocity = false) { Debug.Assert(IsValid(portal)); Matrix4 matrix = GetLinkedMatrix(portal); Vector2 origin = Vector2Ext.Transform(new Vector2(), matrix); Transform2 velocityClone = velocity.ShallowClone(); if (!ignorePortalVelocity) { velocityClone.Position -= portal.WorldVelocity.Position; velocityClone.Rotation -= portal.WorldVelocity.Rotation; velocityClone.Position -= GetAngularVelocity(portal, intersectT); } velocityClone.Position = Vector2Ext.Transform(velocityClone.Position, matrix); velocityClone.Position -= origin; if (portal.WorldTransform.MirrorX == portal.Linked.WorldTransform.MirrorX) { velocityClone.Rotation = -velocityClone.Rotation; } if (!ignorePortalVelocity) { velocityClone.Position += portal.Linked.WorldVelocity.Position; velocityClone.Rotation += portal.Linked.WorldVelocity.Rotation; velocityClone.Position += GetAngularVelocity(portal.Linked, intersectT); } return velocityClone; }
public static void SetLinked(IPortal p0, IPortal p1) { if (p0.Linked != null) { p0.Linked.Linked = null; } if (p1.Linked != null) { p1.Linked.Linked = null; } p0.Linked = p1; p1.Linked = p0; }
/// <summary> /// Returns a polygon in world space representing the 2D FOV through the portal. /// Polygon is not guaranteed to be non-degenerate which can occur if the viewPoint is edge-on to the portal. /// </summary> public static Vector2[] GetFov(IPortal portal, Vector2 origin, float distance) { return GetFov(portal, origin, distance, 10); }
private static Vector2 GetAngularVelocity(IPortal portal, float intersectT) { Vector2 intersect = new LineF(GetWorldVerts(portal)).Lerp(intersectT); return MathExt.AngularVelocity(intersect, portal.WorldTransform.Position, portal.WorldVelocity.Rotation); }
public static Vector2[] GetFov(IPortal portal, Vector2 origin, float distance, int detail) { return GetFov(portal, origin, distance, detail, portal.WorldTransform); }
public void Walk(Vector2D destination, bool pathfinder = true) { Logger.Debug($"Walking to {destination.X} {destination.Y}"); if (!Map.IsWalkable(destination)) { return; } bool positiveX = destination.X > Position.X; bool positiveY = destination.Y > Position.Y; Vector2D distance = Position.GetDistanceTo(destination); int stepX = distance.X > 3 ? 3 : distance.X; int stepY = distance.Y > 3 ? 3 : distance.Y; short x = (short)(((positiveX ? 1 : -1) * stepX) + Position.X); short y = (short)(((positiveY ? 1 : -1) * stepY) + Position.Y); var nextPosition = new Vector2D(x, y); if (!Map.IsWalkable(nextPosition)) { if (pathfinder) { IEnumerable <Vector2D> path = Map.Pathfinder.Find(Position, nextPosition); Walk(path, false); return; } return; } Logger.Debug($"Walk to {nextPosition} with speed {Speed}"); Client.SendPacket($"walk {nextPosition.X} {nextPosition.Y} {(nextPosition.X + nextPosition.Y) % 3 % 2} {Speed}"); Thread.Sleep((1000 / Speed) * ((stepX + stepY) + 3)); Position = nextPosition; if (!Position.Equals(destination)) { Walk(destination); return; } Logger.Debug($"Walked to {Position}"); IMap map = Map; IPortal closestPortal = map.Portals.OrderBy(p => p.Position.GetDistance(Position)).FirstOrDefault(); if (closestPortal == null) { return; } if (Position.IsInRange(closestPortal.Position, 1)) { Client.SendPacket("preq"); Logger.Debug("Character on portal, switching map"); } }
/// <summary> /// Returns a polygon in world space representing the 2D FOV through the portal. /// Polygon is not guaranteed to be non-degenerate which can occur if the viewPoint is edge-on to the portal. /// </summary> public static Vector2[] GetFov(IPortal portal, Vector2 viewPoint, float distance, int detail, Transform2 transform) { Matrix4 a = transform.GetMatrix(); Vector2[] verts = new Vector2[detail + 2]; Vector2[] portalVerts = Portal.GetVerts(portal); for (int i = 0; i < portalVerts.Length; i++) { Vector4 b = Vector4.Transform(new Vector4(portalVerts[i].X, portalVerts[i].Y, 0, 1), a); verts[i] = new Vector2(b.X, b.Y); } //Minumum distance in order to prevent self intersections. const float errorMargin = 0.01f; float distanceMin = Math.Max((verts[0] - viewPoint).Length, (verts[1] - viewPoint).Length) + errorMargin; distance = Math.Max(distance, distanceMin); //get the leftmost and rightmost edges of the FOV verts[verts.Length - 1] = (verts[0] - viewPoint).Normalized() * distance + viewPoint; verts[2] = (verts[1] - viewPoint).Normalized() * distance + viewPoint; //find the angle between the edges of the FOV double angle0 = MathExt.AngleLine(verts[verts.Length - 1], viewPoint); double angle1 = MathExt.AngleLine(verts[2], viewPoint); double diff = MathExt.AngleDiff(angle0, angle1); Debug.Assert(diff <= Math.PI + double.Epsilon && diff >= -Math.PI); //handle case where lines overlap eachother /*const double angleDiffMin = 0.0001f; if (Math.Abs(diff) < angleDiffMin) { return new Vector2[0]; }*/ Matrix2 Rot = Matrix2.CreateRotation((float)diff / (detail - 1)); for (int i = 3; i < verts.Length - 1; i++) { verts[i] = Vector2Ext.Transform(verts[i - 1] - viewPoint, Rot) + viewPoint; } return verts; }
void OnBatteryTimer(object sender, ElapsedEventArgs eea) { foreach (KeyValuePair <int, IStructure> str in mStructs) { if (!str.Value.IsReady) { continue; } if (!str.Value.IsPowered) { continue; } if (str.Value.FuelTank != null) { mAPI.Log("Fuel tank capacity: " + str.Value.FuelTank.Capacity + ", Content: " + str.Value.FuelTank.Content); } //located the battery through a prevous 3d search of //the volume of the test base (offset by 128) IDevice bat = str.Value.GetDevice <IDevice>(-5, 129, -1); if (bat == null) { mAPI.Log("Bat null"); } else { mAPI.Log("Got device: " + bat); } BlockSearch(str.Value); IDevicePosList idpl = str.Value.GetDevices("AmmoCntr"); for (int i = 0; i < idpl.Count; i++) { VectorInt3 pos = idpl.GetAt(i); mAPI.Log("Device at pos: " + pos); IContainer con = str.Value.GetDevice <IContainer>(pos); mAPI.Log("Ammo container has " + con.VolumeCapacity + " volume."); } idpl = str.Value.GetDevices("Container"); for (int i = 0; i < idpl.Count; i++) { VectorInt3 pos = idpl.GetAt(i); mAPI.Log("Device at pos: " + pos); IContainer con = str.Value.GetDevice <IContainer>(pos); mAPI.Log("Container has " + con.VolumeCapacity + " volume."); } idpl = str.Value.GetDevices("Fridge"); for (int i = 0; i < idpl.Count; i++) { VectorInt3 pos = idpl.GetAt(i); mAPI.Log("Device at pos: " + pos); IContainer con = str.Value.GetDevice <IContainer>(pos); mAPI.Log("Fridge has " + con.VolumeCapacity + " volume."); } idpl = str.Value.GetDevices("LCD"); for (int i = 0; i < idpl.Count; i++) { VectorInt3 pos = idpl.GetAt(i); mAPI.Log("Device at pos: " + pos); ILcd lcd = str.Value.GetDevice <ILcd>(pos); mAPI.Log("LCD says: " + lcd.GetText()); } idpl = str.Value.GetDevices("Light"); for (int i = 0; i < idpl.Count; i++) { VectorInt3 pos = idpl.GetAt(i); mAPI.Log("Device at pos: " + pos); ILight lt = str.Value.GetDevice <ILight>(pos); mAPI.Log("Light has range: " + lt.GetRange()); } idpl = str.Value.GetDevices("Portal"); for (int i = 0; i < idpl.Count; i++) { VectorInt3 pos = idpl.GetAt(i); mAPI.Log("Device at pos: " + pos); IPortal door = str.Value.GetDevice <IPortal>(pos); mAPI.Log("Door is a door"); } } }
public static LineF[] GetFovLines(IPortal portal, Vector2 origin, float distance) { return GetFovLines(portal, origin, distance, portal.WorldTransform); }