private void OnDrawGizmosSelected() { Vector3 direction = targetPoint - rootPoint; Vector3 tangent = direction.normalized; Vector3 normal = new Vector3(-tangent.y, tangent.x); /* * Gizmos.DrawLine(rootPoint - normal * radius, rootPoint + normal * radius); * Gizmos.DrawRay(rootPoint - normal * radius, tangent); * Gizmos.DrawRay(rootPoint + normal * radius, tangent); * Gizmos.DrawRay(rootPoint - normal * radius, tangent); */ GizmosExtensions2D.DrawPathDirections( rootPoint - normal * radius * 2 + direction, normal * radius, -direction, normal * radius * 2, direction, normal * radius ); GizmosExtensions2D.DrawPathPoints( rootPoint + direction + normal * radius * 2, rootPoint + direction + tangent * radius * 2, rootPoint + direction - normal * radius * 2 ); }
// Update is called once per frame /* * protected override void Update() * { * base.Update(); * } */ private void OnDrawGizmos() { GizmosExtensions2D.DrawArrow2D(transform.position, transform.position + new Vector3((moveDistanceMax - moveDistance) * Mathf.Cos(moveAngle), (moveDistanceMax - moveDistance) * Mathf.Sin(moveAngle))); GizmosExtensions2D.DrawArrow2D(transform.position, transform.position + new Vector3((-moveDistance - moveDistanceMax) * Mathf.Cos(moveAngle), (-moveDistance - moveDistanceMax) * Mathf.Sin(moveAngle))); }
private void OnDrawGizmos() { if (!EditorApplication.isPlaying) { startPos = transform.position; } Gizmos.color = Color.white; GizmosExtensions2D.DrawArrow2D(startPos, startPos + new Vector2(xAmount, yAmount)); }
/* * public bool[] GetStageExist() * { * return canGoStage; * } * * public override bool goRightStage(ref StageState _nowStage) * { * if (rightStage == null) return false; * _nowStage = rightStage; * return true; * } * public override bool goLeftStage(ref StageState _nowStage) * { * if (leftStage == null) return false; * _nowStage = leftStage; * return true; * } * public override bool goUpStage(ref StageState _nowStage) * { * if (upStage == null) return false; ; * _nowStage = upStage; * return true; * } * public override bool goDownStage(ref StageState _nowStage) * { * if (downStage == null) return false; * _nowStage = downStage; * return true; * }*/ #if UNITY_EDITOR private void OnDrawGizmos() { if (nextStage.upStage != null) { Vector3 from = transform.position; Vector3 to; foreach (Transform pathTransform in stagePath.upPath) { to = pathTransform.position; GizmosExtensions2D.DrawArrow2D(from, to); from = pathTransform.position; } to = nextStage.upStage.transform.position; GizmosExtensions2D.DrawArrow2D(from, to); } if (nextStage.rightStage != null) { Vector3 from = transform.position; Vector3 to; foreach (Transform pathTransform in stagePath.rightPath) { to = pathTransform.position; GizmosExtensions2D.DrawArrow2D(from, to); from = pathTransform.position; } to = nextStage.rightStage.transform.position; GizmosExtensions2D.DrawArrow2D(from, to); } if (nextStage.downStage != null) { Vector3 from = transform.position; Vector3 to; foreach (Transform pathTransform in stagePath.downPath) { to = pathTransform.position; GizmosExtensions2D.DrawArrow2D(from, to); from = pathTransform.position; } to = nextStage.downStage.transform.position; GizmosExtensions2D.DrawArrow2D(from, to); } if (nextStage.leftStage != null) { Vector3 from = transform.position; Vector3 to; foreach (Transform pathTransform in stagePath.leftPath) { to = pathTransform.position; GizmosExtensions2D.DrawArrow2D(from, to); from = pathTransform.position; } to = nextStage.leftStage.transform.position; GizmosExtensions2D.DrawArrow2D(from, to); } }
private void OnDrawGizmos() { if (!EditorApplication.isPlaying) { pivot = transform.position; } Gizmos.color = Color.green; //Gizmos.DrawWireSphere(pivot, radius); //GizmosExtensions.DrawWireArc(pivot, radius, maxAngle, 36 ,Quaternion.Euler(-startAngle, 90, 90)); GizmosExtensions2D.DrawWireCircle2D(pivot + new Vector3(radius * Mathf.Cos((startAngle - delay / duration * maxAngle) * Mathf.Deg2Rad), radius * Mathf.Sin((startAngle - delay / duration * maxAngle) * Mathf.Deg2Rad)), radius / 8, 20); //GizmosExtensions2D.DrawWireArc2D(pivot, radius, startAngle, startAngle + maxAngle, 36); GizmosExtensions2D.DrawWireArcArrow2D(pivot, radius, startAngle, startAngle + maxAngle, 36); }
private void OnDrawGizmos() { foreach (RocketFlagment child in rocketFlagment) { Vector3 from = child.rocketSprite.transform.position; Vector3 to; foreach (Vector3 path in child.pathPosition) { to = path; GizmosExtensions2D.DrawArrow2D(from, to); from = to; } } }
private void OnDrawGizmos() { if (!EditorApplication.isPlaying) { startPos = transform.position; startPoint.Anchore = startPos; } Gizmos.color = Color.white; Gizmos.DrawLine(startPoint.Anchore, startPoint.Anchore + startPoint.Handle2); Gizmos.DrawLine(startPoint.Anchore + endPoint.Anchore, startPoint.Anchore + endPoint.Anchore + endPoint.Handle1); GizmosExtensions2D.DrawBezierCurve2D(startPoint.Anchore, startPoint.Anchore + startPoint.Handle2, startPoint.Anchore + endPoint.Anchore + endPoint.Handle1, startPoint.Anchore + endPoint.Anchore); Gizmos.color = Color.red; GizmosExtensions2D.DrawWireRect2D(startPoint.Anchore + startPoint.Handle2, 1, 1); GizmosExtensions2D.DrawWireRect2D(startPoint.Anchore + endPoint.Anchore + endPoint.Handle1, 1, 1); }
/* * private void GetFlagmentAnimation() * { * // スプライトを表示する * GetComponent<SpriteRenderer>().enabled = true; * * // 操作を受け付けなくする * ActionInput.actionEnabled = false; * * // カメラを有効にする * vcamera.gameObject.SetActive(true); * vcamera.Follow = gameObject.transform; * * // pathに最後の目的地を含める * path[path.Length - 1] = destination.position; * * // 移動する * transform.DOLocalPath( * path, * moveTime, * PathType.CatmullRom).SetEase(Ease.InQuint).OnComplete(() => EndAnimation()); * }*/ #if UNITY_EDITOR private void OnDrawGizmos() { if (StageTable.prevStageClearedList[stageId]) { return; } Vector3 from = transform.position; Vector3 to; foreach (Vector3 path in path) { to = path; GizmosExtensions2D.DrawArrow2D(from, to); from = to; } to = destination.position; GizmosExtensions2D.DrawArrow2D(from, to); }
private void OnDrawGizmos() { if (!EditorApplication.isPlaying) { startPos = transform.position; } //GizmosExtensions2D.DrawArrow2D(startPos, startPos + new Vector3(speedX, speedY)); if (paths.Length > 0) { Vector3 from = startPos; Vector3 to; Gizmos.color = Color.white; for (int i = 0; i < paths.Length; i++) { to = from + (Vector3)paths[i].pos; GizmosExtensions2D.DrawArrow2D(from, to); from = to; } } }
private void OnDrawGizmos() { if (!EditorApplication.isPlaying) { startAngle = transform.rotation.eulerAngles.z; if (!collider) { collider = GetComponent <Collider2D>(); } if (collider) { radius = new float[2] { collider.bounds.size.x, collider.bounds.size.y }.Max() / 2; } } Gizmos.color = Color.white; GizmosExtensions2D.DrawWireArcArrow2D(transform.position, radius, startAngle, startAngle + maxAngle); //GizmosExtensions2D.DrawWireRect2D(transform.position, 1, 2, 30); }
private void OnDrawGizmos() { GizmosExtensions2D.DrawWireCircle2D(transform.position, radius); if ((target.transform.position - transform.position).magnitude < radius) { Gizmos.color = Color.red; } else { Gizmos.color = Color.white; } switch (attackType) { case AttackType.Target: float distance = (transform.position - target.transform.position).magnitude; distance = Mathf.Min(distance, radius); GizmosExtensions2D.DrawArrow2D(transform.position, transform.position + (target.transform.position - transform.position).normalized * distance); break; case AttackType.Direction: GizmosExtensions2D.DrawArrow2D(transform.position, transform.position + new Vector3(Mathf.Cos(angle * Mathf.Deg2Rad), Mathf.Sin(angle * Mathf.Deg2Rad)) * bulletSpeed); break; } }
private void OnDrawGizmosSelected() { Gizmos.color = Color.red; GizmosExtensions2D.DrawWireRect2D(new Vector3((minX + maxX) / 2, (minY + maxY) / 2), maxX - minX, maxY - minY); }
private void OnDrawGizmos() { /* * //処理中のイベントからマウスの位置取得 * mousePosition = Event.current.mousePosition; * * //シーン上の座標に変換 * mousePosition.y = SceneView.currentDrawingSceneView.camera.pixelHeight - mousePosition.y; * mousePosition = SceneView.currentDrawingSceneView.camera.ScreenToWorldPoint(mousePosition); * * //Debug.Log("座標 : " + mousePosition.x.ToString("F2") + ", " + mousePosition.y.ToString("F2")); * * * if (!EditorApplication.isPlaying) * { * pivot = transform.position; * } * //GizmosExtensions2D.DrawArrow2D(startPos, startPos + new Vector3(speedX, speedY)); * if (path.Count > 0) * { * Vector3 point = new Vector3(0,0,float.MaxValue); * Vector3 from = pivot + (Vector3)path[0].Anchore; * Vector3 to; * Gizmos.color = Color.white; * for (int i = 1; i < path.Count; i++) * { * to = pivot + (Vector3)path[i].Anchore; * //GizmosExtensions2D.DrawBezierCurve2D(from, from + (Vector3)path[i - 1].Handle2, to + (Vector3)path[i].Handle1, to); * //GizmosExtensions2D.DrawBezierCurveArrow2D(from, from + (Vector3)path[i - 1].Handle2, to + (Vector3)path[i].Handle1, to); * Vector3 tmpVec = GizmosExtensions2D.GetNearestPointBezierCurveArrow2D(from, from + (Vector3)path[i - 1].Handle2, to + (Vector3)path[i].Handle1, to, mousePosition); * if(tmpVec.z<1 && tmpVec.z < point.z) * { * point = tmpVec; * } * from = to; * } * if (openEnded) * { * to = pivot + (Vector3)path[0].Anchore; * //GizmosExtensions2D.DrawBezierCurveArrow2D(from, from + (Vector3)path[path.Count - 1].Handle2, to + (Vector3)path[0].Handle1, to); * Vector3 tmpVec = GizmosExtensions2D.GetNearestPointBezierCurveArrow2D(from, from + (Vector3)path[path.Count - 1].Handle2, to + (Vector3)path[0].Handle1, to, mousePosition); * if (tmpVec.z < 1 && tmpVec.z < point.z) * { * point = tmpVec; * } * } * if (point.z < 1) * { * point.z = 0; * GizmosExtensions2D.DrawWireCircle2D(point, 0.1f); * if (Event.current == null || Event.current.type != EventType.MouseUp) * { * return; * } * //今は無理,力が足りない * //path.Add(new ControlPoint(point)); * } * } */ Vector3 point = new Vector3(0, 0, float.MaxValue); Vector3 from = pivot + (Vector3)path[0].Anchore; Vector3 to; Gizmos.color = Color.white; for (int i = 1; i < path.Count; i++) { to = pivot + (Vector3)path[i].Anchore; GizmosExtensions2D.DrawBezierCurve2D(from, from + (Vector3)path[i - 1].Handle2, to + (Vector3)path[i].Handle1, to); GizmosExtensions2D.DrawBezierCurveArrow2D(from, from + (Vector3)path[i - 1].Handle2, to + (Vector3)path[i].Handle1, to); Vector3 tmpVec = GizmosExtensions2D.GetNearestPointBezierCurveArrow2D(from, from + (Vector3)path[i - 1].Handle2, to + (Vector3)path[i].Handle1, to, mousePosition); from = to; } if (openEnded) { to = pivot + (Vector3)path[0].Anchore; GizmosExtensions2D.DrawBezierCurveArrow2D(from, from + (Vector3)path[path.Count - 1].Handle2, to + (Vector3)path[0].Handle1, to); } }
private void OnDrawGizmos() { Gizmos.color = Color.red; GizmosExtensions2D.DrawWireRect2D(Vector3.zero, width, height); Gizmos.DrawWireSphere(target, 1); }