本文整理汇总了C#中VectorLine.Draw方法的典型用法代码示例。如果您正苦于以下问题:C# VectorLine.Draw方法的具体用法?C# VectorLine.Draw怎么用?C# VectorLine.Draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VectorLine
的用法示例。
在下文中一共展示了VectorLine.Draw方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: tutorialLine
void tutorialLine (){
helperLine = new VectorLine("tutorial_line", new List<Vector3>(), lineMaterial, 12.0f,LineType.Continuous);
helperLine.points3.Add(Camera.main.ScreenToWorldPoint(rightHelper.transform.position));
helperLine.points3.Add(Camera.main.ScreenToWorldPoint(rightMenu.transform.position));
helperLine.textureScale = 1.0f;
helperLine.Draw();
}
示例2: drawOrange
void drawOrange(){
uiPath_1 = new VectorLine("dragLine_0", new List<Vector3>(), lineMaterial, 22.0f,LineType.Continuous);
uiPath_1.textureScale = 1.0f;
uiPath_1.points3.Add(Camera.main.ScreenToWorldPoint(orangeBox.transform.position));
uiPath_1.points3.Add(Camera.main.ScreenToWorldPoint(edge_1.transform.position));
uiPath_1.color = Color.black;
uiPath_1.Draw();
}
示例3: AddGrid
void AddGrid()
{
float rowCount = 12.0f;
float colCount = 16.0f;
float colStep = Screen.width / colCount;
float rowStep = Screen.height / rowCount;
// Debug.Log (colStep + " " + rowStep);
// Debug.Log (Screen.width + " " + Screen.height);
//
// for (int i = 0; i < rowCount; i++) {
//
//
// Vector2 a = new Vector2 (0, i * rowStep);
//
// Vector2 b = new Vector2 (Screen.width, i * rowStep);
//
//
// Debug.DrawLine (a, b, Color.red);
//
// }
//
//
// for (int j = 0; j < 16; j++) {
//
// Vector2 a = new Vector2 (j * colStep, 0);
// Vector2 b = new Vector2 (j * colStep, Screen.height);
//
// Debug.DrawLine (a, b, Color.red);
// }
for (int i = 0; i < rowCount; i++) {
Vector2 a = new Vector2 (0, i * rowStep);
Vector2 b = new Vector2 (Screen.width, i * rowStep);
VectorLine line = new VectorLine ("row" + i, new Vector2[]{a,b}, null, 1.0f);
line.SetColor (Color.green);
line.Draw ();
}
for (int j = 0; j < 16; j++) {
Vector2 a = new Vector2 (j * colStep, 0);
Vector2 b = new Vector2 (j * colStep, Screen.height);
VectorLine line = new VectorLine ("col" + j, new Vector2[]{a,b}, null, 1.0f);
line.SetColor (Color.green);
line.Draw ();
}
}
示例4: CreateRect
/// <summary>
/// 绘制矩形
/// </summary>
private void CreateRect(float posX, float posY, float width, float height, Color color)
{
VectorLine squareLine = new VectorLine ("Square", new Vector2[8], null, 1.0f, LineType.Discrete, Joins.Weld);
squareLine.MakeRect (new Rect (posX, posY, width, height));
squareLine.SetColor (color);
squareLine.Draw ();
}
示例5: DrawBackground
void DrawBackground () {
float y = Screen.height - yOffset;
Vector2 start = new Vector2(xOffset, y);
float x = (xOffset + BackgroundValue)*multiplier + 2 * margin;
Vector2 end = new Vector2(x, y);
bgLine = VectorLine.SetLine(bgColor, new Vector2[] { start, end });
bgLine.lineWidth = bgThickness;
bgLine.sortingOrder = 1;
bgLine.Draw();
}
示例6: InitializeHPBar
void InitializeHPBar () {
float y = Screen.height - yOffset;
Vector2 start = new Vector2(xOffset + margin, y);
float x = (xOffset + Value)*multiplier + margin;
Vector2 end = new Vector2(x, y);
hpLine = VectorLine.SetLine(hpColor, new Vector2[] { start, end });
hpLine.lineWidth = bgThickness - (2 * margin);
hpLine.sortingOrder = 2;
hpLine.Draw();
}
示例7: drawOrangePath
void drawOrangePath(){
if(dragThrow.canRight){
answerPath_orange = new VectorLine("dragLine_orange", new List<Vector3>(), lineMaterial, lineWidth,LineType.Continuous);
answerPath_orange.textureScale = 1.0f;
answerPath_orange.color = dragThrow.orangeBox.GetComponent<SpriteRenderer>().color;
for (int i = 0; i < dragThrow.orange_ans.Length; i++) {
answerPath_orange.points3.Add(dragThrow.orange_ans[i]);
}
answerPath_orange.Draw();
}
}
示例8: drawRedPath
void drawRedPath(){
if(dragThrow.canLeft){
answerPath_red = new VectorLine("dragLine_red", new List<Vector3>(), lineMaterial, lineWidth,LineType.Continuous);
answerPath_red.textureScale = 1.0f;
answerPath_red.color = dragThrow.redBox.GetComponent<SpriteRenderer>().color;
for (int i = 0; i < dragThrow.red_ans.Length; i++) {
answerPath_red.points3.Add(dragThrow.red_ans[i]);
}
answerPath_red.Draw();
}
}
示例9: Update
// Update is called once per frame
void Update()
{
if( ctrl==true && mkLine.finish==true){
Camera cam = VectorLine.SetCameraRenderTexture (renderTexture, Color.white, true);
line = new VectorLine("Line",mkLine.linePoints,Color.black, null, 10.0f,LineType.Continuous);
line.maxDrawIndex=2*mkLine.canerinIndex+1;
line.Draw();
cam.Render();
VectorLine.SetCameraRenderTexture (null);
//line.Draw();
ctrl=false;
}
}
示例10: drawLines
public void drawLines()
{
VectorLine myLine;
List<Vector3> linePoints = new List<Vector3>(); // C#
Vector3 tmp = new Vector3(0f,0f,0f);
Vector3 last = new Vector3(0f,0f,0f);
myLine = new VectorLine("MyLine", linePoints, null, 2.0f, LineType.Continuous);
for (int i=0; i< gcodes.Count; i++) {
GCode g = gcodes[i];
float _pos;
if (g.containsKey("X") && g.getf ("X", out _pos)){
tmp.x = _pos;
} else {
tmp.x = last.x;
}
if (g.containsKey("Y") && g.getf ("Y", out _pos)){
tmp.z = _pos;
} else {
tmp.z = last.z;
}
if (g.containsKey("Z") && g.getf ("Z", out _pos)){
tmp.y = _pos;
} else {
tmp.y = last.y;
}
if (g.isMove ()){
if (g.extrudes()){
// draw line from last to tmp
print ("LINE "+last +" - " + tmp +" : "+g);
} else {
print ("move "+last +" - " + tmp+" : "+g);
}
last = tmp;
linePoints.Add (tmp);
}
}
myLine.Draw();
}
示例11: Start
void Start () {
//VectorLine.SetCamera3D();
//Vector2[] linePoints = {new Vector2(0,0),new Vector2(1,1)};
//VectorLine myline = new VectorLine.SetLine(Color.green, new Vector2(0, 0), new Vector2(1, 1));
Vector2[] linePoints = { new Vector2(0, 0),new Vector2(1, 1)};
Material line = (Material)Resources.Load("Line");
VectorLine myline = new VectorLine("MyLine",linePoints,null,0.05f,LineType.Continuous);
//VectorLine.SetCanvasCamera (Camera.main);
//c.re
Rect r = new Rect(0,0,2,1);
//myline.make
myline.MakeRoundedRect(r, 0.2f,10);
myline.SetColor(Color.black);
myline.Draw();
}
示例12: PlotTrajectory
List<GameObject> planets; //destination objects, the earth and moon
#endregion Fields
#region Methods
public void PlotTrajectory(Vector3 start, Vector3 startVelocity, float timestep, float maxTime)
{
//Vector2[] curvePoints = new Vector2[(int)Mathf.Ceil(maxTime/timestep+1)];
List<Vector2> curvePoints = new List<Vector2> ();
Vector3 prev = start;
for (int i = 1; ; i++)
{
float t = timestep * i;
if (t > maxTime) break;
Vector2 pos = PlotTrajectoryAtTime(start, startVelocity, t);
if (Physics.Linecast(prev, pos)) break;
Debug.DrawLine(prev, pos, Color.red);
Debug.Log(pos);
curvePoints.Add(Camera.main.WorldToViewportPoint(pos));
//curvePoints.Add(pos);
prev = pos;
}
line = new VectorLine("Spline", new List<Vector2>(curvePoints.Count+1), 2.0f, LineType.Continuous, Joins.Weld);
//line.useViewportCoords = true;
//Vector2[] curvePoints = new Vector2[(int)Mathf.Ceil(maxTime / timestep + 1)]
if (curvePoints.Count > 0) {
Debug.Log(curvePoints.Count);
line.MakeSpline(curvePoints.ToArray());
line.continuousTexture = true;
line.Draw();
}
/*
VectorLine line2 = new VectorLine("Arrow2", new List<Vector2>(50), 40.0f, LineType.Continuous, Joins.Weld);
line2.useViewportCoords = true;
Vector2[] splinePoints = new Vector2[] { new Vector2(0.1f, 0.85f), new Vector2(0.3f, 0.5f), new Vector2(0.5f, 0.4f), new Vector2(0.7f, 0.5f), new Vector2(0.9f, 0.85f) };
line2.MakeSpline(curvePoints.ToArray());
//line2.endCap = "arrow2";
line2.continuousTexture = true;
line2.Draw();
*/
}
示例13: DrawCells
/// <summary>
/// Draw cells for debugging purposes only
/// </summary>
/// <param name="cells">Cells.</param>
private void DrawCells(List<Cell> cells)
{
// Calculate point count for Discrete type of line that will contain Rects
int pointCount = cells.Count * 8;
// Clear all debug lines each time (no exception if null)
VectorLine.Destroy(ref debugCellLine);
VectorLine.Destroy(ref debugPaddingLine);
// Build line with proper parameters
debugCellLine = new VectorLine("DebugCellLine", new Vector2[pointCount], null, 2, LineType.Discrete, Joins.Weld);
debugCellLine.color = gridviewParameters.gridColor;
debugPaddingLine = new VectorLine("DebugPaddingCellLine", new Vector2[pointCount], null, 2, LineType.Discrete, Joins.Weld);
debugPaddingLine.color = gridviewParameters.paddingCellColor;
// Build each Cell
for(int i = 0; i < cells.Count; i++)
{
Cell cell = cells[i];
debugCellLine.MakeRect(cell.GetRectPoints(), i*8);
debugPaddingLine.MakeRect(cell.GetPaddinRectPosition(), i*8);
}
// Show results
debugCellLine.Draw();
debugPaddingLine.Draw();
}
示例14: OnGUI
void OnGUI()
{
// Make the first button. If it is pressed, Application.Loadlevel (1) will be executed
if (!showDrawingTools) {
if (GUI.Button (new Rect (Screen.width - 150, Screen.height - 50, 150, 50), "Start Drawing")) {
showDrawingTools = true;
}
} else if (!drawingDone) {
if (GUI.Button (new Rect (Screen.width - 150, Screen.height - 50, 150, 50), "Done")) {
drawingDone = true;
}
} else if (!showVectorDrawing) {
if (GUI.Button (new Rect (Screen.width - 150, Screen.height - 100, 150, 50), "Draw V-T Graph")) {
showVectorDrawing = true;
}
if (GUI.Button (new Rect (Screen.width - 150, Screen.height - 50, 150, 50), "Back To The Schene")) {
//Buraya Kamera değiştirme scripti gelcek.
VectorLine.Destroy (ref allGuide);
VectorLine.Destroy (ref atGraphAfterVt);
VectorLine.Destroy (ref gecici);
VectorLine.Destroy (ref guideY);
VectorLine.Destroy (ref line);
VectorLine.Destroy (ref rectV);
VectorLine.Destroy (ref refPointsOnX);
VectorLine.Destroy (ref refPointsOnY);
VectorLine.Destroy (ref textVec);
VectorLine.Destroy (ref vtGraph);
VectorPoints.Destroy (ref dots);
for (int i =0; i<linePointsYNmb.Length;i++) {
VectorLine.Destroy (ref linePointsYNmb[i]);
}
for (int i =0; i<textVectors.Length;i++){
VectorLine.Destroy (ref textVectors[i]);
}
finish = true;
walkOrDraw.btnClicked=false;
}
} else {
if (GUI.Button (new Rect (Screen.width - 150, Screen.height - 100, 150, 50), "Reset")) {
showDrawingTools=false;
showVectorDrawing=false;
drawingDone=false;
VectorLine.Destroy(ref dots);
VectorLine.Destroy(ref line);
VectorLine.Destroy(ref vtGraph);
VectorLine.Destroy(ref atGraphAfterVt);
VectorLine.Destroy(ref refPointsOnX);
VectorLine.Destroy(ref refPointsOnY);
for (int i=0; i<50; i++) {
VectorLine.Destroy(ref textVectors[i]);
textVectors[i]=new VectorLine("Text"+i,new Vector2[2]{new Vector2(0,0),new Vector2(0,0)},null,2f,LineType.Discrete,Joins.Weld);
}
for (int i=0; i<100; i++) {
linePoints[i]=Vector2.zero;
}
for(int i=0;i<100;i++){
atGraphAfterVtPoints[i]=Vector2.zero;
}
for (int i=0; i<49; i++) {
canerinArray[i]=Vector2.zero;
}
for (int i=0; i<49; i++) {
VelocityArray[i]=Vector2.zero;
}
for(int i=0;i<50;i++){
dotPoints[i]=Vector2.zero;
}
numberOfDots = 0;
dots = new VectorPoints ("Dots", dotPoints, Color.red, null, 10f);
dots.maxDrawIndex = numberOfDots;
linePointsX=new Vector2[(maxW/snToPixel)*4];
for (int i =0; i<=maxW/snToPixel*2; i+=2) {
linePointsX[i].x=minW+i*snToPixel/2;
linePointsX[i].y=(Screen.height/2)-5;
linePointsX[i+1].x=minW+i*snToPixel/2;
//.........这里部分代码省略.........
示例15: SetRay
public static VectorLine SetRay(Color color, float time, Vector3 origin, Vector3 direction)
{
var line = new VectorLine("SetRay", new Vector3[] {origin, new Ray(origin, direction).GetPoint(direction.magnitude)}, color, null, 1.0f, LineType.Continuous, Joins.None);
if (time > 0.0f) {
lineManager.DisableLine(line, time);
}
line.Draw();
return line;
}