public TileRange GetTiles(Bounds bounds, int zoomLevel) { if (!ValidBounds.Contains(new Point { X = bounds.Left, Y = bounds.Bottom, }) || !bounds.Contains(new Point { X = bounds.Right, Y = bounds.Top, })) { throw new ArgumentException($"The given bounds are not within {nameof(ValidBounds)}.", nameof(bounds)); } if (!ValidZoomRange.Contains(zoomLevel)) { throw new ArgumentException($"The given zoomLevel is not within {nameof(ValidZoomRange)}.", nameof(zoomLevel)); } return(new TileRange { TopLeft = CalculateTileIndex(bounds.Left, bounds.Top, 1 << zoomLevel, 1 << zoomLevel), BottomRight = CalculateTileIndex(bounds.Right, bounds.Bottom, 1 << zoomLevel, 1 << zoomLevel), ZoomLevel = zoomLevel, }); }
private bool _ValidateNextPosition(ref Vector3 moveToPosition) { if (ValidBounds.Test(moveToPosition) || !(base.transform != null) || base.IsDestroyed) { return(true); } Debug.Log(string.Format("Invalid NavAgent Position: {0} {1} (destroying)", this, moveToPosition.ToString())); base.Kill(BaseNetworkable.DestroyMode.None); return(false); }
private bool ValidateNextPosition(ref Vector3 moveToPosition) { if (ValidBounds.Test(moveToPosition) || !Object.op_Inequality((Object)((Component)this).get_transform(), (Object)null) || this.IsDestroyed) { return(true); } Debug.Log((object)("Invalid NavAgent Position: " + (object)this + " " + moveToPosition.ToString() + " (destroying)")); this.Kill(BaseNetworkable.DestroyMode.None); return(false); }
private bool ValidateNextPosition(ref Vector3 moveToPosition) { if (ValidBounds.Test(moveToPosition) || !(base.transform != null) || base.IsDestroyed) { return(true); } Debug.Log(string.Concat(new object[] { "Invalid NavAgent Position: ", this, " ", moveToPosition.ToString(), " (destroying)" })); base.Kill(BaseNetworkable.DestroyMode.None); return(false); }
private bool _ValidateNextPosition(ref Vector3 moveToPosition) { if (!ValidBounds.Test(moveToPosition) && base.transform != null && !base.IsDestroyed) { Debug.Log($"Invalid NavAgent Position: {this} {moveToPosition.ToString()} (destroying)"); Kill(); return(false); } return(true); }
private static bool LineOfSightInternal(Vector3 p0, Vector3 p1, int layerMask, float padding0, float padding1) { if (!ValidBounds.Test(p0)) { return(false); } if (!ValidBounds.Test(p1)) { return(false); } Vector3 vector = p1 - p0; float magnitude = vector.magnitude; if (magnitude <= padding0 + padding1) { return(true); } Vector3 vector2 = vector / magnitude; Ray ray = new Ray(p0 + vector2 * padding0, vector2); float maxDistance = magnitude - padding0 - padding1; bool flag; RaycastHit hitInfo; if (((uint)layerMask & 0x800000u) != 0) { flag = Trace(ray, 0f, out hitInfo, maxDistance, layerMask, QueryTriggerInteraction.Ignore); if (ConVar.AntiHack.losradius > 0f && !flag) { flag = Trace(ray, ConVar.AntiHack.losradius, out hitInfo, maxDistance, layerMask, QueryTriggerInteraction.Ignore); } } else { flag = UnityEngine.Physics.Raycast(ray, out hitInfo, maxDistance, layerMask, QueryTriggerInteraction.Ignore); if (ConVar.AntiHack.losradius > 0f && !flag) { flag = UnityEngine.Physics.SphereCast(ray, ConVar.AntiHack.losradius, out hitInfo, maxDistance, layerMask, QueryTriggerInteraction.Ignore); } } if (!flag) { if (ConVar.Vis.lineofsight) { ConsoleNetwork.BroadcastToAllClients("ddraw.line", 60f, Color.green, p0, p1); } return(true); } if (ConVar.Vis.lineofsight) { ConsoleNetwork.BroadcastToAllClients("ddraw.line", 60f, Color.red, p0, p1); ConsoleNetwork.BroadcastToAllClients("ddraw.text", 60f, Color.white, hitInfo.point, hitInfo.collider.name); } return(false); }
private bool ValidateNextPosition(ref Vector3 moveToPosition) { bool flag = ValidBounds.Test(moveToPosition); if (BaseEntity != null && !flag && base.transform != null && !BaseEntity.IsDestroyed) { Debug.Log(string.Concat("Invalid NavAgent Position: ", this, " ", moveToPosition.ToString(), " (destroying)")); BaseEntity.Kill(); return(false); } return(true); }