public static string GetNextLevelToLoad() { string nextSceneName; var stateList = gameScenes[GameManager.gameState]; var currentIndex = stateList.FindIndex(levelName => levelName == _currentLevelName); if (!gameScenes.ContainsKey(GameManager.gameState)) { DebugScript.LogError(typeof(SceneManagement), "Current GameMode isn't declared in Dictionary!\n Returning to Menu"); nextSceneName = "Menu"; } else if (currentIndex + 1 >= stateList.Count) { DebugScript.Log(typeof(SceneManagement), "At the end of the declared scene list\n Returning to Menu"); nextSceneName = "Menu"; } else { nextSceneName = stateList[currentIndex + 1]; } return(nextSceneName); }
public static AsyncOperation LoadLevel(string levelName) { if (_loadOperations.Count == 1) { DebugScript.LogError(typeof(SceneManagement), "A load operation is already in progress"); return(null); } AsyncOperation ao = SceneManager.LoadSceneAsync(levelName); if (ao == null) { DebugScript.LogError(typeof(SceneManagement), "Scene to Load doesn't exist"); return(null); } _loadOperations.Add(ao); ao.completed += OnLoadOperationComplete; if (_currentLevelName != levelName) { _lastLevelName = _currentLevelName; } SetCurrentLevelName(levelName); return(ao); }
void DrawSightDebug() { //Calculate the currentSightDirection as a rotation on a unit circle float rotation = transform.rotation.eulerAngles.z + Mathf.Atan2(currentSightDirection.y, currentSightDirection.x) * 180 / Mathf.PI; //Draw the two straight edges of the cone float x1 = Mathf.Cos((rotation - fieldOfVision / 2) / 180 * Mathf.PI); float y1 = Mathf.Sin((rotation - fieldOfVision / 2) / 180 * Mathf.PI); Vector3 d1 = new Vector3(x1, y1, 0);; Debug.DrawRay(currentSightOrigin, d1 * sightRange, Color.green); float x2 = Mathf.Cos((rotation + fieldOfVision / 2) / 180 * Mathf.PI); float y2 = Mathf.Sin((rotation + fieldOfVision / 2) / 180 * Mathf.PI); Vector3 d2 = new Vector3(x2, y2, 0);; Debug.DrawRay(currentSightOrigin, d2 * sightRange, Color.green); //Draw the arc of the cone DebugScript.DrawArc(100, sightRange, fieldOfVision, rotation - fieldOfVision / 2, currentSightOrigin, Color.green); for (int i = 0; i < sightPoints.Length; i++) { if (angles[i] < fieldOfVision / 2 && offsets[i].sqrMagnitude <= sqrSightRange) { RaycastHit2D hit = Physics2D.Raycast(currentSightOrigin, offsets[i], sightRange, blocksSight); //Comparing sqrMagnitude is faster, so just get the sqrt of the smaller sqrMagnitude. Half the sqrts! float sightRayLength = Mathf.Sqrt(Mathf.Min(offsets[i].sqrMagnitude, ((Vector3)hit.point - transform.position - sightOffset).sqrMagnitude)); Debug.DrawRay(currentSightOrigin, offsets[i].normalized * sightRayLength, Color.red); } } }
public static void createNoise(Vector3 location, float radius) { if (debug) { DebugScript.DrawCircle(100, radius, location, Color.cyan, 0.5f); } float sqrRadius = radius * radius; foreach (Listener listener in registeredListeners) { Vector3 soundOffset = location - listener.gameObject.transform.position; //Do easy, arithmatic only check to see if listener could possibly be close enough to hear if (Mathf.Abs(soundOffset.x) > radius || Mathf.Abs(soundOffset.y) > radius) { continue; } float sqrDistance = soundOffset.sqrMagnitude; if (sqrDistance <= sqrRadius * listener.soundRangeModifier) { listener.didHearSound(); } } }
//~Point() { Debug.Log("Point garbage collected"); } public static void DebugPointCount(List <Point> points) { foreach (Point point in points) { switch (point.edges.Count) { case 0: DebugScript.DrawCross(point.position, 0.1f, Color.gray); break; case 1: DebugScript.DrawCross(point.position, 0.2f, Color.green); break; case 2: DebugScript.DrawCross(point.position, 0.2f, Color.yellow); break; case 3: DebugScript.DrawCross(point.position, 0.2f, Color.red); break; default: DebugScript.DrawCross(point.position, 0.2f, Color.magenta); break; } } }
public void ExitToMenu() { DebugScript.UnPause(); var sceneManager = new GameObject(); var manager = sceneManager.AddComponent <MySceneManager>(); manager.LoadSceneByNumber(1); }
static void OnLoadOperationComplete(AsyncOperation ao) { if (_loadOperations.Contains(ao)) { _loadOperations.Remove(ao); hasSceneChanged = true; } DebugScript.Log(typeof(SceneManagement), "Load Complete"); }
public virtual void module(DebugModule m) { if (m.corrupt) { return; } DebugScript script = new DebugScript(this, m.name, m.text); debugScripts.Add(script); debugScriptsByName[script.name] = script; }
void Awake() { DontDestroyOnLoad(this.gameObject); if (instance != null && instance != this) { Destroy(this.gameObject); } else { instance = this; } }
private void Update() { map = BuildMapFromColliders(colliders); if (Input.GetMouseButton(0)) { center = Camera.main.ScreenToWorldPoint(Input.mousePosition - new Vector3(0, 0, Camera.main.transform.position.z)); } if (debugVisibility) { DebugScript.DrawCross(center, 0.2f, Color.green); } Visibility(center, map); }
// Use this for initialization void Awake() { if (instance == null) { instance = this; } else { Destroy(this.gameObject); } if (gameContext == null) { Debug.LogError("Please put an instance of a GameContext"); } }
void OnGUI() { if (debug) { DebugScript.DrawCircle(100, alertDistance, transform.position, Color.yellow); DebugScript.DrawCircle(100, startSeekDistance, transform.position, Color.red); GUI.Label(new Rect(10, 10, 200, 30), "State: " + currentState.ToString()); GUI.Label(new Rect(10, 30, 200, 30), "Patrol Point Index: " + currentPatrolPointIndex.ToString()); GUI.Label(new Rect(10, 50, 200, 30), "Alertness: " + alertTime.ToString("F1") + " ChickenCount: " + playingChickenCount.ToString()); foreach (Vector3 point in patrolPoints) { DebugScript.DrawCross(point, 0.5f, Color.green); } } }
void FixedUpdate() { if (timeUntilNextUpdate > 0) { timeUntilNextUpdate -= Time.deltaTime; } else { if (!player) { Debug.Log("PlayerRespawner: No player set."); return; } if (!player.activeSelf) { Invoke("RespawnPlayer", respawnDelay); } else { if (!(requireGrounded && !_characterController.isGrounded)) //This blew my mind { currentIndex++; locationBuffer[currentIndex % maxBufferSize] = player.transform.position; } } timeUntilNextUpdate = updateFrequency; } if (debug) { DebugScript.DrawCross(locationBuffer[(currentIndex + 1) % maxBufferSize], 0.5f, Color.green); } }
public virtual void module(DebugModule m) { if (m.corrupt) return ; DebugScript script = new DebugScript(this, m.name, m.text); debugScripts.Add(script); debugScriptsByName[script.name] = script; }
public virtual void offset(int offset, LineRecord lr) { //System.out.print(lr.module.id + " " + lr.module.name + " " + lr.lineno + " " + offset + "\n"); // NOTE: Each DebugModule coming in to this method via the // LineRecord doesn't have a unique id! // In particular, lr.module.id is 0 for all MXML files. // And the others are generated by a random number generator // that could conceivably repeat. // Therefore there is no point at even looking at the id. // Module name strings arrive here in various formats: // An MXML file (application or component) is a full path like // "C:\Royale\flash\experience\royale\apps\dev.war\checkinTest\checkinTest.mxml". // An ActionScript component or a framework package combines // a package name with a full path, as in // "custom.as.myBox: C:\Royale\flash\experience\royale\apps\dev.war\checkinTest\custom\as\myBox.as" // or // "mx.core.UIComponent: C:\Royale\flash\experience\royale\apps\dev.war\WEB-INF\flex\frameworks\mx\core\UIComponent.as". // A framework ActionScript file is a package an // Various autogenerated modules look like this: // "synthetic: checkinTest"; // "synthetic: Object.registerClass() for checkinTest"; // "synthetic: main frame 1 actions". // #include files may have non-canonical full paths like // "C:\Royale\flash\experience\royale\apps\dev.war\WEB-INF\flex\frameworks\mx\core\..\core\ComponentVersion.as" // and must be canonicalized to // "C:\Royale\flash\experience\royale\apps\dev.war\WEB-INF\flex\frameworks\mx\core\ComponentVersion.as" // so that they don't show up multiple times in an fdb file listing. /* C: The debug module name conversion is now centralized in DebugDecoder.adjustModuleName(). * if (lr.module.name.indexOf(": ") < 0) * { * lr.module.name = FileUtils.canonicalPath(lr.module.name); * //System.out.print("*** " + lr.module.name + "\n"); * } */ // Don't bother to record corrupted modules if (lr.module.corrupt) { return; } // If we haven't already created a DebugScript for the // module referenced by the specified LineRecord, do so. System.String name = lr.module.name; if (!debugScriptsByName.ContainsKey(name)) { module(lr.module); } // Get the DebugScript for this script. //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'" DebugScript script = (DebugScript)debugScriptsByName[name]; // Create a DebugOffset for the specified lineNumber/byteOffset pair. DebugOffset debugOffset = new DebugOffset(this, lr.lineno, offset + adjust); // Attach the DebugOffset to the DebugScript it is associated with. script.debugOffsets.Add(debugOffset); }
List <Edge> BuildMapFromColliders(Collider2D[] colliders) { List <Edge> map = new List <Edge>(); foreach (Collider2D collider in colliders) { //BoxCollider2D if (collider is BoxCollider2D boxCollider) { Point downLeft = new Point(boxCollider.transform.TransformPoint( new Vector2(-boxCollider.size.x, -boxCollider.size.y) * 0.5f + boxCollider.offset)); Point upRight = new Point(boxCollider.transform.TransformPoint( new Vector2(boxCollider.size.x, boxCollider.size.y) * 0.5f + boxCollider.offset)); Point upLeft = new Point(boxCollider.transform.TransformPoint( new Vector2(-boxCollider.size.x, boxCollider.size.y) * 0.5f + boxCollider.offset)); Point downRight = new Point(boxCollider.transform.TransformPoint( new Vector2(boxCollider.size.x, -boxCollider.size.y) * 0.5f + boxCollider.offset)); map.Add(new Edge(upLeft, upRight, boxCollider)); map.Add(new Edge(upRight, downRight, boxCollider)); map.Add(new Edge(downRight, downLeft, boxCollider)); map.Add(new Edge(downLeft, upLeft, boxCollider)); DebugScript.DrawCross(upLeft.position, 0.1f, Color.red, 100); DebugScript.DrawCross(upRight.position, 0.1f, Color.white, 100); DebugScript.DrawCross(downRight.position, 0.1f, Color.blue, 100); DebugScript.DrawCross(downLeft.position, 0.1f, Color.yellow, 100); } //EdgeCollider2D else if (collider is EdgeCollider2D edgeCollider) { Vector2[] points = edgeCollider.points; for (int i = 0; i < points.Length; i++) { points[i] = edgeCollider.transform.localToWorldMatrix.MultiplyPoint3x4(points[i]); } for (int i = 1; i < points.Length; i++) { map.Add(new Edge(points[i - 1], points[i], edgeCollider)); } //Color[] colors = { Color.red, Color.white, Color.blue, Color.yellow }; //for (int i = 0; i < points.Length; i++) //DebugScript.DrawCross(points[i], 0.1f, colors[(int)Mathf.Repeat(i, colors.Length)]); } //PolygonCollider2D else if (collider is PolygonCollider2D polygonCollider) { Vector2[] points = polygonCollider.points; for (int i = 0; i < points.Length; i++) { points[i] = polygonCollider.transform.localToWorldMatrix.MultiplyPoint3x4(points[i]); } for (int i = 1; i < points.Length; i++) { map.Add(new Edge(points[i - 1], points[i], polygonCollider)); } map.Add(new Edge(points[points.Length - 1], points[0], polygonCollider)); //Color[] colors = { Color.red, Color.white, Color.blue, Color.yellow }; //for (int i = 0; i < points.Length; i++) //DebugScript.DrawCross(points[i], 0.1f, colors[(int)Mathf.Repeat(i, colors.Length)]); } //Unsupported type else { Debug.LogError("Unsupported Collider2D type found during Visibility2D map generation"); } } return(map); }
void Visibility(Vector2 center, List <Edge> map) { /* * Algorithm Explanation: * * Inputs: A map of all vision blocking edges (as line segments) * * 1) Create a list of all unique angles from point of vision to each point on map * 2) Starting from an arbitrary angle, iterate through each angle the list as a * ray to check for intersections with edges on map, storing the closest intersection * for each angle * 3) Sort intersections by angle calculated in step 1 * 4) The visibility polygon is constructd by iterating over intersections * 5) Build mesh by stitching each set of adjacent intersections * and the origin into a triangle * * Sources: * https://www.redblobgames.com/articles/visibility/ * https://github.com/ncase/sight-and-light/blob/gh-pages/draft8.html * * Note: Adding the edges of screen to the map is necessary so the extents of the screen * are inlucded in the visibility polygon */ // 1) Create a list of all unique angles from point of vision to each point on map map = new List <Edge>(map); //Find corners of screen Point lowerLeft = new Point(Camera.main.ViewportToWorldPoint(new Vector3(0, 0, 0))); Point upperRight = new Point(Camera.main.ViewportToWorldPoint(new Vector3(1, 1, 0))); Point upperLeft = new Point(new Vector2(lowerLeft.x, upperRight.y)); Point lowerRight = new Point(new Vector2(upperRight.x, lowerLeft.y)); map.Add(new Edge(upperLeft, upperRight)); map.Add(new Edge(upperRight, lowerRight)); map.Add(new Edge(lowerRight, lowerLeft)); map.Add(new Edge(lowerLeft, upperLeft)); //Cull edges wholly off screen for (int i = 0; i < map.Count; i++) { Edge edge = map[i]; if ((edge.start.x < upperLeft.x && edge.end.x < upperLeft.x) || //Too far left (edge.start.x > lowerRight.x && edge.end.x > lowerRight.x) || //Too far right (edge.start.y > upperLeft.y && edge.end.y > upperLeft.y) || //Too far up (edge.start.y < lowerRight.y && edge.end.y < lowerRight.y)) //Too far down { map.RemoveAt(i--); } } Edge.MergePoints(map, 0.01f); //Get all points in map Point[] points = GetPointsInMaps(map); if (debugVisibility) { for (int i = 0; i < map.Count; i++) { Debug.DrawLine(map[i].start.position, map[i].end.position, Color.yellow); } } //Debug points if (debugEdgeCount) { Point.DebugPointCount(new List <Point>(points)); } // Update angles for points UpdateAnglesForPoints(points, center); // Remove identical angles HashSet <Point> uniqueAngles = new HashSet <Point>(new PointAngleEqualityComparer()); for (int i = 0; i < points.Length; i++) { uniqueAngles.Add(points[i]); } points = new Point[uniqueAngles.Count]; uniqueAngles.CopyTo(points); for (int i = 0; i < points.Length; i++) { Point point = points[i]; if (debugVisibility) { Debug.DrawRay(center, new Vector2(Mathf.Cos(point.angle), Mathf.Sin(point.angle)) * maxDist, Color.cyan); } } // 2) Starting from an arbitrary angle, iterate through each angle in the list as a // ray to check for intersections with edges on map, storing the closest intersection // for each angle //TODO should use object pooling for intersections or make an intersection struct List <Point> intersections = new List <Point>(); // For each point find closest intersection, if any for (int i = 0; i < points.Length; i++) { Point point = points[i]; Vector2 rayEnd = new Vector2(Mathf.Cos(point.angle), Mathf.Sin(point.angle)) * maxDist + center; Point closestIntersection = new Point(); closestIntersection.angle = point.angle; bool edgeOnLeft = false; bool edgeOnRight = false; float epsilon = 0.0001f; if (point.edges.Count > 1) { foreach (Edge edge in point.edges) { float sideOfLine = PointSideOfLine(edge.start.position, rayEnd, center); if (sideOfLine < -epsilon) { edgeOnRight = true; } if (sideOfLine > epsilon) { edgeOnLeft = true; } sideOfLine = PointSideOfLine(edge.end.position, rayEnd, center); if (sideOfLine < -epsilon) { edgeOnRight = true; } if (sideOfLine > epsilon) { edgeOnLeft = true; } } } bool ignoreAdjacent = !(edgeOnLeft && edgeOnRight); //Compare ray to all edges for (int u = 0; u < map.Count; u++) { Edge edge = map[u]; //Handle corners by ignoring edges who's start or end points are at the intersection (ie, probably the target for this ray) //but only if there isn't another edge sharing the point and on the other side of the ray. This skims corners but doesn't //penetrate if two segments are connected if (ignoreAdjacent && (edge.start == point || edge.end == point)) { continue; } Vector2 intersectionPosition; if (FindIntersectionLineSegments(center, rayEnd, edge.start.position, edge.end.position, out intersectionPosition)) { if (closestIntersection.edges.Count == 0 || (intersectionPosition - center).sqrMagnitude < (closestIntersection.position - center).sqrMagnitude) { closestIntersection.position = intersectionPosition; closestIntersection.edges.Add(edge); } } } if (closestIntersection.edges.Count == 0) { closestIntersection.position = rayEnd; } intersections.Add(closestIntersection); if (ignoreAdjacent && (point.position - center).sqrMagnitude < (closestIntersection.position - center).sqrMagnitude) { intersections.Insert(intersections.Count - 1, point); } } //Debug intersections for (int i = 0; i < intersections.Count; i++) { Point intersection = intersections[i]; if (debugVisibility) { Debug.DrawLine(center, intersection.position, Color.magenta); } if (debugVisibility) { DebugScript.DrawCross(intersection.position, 0.2f, Color.red); } } // 3) Sort intersects by angle Point[] intersectionsArray = intersections.ToArray(); intersectionsArray.MergeSort(0, intersections.Count - 1, new PointAnglerComparer()); // 4) The visibility polygon is constructd by stitching each two intersection points // together with the origin to create triangles // 5) Build mesh by stitching each set of adjacent intersections // and the origin into a triangle }
private void fixNamesAndBitmaps() { System.String synthetic = "synthetic: "; System.String actions = "Actions for "; System.Collections.IEnumerator debugScriptIter = debugScripts.GetEnumerator(); //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'" while (debugScriptIter.MoveNext()) { //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'" DebugScript debugScript = (DebugScript)debugScriptIter.Current; if (isFrameworkClass(debugScript.name)) { // bitmap = 3 => Framework file debugScript.bitmap = 3; } else if (debugScript.name.StartsWith(synthetic)) { // bitmap = 4 => Other per-component synthetic files // produced by MXML compiler debugScript.bitmap = 4; System.String lookFor = "synthetic: Object.registerClass() for "; if (debugScript.name.StartsWith(lookFor)) { System.String componentName = debugScript.name.Substring(lookFor.Length); debugScript.name = "<" + componentName + ".2>"; } else { // R: should really check for a collision here... System.String componentName = debugScript.name.Substring(synthetic.Length); debugScript.name = "<" + componentName + ".1>"; } } else if (debugScript.name.StartsWith(actions)) { // bitmap = 5 => Actions ... debugScript.bitmap = 5; } else if (debugScript.name.Equals(mainDebugScriptName)) { // bitmap = 1 => Main MXML file for application debugScript.bitmap = 1; } else { // bitmap = 2 => Other file, presumably an MXML or AS file // written by the application author debugScript.name = DebugDecoder.adjustModuleName(debugScript.name); debugScript.bitmap = 2; } // Set the comparableName field of each DebugScript // to the concatenation of the bitmap and the "short name" that fdb uses. // This will ensure that DebugScripts are sorted alphabetically // within each "bitmap" category. debugScript.comparableName = ((System.Int32)debugScript.bitmap).ToString() + generateShortName(debugScript.name); // System.out.print(debugScript.comparableName + " " + debugScript.name); } }
private void encodeSwdData(SwfEncoder buffer) { // Encode the header. buffer.write32(('F') | ('W' << 8) | ('D' << 16) | (version << 24)); // Encode one kDebugID tag. buffer.write32(flash.swf.DebugTags_Fields.kDebugID); buffer.write(debugID); // Encode the kDebugScript and kDebugOffset tags. // The kDebugScript tags are in module number order (1,2,3,...). // After each one of these are the associated kDebugOffset tags // for that module number, in ascending order // by line number and byte offset. SupportClass.CollectionsSupport.Sort(debugScripts, null); int id = 0; System.Collections.IEnumerator debugScriptIter = debugScripts.GetEnumerator(); //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'" while (debugScriptIter.MoveNext()) { //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'" DebugScript debugScript = (DebugScript)debugScriptIter.Current; id++; buffer.write32(flash.swf.DebugTags_Fields.kDebugScript); buffer.write32(id); buffer.write32(debugScript.bitmap); buffer.writeString(debugScript.name); buffer.writeString(debugScript.text); SupportClass.CollectionsSupport.Sort(debugScript.debugOffsets, null); System.Collections.IEnumerator debugOffsetIter = debugScript.debugOffsets.GetEnumerator(); //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'" while (debugOffsetIter.MoveNext()) { //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'" DebugOffset debugOffset = (DebugOffset)debugOffsetIter.Current; buffer.write32(flash.swf.DebugTags_Fields.kDebugOffset); buffer.write32(id); buffer.write32(debugOffset.lineNumber); buffer.write32(debugOffset.byteOffset); } } // Encode the kDebugRegister tags SupportClass.CollectionsSupport.Sort(debugRegisters, null); System.Collections.IEnumerator itr = debugRegisters.GetEnumerator(); //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'" while (itr.MoveNext()) { //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'" DebugRegisters debug = (DebugRegisters)itr.Current; int size = debug.registerNumbers.Length; buffer.write32(flash.swf.DebugTags_Fields.kDebugRegisters); buffer.write32(debug.offset); buffer.writeUI8(size); for (int i = 0; i < debug.registerNumbers.Length; i++) { buffer.writeUI8(debug.registerNumbers[i]); buffer.writeString(debug.variableNames[i]); } } // Encode the kDebugBreakpoint tags SupportClass.CollectionsSupport.Sort(debugBreakpoints, null); System.Collections.IEnumerator debugBreakpointIterator = debugBreakpoints.GetEnumerator(); //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'" while (debugBreakpointIterator.MoveNext()) { //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'" DebugBreakpoint debugBreakpoint = (DebugBreakpoint)debugBreakpointIterator.Current; buffer.write32(flash.swf.DebugTags_Fields.kDebugBreakpoint); buffer.write32(debugBreakpoint.offset); } }
// Use this for initialization void InitAgent(int i) { AnimationAnalyzer analyzer = null; // Initialize different components of the agents // ( Animation Engine, Planner, Neighbors, ...) //foreach (GameObject agent in agents) //for(int i = 0; i < agents.Length; i++) { GameObject agent = agents[i]; //agent.active = true; agent.transform.position = agentsPos[i]; //if (analyzer == null) { analyzer = agent.GetComponent("AnimationAnalyzer") as AnimationAnalyzer; if (analyzer != null) { analyzer.Init(); //analyzer.ReadAnalysisFromFile(animationsFileName); } } /* * else * { * Vector3 startPos = agent.transform.position; * Quaternion startRot = agent.transform.rotation; * analyzer.RemoveAnimations(agent.animation); * agent.transform.position = startPos; * agent.transform.rotation = startRot; * } */ NeighbourAgents neighbourAgents = agent.GetComponent("NeighbourAgents") as NeighbourAgents; //if (neighbourAgents != null) // neighbourAgents.Init(); NeighbourObstacles neighbourObstacles = agent.GetComponent("NeighbourObstacles") as NeighbourObstacles; //if (neighbourObstacles != null) // neighbourObstacles.Init(); Planner planning; if (ADAFootstepTest.ADA_PLANNER_IN_USE) { ADAFootstepTest ADAplanning = agent.GetComponent("ADAFootstepTest") as ADAFootstepTest; planning = ADAplanning as Planner; } else { FootstepPlanningTest FPTplanning = agent.GetComponent("FootstepPlanningTest") as FootstepPlanningTest; planning = FPTplanning as Planner; } if (planning != null) { planning.Init(analyzer, neighbourAgents, neighbourObstacles); } AnimationEngine engine = agent.GetComponent("AnimationEngine") as AnimationEngine; if (engine != null) { engine.Init(analyzer, planning, neighbourAgents, neighbourObstacles); } CollisionReaction collider = agent.GetComponent("CollisionReaction") as CollisionReaction; if (collider != null) { collider.Init(analyzer, planning, engine, neighbourAgents, neighbourObstacles); } NavMeshWayPoints waypoints = agent.GetComponent("NavMeshWayPoints") as NavMeshWayPoints; if (waypoints != null) { waypoints.Init(planning, steering, analyzer, neighbourAgents, neighbourObstacles); } PlaceFootSteps footsteps = agent.GetComponent("PlaceFootSteps") as PlaceFootSteps; if (footsteps != null) { footsteps.Init(analyzer, planning, engine, neighbourAgents, neighbourObstacles); } EventsMonitor events = agent.GetComponent("EventsMonitor") as EventsMonitor; if (events != null) { events.Init(analyzer, planning, engine, collider, waypoints, steering, neighbourAgents, neighbourObstacles, footsteps); events.enabled = false; } DebugScript debug = agent.GetComponent("DebugScript") as DebugScript; if (debug != null) { debug.Init(analyzer, engine, planning, neighbourAgents, neighbourObstacles, collider); } if (analyzer != null) { analyzer.RemoveAnimations(agent.animation); } } }
/// <summary> Implement Comparable interface for sorting DebugScripts</summary> public virtual int CompareTo(System.Object o) { DebugScript other = (DebugScript)o; return(String.CompareOrdinal(comparableName, other.comparableName)); }
public void ContinueGame() { DebugScript.UnPause(); }
private void execute() { if(instance == null || instance.Equals(this)) { instance = this; DontDestroyOnLoad(gameObject); if(!debug) return; switch(getCurrentScene()) { case Scene.StartUp: if(rightScene()) { Destroy(gameObject); return; } if(offline) { GameObject.FindObjectOfType<StartUp>().singleplayerMode(); } else { GameObject.FindObjectOfType<StartUp>().multiplayerMode(); } break; case Scene.RoomFinder: if(rightScene()) { Destroy(gameObject); return; } if(offline) { Application.LoadLevel("StartUp"); } else { GameObject.FindObjectOfType<RoomFinder>().autoJoin(); } break; case Scene.Lobby: if (!PhotonNetwork.connected) { if(offline) { Application.LoadLevel("StartUp"); } else { Application.LoadLevel("RoomFinder"); } } else { if(rightScene()) { Destroy(gameObject); return; } GameObject.FindObjectOfType<Lobby>().startGame(); } break; case Scene.Game: if (!PhotonNetwork.connected) { if(offline) { Application.LoadLevel("StartUp"); } else { Application.LoadLevel("RoomFinder"); } } break; case Scene.Invalid: default: Debug.LogError("No Known Scene"); break; } } else { Destroy(gameObject); } }