void Update() { if (Input.touchCount < 1) { return; } Touch touch = Input.GetTouch(0); //Visial Debugging Vector2 touchPos = Camera.main.ScreenToWorldPoint(touch.position); Color circleColor = Color.white; // Cache the touch data (for GUI). _touchData = new TouchData(touch); if (touch.phase == TouchPhase.Moved) { if (TouchSpeedIsSignificant(touch)) { //Swipe gesture detected if (!_swipeTrail.activeInHierarchy) { _swipeTrail.SetActive(true); } _swipeTrail.transform.position = touchPos; circleColor = Color.red; } } GLDebug.DrawCircle(touchPos, .3f, circleColor, 2f); }
void DrawBezier() { float length = 0f; Vector3 lastPos = p0.position; while (length < 1) { Vector3 Apos = Vector3.Lerp(p0.position, p1.position, length); Vector3 Bpos = Vector3.Lerp(p1.position, p2.position, length); Vector3 tempPos = Vector3.Lerp(Apos, Bpos, length); Vector3[] controles = new Vector3[] { p0.position, p1.position, p2.position }; Vector3 final_pos = getBezierPos(controles, length); GLDebug.DrawLine(lastPos, final_pos, Color.red, 0, true); if (showNormals) { DrawNormal(Apos, Bpos, tempPos); } lastPos = tempPos; length += precision; } GLDebug.DrawLine(lastPos, p2.position, Color.red, 0, true); }
void Init() { instance = this; linesZOn = new List <Line>(); linesZOff = new List <Line>(); }
private void CreateCutPlane() { Vector3 center = Vector3.Lerp(_startPos, _endPos, .5f); Vector3 cut = (_endPos - _startPos).normalized; Vector3 fwd = (center - cylinder.transform.position).normalized; Vector3 normal = Vector3.Cross(fwd, cut).normalized; GLDebug.DrawLine(center, center + normal, Color.red, 2f, false); GLDebug.DrawLine(center + fwd * CutPlaneSize / 2f + cut * CutPlaneSize / 2f, center + fwd * CutPlaneSize / 2f + cut * CutPlaneSize / -2f, Color.green, 2f); GLDebug.DrawLine(center + fwd * CutPlaneSize / 2f + cut * CutPlaneSize / -2f, center + fwd * CutPlaneSize / -2f + cut * CutPlaneSize / -2f, Color.green, 2f); GLDebug.DrawLine(center + fwd * CutPlaneSize / -2f + cut * CutPlaneSize / -2f, center + fwd * CutPlaneSize / -2f + cut * CutPlaneSize / 2f, Color.green, 2f); GLDebug.DrawLine(center + fwd * CutPlaneSize / -2f + cut * CutPlaneSize / 2f, center + fwd * CutPlaneSize / 2f + cut * CutPlaneSize / 2f, Color.green, 2f); goCutPlane = Instantiate(CutPlane); goCutPlane.transform.position = center; goCutPlane.transform.up = normal; offset = pointer.transform.position - goCutPlane.transform.position; pointerrotation = pointer.transform.rotation; objectrotation = goCutPlane.transform.rotation; }
private void PlatformDispose() { GLDebug.CheckAccess(); GL.DeleteBuffer(vertexBufferId); GL.DeleteProgram(shaderProgramHandle); }
private void PlatformCreateShaders() { GLDebug.CheckAccess(); var vertexShaderHandle = GL.CreateShader(ShaderType.VertexShader); var fragmentShaderHandle = GL.CreateShader(ShaderType.FragmentShader); GL.ShaderSource(vertexShaderHandle, vertexShaderSource); GL.ShaderSource(fragmentShaderHandle, fragmentShaderSource); GL.CompileShader(vertexShaderHandle); GL.CompileShader(fragmentShaderHandle); // Create program shaderProgramHandle = GL.CreateProgram(); GL.AttachShader(shaderProgramHandle, vertexShaderHandle); GL.AttachShader(shaderProgramHandle, fragmentShaderHandle); GL.BindAttribLocation(shaderProgramHandle, 0, "in_position"); GL.BindAttribLocation(shaderProgramHandle, 1, "in_color"); GL.BindAttribLocation(shaderProgramHandle, 2, "in_uv"); GL.LinkProgram(shaderProgramHandle); Debug.WriteLine(GL.GetProgramInfoLog(shaderProgramHandle)); GL.UseProgram(shaderProgramHandle); // Set uniforms transformLocation = GL.GetUniformLocation(shaderProgramHandle, "transform"); }
protected override void drawDebug(int pointers) { base.drawDebug(pointers); if (!DebugMode) { return; } switch (pointers) { case 1: if (projection == ProjectionType.Global || projection == ProjectionType.Object) { GLDebug.DrawPlaneWithNormal(debugID + 3, cachedTransform.position, RotationAxis, 4f, GLDebug.MULTIPLY, float.PositiveInfinity); } break; default: if (projection == ProjectionType.Global || projection == ProjectionType.Object) { GLDebug.DrawPlaneWithNormal(debugID + 3, cachedTransform.position, RotationAxis, 4f, GLDebug.MULTIPLY, float.PositiveInfinity); } break; } }
protected virtual void drawDebug(Vector2 point1, Vector2 point2) { var color = State == GestureState.Possible ? Color.red : Color.green; GLDebug.DrawSquareScreenSpace(debugID + 1, point2, 0f, debugTouchSize, color, float.PositiveInfinity); GLDebug.DrawLineScreenSpace(debugID + 2, point1, point2, color, float.PositiveInfinity); }
protected virtual void drawDebug(int touchPoints) { if (!DebugMode) { return; } var color = State == GestureState.Possible ? Color.red : Color.green; switch (touchPoints) { case 1: GLDebug.DrawSquareScreenSpace(debugID, getPointScreenPosition(0), 0f, debugPointerSize, color, float.PositiveInfinity); GLDebug.RemoveFigure(debugID + 1); GLDebug.RemoveFigure(debugID + 2); break; default: var newScreenPos1 = getPointScreenPosition(0); var newScreenPos2 = getPointScreenPosition(1); GLDebug.DrawSquareScreenSpace(debugID, newScreenPos1, 0f, debugPointerSize, color, float.PositiveInfinity); GLDebug.DrawSquareScreenSpace(debugID + 1, newScreenPos2, 0f, debugPointerSize, color, float.PositiveInfinity); GLDebug.DrawLineWithCrossScreenSpace(debugID + 2, newScreenPos1, newScreenPos2, .5f, debugPointerSize * .3f, color, float.PositiveInfinity); break; } }
public override Status Update() { Vector3 dir = (controller._TargetPos - controller.transform.position).normalized; Ray ray = new Ray(controller.transform.position, dir); RaycastHit hit; bool isInAngleView = Vector3.Angle( controller.transform.forward, dir) <= controller._MaxAngleView; GLDebug.DrawRay(ray.origin, ray.direction * controller._MaxDstView, isInAngleView ? Color.green : Color.red); if (isInAngleView && Physics.Raycast(ray, out hit, controller._MaxDstView) && hit.transform.gameObject.layer == LayerMask.NameToLayer("Player")) { //Debug.Log("Target is visible!"); return(Status.Success); } else { //Debug.Log("Target isn't visible!"); return(Status.Failure); } }
IEnumerator Thorn() { while (true) { GameObject gun = GameObject.FindWithTag("MyGun"); transform.position = gun.transform.rotation * Vector3.up * currDist + gun.transform.position; transform.rotation = gun.transform.rotation; GLDebug.DrawLine(transform.position, gun.transform.position + transform.rotation * (new Vector3(0, 0.05f, 0)), Color.black); GLDebug.DrawLine(transform.position + (transform.rotation * Vector3.right * 0.015f), gun.transform.position + transform.rotation * (new Vector3(0, 0.05f, 0)) + (transform.rotation * Vector3.right * 0.015f), Color.black); GLDebug.DrawLine(transform.position - (transform.rotation * Vector3.right * 0.015f), gun.transform.position + transform.rotation * (new Vector3(0, 0.05f, 0)) - (transform.rotation * Vector3.right * 0.015f), Color.black); if (currDist < range && dir) { currDist += Time.deltaTime * speed; } else { dir = false; currDist -= Time.deltaTime * speed * 5; if (currDist <= 0.1f) { Destroy(this.gameObject); gun.GetComponent <GunScript>().isntCD = true; } } yield return(0); } }
public override void drawDebug() { base.drawDebug(); Vector2 v = this.getFootprintSize(); GLDebug.DrawCube(this.transform.position, Quaternion.identity, new Vector3(v.x, 0.35f, v.y), Colors.purple); }
void DrawNormal(Vector3 a, Vector3 b, Vector3 origin) { Vector3 tan = (b - a).normalized; Vector3 binormal = Vector3.Cross(tan, Vector3.up); Vector3 normal = Vector3.Cross(binormal, tan); GLDebug.DrawRay(origin, normal, Color.cyan, 0, true); }
public override void drawDebug() { if (Util.isAlive(this.target)) { Color c = this.unit.attack.inRangeToAttack(this.target) ? Color.green : Color.red; GLDebug.DrawLine(this.unit.getPos(), this.target.getPos(), c); } }
public static float Wrap01(float value) { int n = Mathf.FloorToInt(value); float result = value - n; GLDebug.Assert(InRange01(result), "result is not in [0, 1)"); return(result); }
protected virtual void Update() { if (WeaponsSettings.drawLineFromGun) { Vector3 start, end; this.GetLineFromGun(out start, out end); GLDebug.DrawLine(start, end, Color.red, 0, true); } }
protected virtual void Update() { if (CanDrawCollider()) { Bounds bounds = m_BoxCollider.bounds; Quaternion rotation = transform.rotation; rotation *= Quaternion.Euler(Vector3.right * 90f); GLDebug.DrawSquare(bounds.center, rotation, new Vector3(m_BoxCollider.size.x, 0f, m_BoxCollider.size.y), m_ColliderColor); } }
protected override void drawDebug(Vector2 point1, Vector2 point2) { base.drawDebug(point1, point2); if (!DebugMode) { return; } GLDebug.DrawPlaneWithNormal(debugID + 3, cachedTransform.position, RotationAxis, 1f, GLDebug.MULTIPLY, float.PositiveInfinity); }
public void Hide() { if (!Application.isPlaying) { return; } GLDebug.RemoveFigure(currentDebugId); currentDebugId = -1; }
internal void shot(GameObject obj) { //Debug.DrawLine(lineOfSight.transform.position, obj.transform.position, Color.green); GLDebug.DrawLine(lineOfSight.transform.position, obj.transform.position, Color.green); if (!audioSrc.isPlaying) { audioSrc.Play(); StartCoroutine(restoreAudio()); } }
public void drawDebug() { const float f = Chunk.SIZEf / 2; GLDebug.DrawSquare(this.chunkPos.toWorldSpaceVector() + new Vector3(f, 0, f), Quaternion.identity, new Vector3(SIZE, SIZE, SIZE), Colors.magenta); foreach (MapObject obj in this.mapObjects) { obj.drawDebug(); } }
void Awake() { if (instance) { DestroyImmediate(this); return; } instance = this; SetMaterial(); linesZOff = new List <Line>(); }
public override void DrawTransform(ref Matrix4 transform, float orthoLen) { var origin = transform.ExtractTranslation( ); var x = origin + transform.Row0.Xyz.Normalized( ) * orthoLen; var y = origin + transform.Row1.Xyz.Normalized() * orthoLen; var z = origin + transform.Row2.Xyz.Normalized() * orthoLen; GLDebug.QueueLineDraw(ref origin, ref x); GLDebug.QueueLineDraw(ref origin, ref y); GLDebug.QueueLineDraw(ref origin, ref z); }
protected virtual void drawDebug(Vector2 point1, Vector2 point2) { if (!DebugMode) { return; } var color = IsOpen == GestureState.Possible ? Color.red : Color.green; GLDebug.DrawSquareScreenSpace(debugID + 1, point2, 0f, debugPointerSize, color, float.PositiveInfinity); GLDebug.DrawLineScreenSpace(debugID + 2, point1, point2, color, float.PositiveInfinity); }
void Awake() { // if (instance) // { // Destroy (this); // return; // } instance = this; SetMaterial(); linesZOn = new List <Line> (); linesZOff = new List <Line> (); }
protected virtual void clearDebug() { GLDebug.RemoveFigure(debugID); GLDebug.RemoveFigure(debugID + 1); GLDebug.RemoveFigure(debugID + 2); if (debugCoroutine != null) { StopCoroutine(debugCoroutine); } debugCoroutine = null; }
public override void drawDebug() { base.drawDebug(); // Draw a line to mark the point and a line to conenct the unit to it's point. GLDebug.DrawLine(this.defendPoint, this.defendPoint + Vector3.up * 4, Color.black); GLDebug.DrawLine(this.unit.getPos(), this.defendPoint, Color.gray); foreach (Vector3 v in Direction.CARDINAL) { GLDebug.DrawLine(this.defendPoint, this.defendPoint + (v * Constants.AI_FIGHTING_DEFEND_RANGE), Color.black); } }
public override void drawDebug() { foreach (Vector3 v in this.points) { GLDebug.DrawArrow(v, Vector3.up * 2.5f, 0.25f, 20, v == this.whackPoint ? Colors.orange : Color.yellow); } if (Util.isAlive(this.building)) { GLDebug.DrawLine(this.unit.getPos(), this.building.getPos(), this.func() ? Colors.green : Colors.red); } }
public override void drawDebug() { base.drawDebug(); // Draw a line to mark the point and a line to conenct the unit to it's point. GLDebug.DrawLine(pointToDefend, pointToDefend + Vector3.up * 4, Color.black); GLDebug.DrawLine(unit.getPos(), pointToDefend, Color.gray); foreach (Direction d in Direction.horizontal) { GLDebug.DrawLine(pointToDefend, pointToDefend + (d.vector * Constants.AI_FIGHTING_DEFEND_RANGE), Color.black); } }
public override void drawDebug() { base.drawDebug(); // Draw lines to the target and drop off point. bool flag = this.unit.canHoldMore(); if (Util.isAlive(this.target)) { GLDebug.DrawLine(this.unit.getPos(), this.target.getPos() + Vector3.up, this.closeEnough() ? Colors.green : Colors.red); } }
//private float milliseconds = 0f; void Awake () { if (instance) { DestroyImmediate (this); return; } instance = this; SetMaterial (); linesZOn = new List<Line> (); linesZOff = new List<Line> (); vertexes = new List<Vector3>(); }