示例#1
0
    void DrawMovePath()
    {
        if (movePathLines != null)
        {
            for (int i = 0; i < movePathLines.Count; i++)
            {
                VectorLine vl = movePathLines[i];
                VectorLine.Destroy(ref vl);
            }
        }

        movePathLines = new List <VectorLine>();

        for (int i = 0; i < movePath.Count; i++)
        {
            VectorLine vlo = new VectorLine("path", new List <Vector3>(5), null, 2.0f, LineType.Continuous);
            vlo.SetColor(tank.debugLineColor);
            vlo.MakeRect(Map.Instance.mapData[movePath[i].Key, movePath[i].Value].Pos + new Vector3(Map.Instance.cellSize / -2.0f, 0.11f, Map.Instance.cellSize / -2.0f),
                         Map.Instance.mapData[movePath[i].Key, movePath[i].Value].Pos + new Vector3(Map.Instance.cellSize / 2.0f, 0.11f, Map.Instance.cellSize / 2.0f));

            movePathLines.Add(vlo);
        }

        for (int i = 0; i < movePathLines.Count; i++)
        {
            movePathLines[i].Draw3D();
        }
    }
示例#2
0
    //Line methods
    public void InitLine()
    {
        if (myLine != null)
        {
            VectorLine.Destroy(ref myLine);
        }

        myLine = new VectorLine("Line", followPoints, lineWidth, LineType.Continuous, Joins.Weld);       // C#

        if (_Data.userType == UserController.UserType.Azul)
        {
            myLine.SetColor(Color.blue);
        }
        if (_Data.userType == UserController.UserType.Amarillo)
        {
            myLine.SetColor(Color.yellow);
        }
        if (_Data.userType == UserController.UserType.Green)
        {
            myLine.SetColor(Color.green);
        }
        if (_Data.userType == UserController.UserType.Rojo)
        {
            myLine.SetColor(Color.red);
        }
    }
示例#3
0
文件: Map.cs 项目: ewingzhou/tanks
    void DrawGridObstacles()
    {
        if (gridObstaclesLines != null)
        {
            for (int i = 0; i < gridObstaclesLines.Count; i++)
            {
                VectorLine vl = gridObstaclesLines[i];
                VectorLine.Destroy(ref vl);
            }
        }

        gridObstaclesLines = new List <VectorLine>();

        for (int row = 0; row < rows; row++)
        {
            for (int col = 0; col < cols; col++)
            {
                if (mapData[row, col].Obstacle != null)
                {
                    VectorLine vlo = new VectorLine("obs", new List <Vector3>(5), null, 2.0f, LineType.Continuous);
                    vlo.SetColor(mapData[row, col].Obstacle.isBreakable ? Color.blue : Color.cyan);
                    vlo.MakeRect(mapData[row, col].Pos + new Vector3(cellSize / -2.0f, 1.0f, cellSize / -2.0f),
                                 mapData[row, col].Pos + new Vector3(cellSize / 2.0f, 1.0f, cellSize / 2.0f));

                    gridObstaclesLines.Add(vlo);
                }
            }
        }

        for (int i = 0; i < gridObstaclesLines.Count; i++)
        {
            gridObstaclesLines[i].Draw3D();
        }
    }
示例#4
0
    private void CheckAndRemovePathPoints()
    {
        int totalPathPoints = 0;

        foreach (VectorLine line in _pathLines)
        {
            totalPathPoints += line.points3.Count;
        }

        while (totalPathPoints > _maxPathPoints)
        {
            if (_pathLines[0].points3.Count > 0)
            {
                _pathLines[0].points3.RemoveAt(0);
                totalPathPoints--;
            }
            else if (_pathLines[0].points3.Count == 0)
            {
                //Debug.Log("Deleted line");
                _pathLines[0].Draw();
                VectorLine line = _pathLines[0];
                VectorLine.Destroy(ref line);
                _pathLines.RemoveAt(0);
            }
        }
    }
 // Update is called once per frame
 void Update()
 {
     if (point1active && !point2active)
     {
         RaycastHit hit;
         Ray        ray = GameObject.Find("Flycam").GetComponent <Camera>().ScreenPointToRay(Input.mousePosition);
         if (GetComponent <Collider>().Raycast(ray, out hit, Mathf.Infinity))
         {
             VectorLine.Destroy(ref myLine_tmp);
             VectorLine.SetCamera(GameObject.Find("Flycam").GetComponent <Camera>());
             myLine_tmp           = VectorLine.SetLine3D(Color.red, new Vector3[] { point1, hit.point });
             myLine_tmp.lineWidth = 3.0f;
         }
     }
     else
     {
         VectorLine.Destroy(ref myLine_tmp);
         if (point1active && point2active)
         {
             PlaybackControl pc = GameObject.Find("PlaybackControl").GetComponent <PlaybackControl>();
             for (int i = 0; i < crossings.Count; i++)
             {
                 if (crossings[i] < pc.current_time - 1)
                 {
                     crossings.RemoveAt(i);
                 }
             }
         }
     }
 }
示例#6
0
 void OnDestroy()
 {
     if (Line != null)
     {
         VectorLine.Destroy(ref line);
     }
 }
示例#7
0
        private void EnsureAxesCount()
        {
            var desiredCount = radar.Dimensions;

            if (axes.Count > desiredCount)
            {
                var delta = axes.Count - desiredCount;
                for (int i = axes.Count - 1; i >= desiredCount; i--)
                {
                    var line = axes[i];
                    VectorLine.Destroy(ref line);
                }

                axes.RemoveRange(desiredCount, delta);
            }
            else if (axes.Count < desiredCount)
            {
                var delta = desiredCount - axes.Count;

                for (int i = 0; i < delta; i++)
                {
                    var line = new VectorLine(name, new List <Vector3>(2), 1.0f);
                    axes.Add(line);
                }
            }
        }
示例#8
0
        private void EnsureGridCount()
        {
            var desiredCount = options.gridPointsNormalized.Count;

            if (grid.Count > desiredCount)
            {
                var delta = grid.Count - desiredCount;

                for (int i = grid.Count - 1; i >= desiredCount; i--)
                {
                    var line = grid[i];
                    VectorLine.Destroy(ref line);
                }

                grid.RemoveRange(desiredCount, delta);
            }
            else if (grid.Count < desiredCount)
            {
                var delta = desiredCount - grid.Count;

                for (int i = 0; i < delta; i++)
                {
                    var line = new VectorLine(name, new List <Vector3>(radar.Dimensions + 1), 1.0f);
                    grid.Add(line);
                }
            }
        }
示例#9
0
    void SetSelectionLine()
    {
        if (currentSelectionLine != null)
        {
            VectorLine.Destroy(ref currentSelectionLine);
        }

        VectorLine.SetCamera3D(Camera.main);
        currentCapName = "cap" + solved;
        VectorLine.SetEndCap(currentCapName, EndCap.Mirror, lineTex, capTex);
        endCaps.Add(currentCapName);

        LineType lineType  = LineType.Discrete;
        Joins    joins     = Joins.None;
        float    lineWidth = Screen.width * 0.07f;

        if (currentSelectionLine == null)
        {
            lineColors = new List <Color32>();
//			currentSelectionLine = new VectorLine("Line", new List<Vector3>(), lineMaterial, lineWidth, lineType, joins);
            currentSelectionLine          = new VectorLine("Line", new List <Vector3>(), lineWidth, lineType, joins);
            currentSelectionLine.material = lineMaterial;
            if (currentSelectionLine.endCap == null)
            {
                currentSelectionLine.endCap = currentCapName;
            }
        }
    }
示例#10
0
    void RemoveWrongSelection()
    {
//		Debug.Log("Cap destroy = " + currentCapName);
        VectorLine.RemoveEndCap(currentCapName);
        endCaps.Remove(currentCapName);
        VectorLine.Destroy(ref currentSelectionLine);
    }
示例#11
0
    public void SetupTable(int n)
    {
        if (TableUI == TableObjects[n])
        {
            return;
        }

        for (int i = 0; i < TableObjects.Length; i++)
        {
            if (i != n)
            {
                TableObjects[i].SetActive(false);
            }
        }
        TableUI = TableObjects[n];

        TableObj = TableUI.Child[0].transform.gameObject;
        //TableObj.transform.SetParent(GameManager.Module.transform);
        Seat = new _Seat[TableUI.Child.Length - 1];
        List <Vector2> splinepoints = new List <Vector2>();

        for (int i = 0; i < Seat.Length; i++)
        {
            Seat[i]        = new _Seat();
            Seat[i].Index  = i;
            Seat[i].Object = TableUI.Child[i + 1].transform.gameObject;
            Vector3 p = TableUI.Child[i + 1].transform.position + TableUI.Child[i + 1].transform.forward * 1.7F;
            splinepoints.Add(new Vector2(p.x, p.y));
        }
        VectorLine.Destroy(ref Movement);

        Movement = new VectorLine("Movement Path", new List <Vector2>(mvmt_segments + 1), 4.0F, LineType.Continuous);
        Movement.MakeSpline(splinepoints.ToArray(), mvmt_segments, 0, true);
        //Movement.Draw();
    }
示例#12
0
        /// <summary>
        /// DisplayContour - Display the contour points, adjust camera position, invert points for correct display.
        /// </summary>
        /// <param name="contour"></param>
        /// <param name="blobNumber"></param>
        public void DisplayContour(PXCMPointI32[] contour, int blobNumber, int blobCount)
        {
            /* Funky Vectrosity camera flip issue*/
            VectorPoints.SetCamera();
            Camera cam = VectorLine.GetCamera();

            cam.transform.position = new Vector3(cam.transform.position.x * -1, cam.transform.position.y * -1, cam.transform.position.z);

            // remove the unsed blob
            if (blobCount < blobLine.Length)
            {
                VectorLine.Destroy(ref blobLine[1]);
            }

            //refresh the current blob
            VectorLine.Destroy(ref blobLine[blobNumber]);

            /* can't be cache since the contour length changes based on what is tracked*/
            Vector2[] splinePoints = new Vector2[contour.Length];
            for (int i = 0; i < contour.Length; i++)
            {
                splinePoints[i] = new Vector2(contour[i].x * -1, contour[i].y * -1);
            }

            blobLine[blobNumber]      = new VectorLine("BlobContourPoints", new Vector2[splinePoints.Length], null, 2.0f, LineType.Continuous);
            blobLine[blobNumber].name = "blobLine_" + blobNumber.ToString();
            blobLine[blobNumber].MakeSpline(splinePoints);
            blobLine[blobNumber].Draw();
        }
示例#13
0
    void Update()
    {
        // Change startIndex and endIndex over time, wrapping around as necessary
        startIndex += Time.deltaTime * speed;
        endIndex   += Time.deltaTime * speed;

        if (startIndex >= segments + 1)
        {
            //do not wrap on lead in particle, destroy particle after one cycle
            //startIndex = -visibleLineSegments;
            //endIndex = 0;
            VectorLine.Destroy(ref line);
            Destroy(gameObject);
            return;
        }
        else if (startIndex < -visibleLineSegments)
        {
            startIndex = segments;
            endIndex   = segments + visibleLineSegments;
        }

        line.drawStart = (int)startIndex;
        line.drawEnd   = (int)endIndex;
        line.Draw3D();
    }
示例#14
0
 public void Stop()
 {
     if ((object)m_vector != null)
     {
         m_vector.StopDrawing3DAuto();
         VectorLine.Destroy(ref m_vector);
     }
 }
示例#15
0
 public void DeleteLine()
 {
     if (this._line == null)
     {
         return;
     }
     VectorLine.Destroy(ref this._line);
 }
示例#16
0
    public static void doInit(pipeBehavior ps, string home)
    {
        //pipe1 = pipe1In;
        currentFunction = null;
        lineVector      = new Vector3[10000];
        zeroLine();
        GameObject memoryObject = GameObject.Find("Memory1");

        memoryScript  = (memory)memoryObject.GetComponent(typeof(memory));
        memoryRegions = new List <memory> ();
        memoryRegions.Add(memoryScript);
        //camera = GameObject.Find ("Main Camera");
        if (controlLine != null)
        {
            VectorLine.Destroy(ref controlLine);
        }
        controlLine = new VectorLine("myLines", lineVector, flowColor, null, 0.5f, LineType.Continuous);
        controlLine.maxDrawIndex = 0;
        lineElement = 0;
        pipeScript  = ps;
        if (pipeScript == null)
        {
            Debug.Log("pipeScript is null");
        }
        pipe1       = pipeScript.getPipe("pipe");
        breakpoints = new List <long> ();
        StreamReader reader = null;

        if (System.IO.File.Exists(home + "/breakpoints.txt"))
        {
            reader = new StreamReader(home + "/breakpoints.txt");
            Debug.Log("Found breakpoints");
        }
        else
        {
            Debug.Log("No breakpoint file in " + home);
        }
        if (reader != null)
        {
            string line;
            using (reader)
            {
                while ((line = reader.ReadLine()) != null)
                {
                    long value = long.Parse(line, System.Globalization.NumberStyles.HexNumber);
                    Debug.Log("add breakpoint at " + value.ToString("x"));
                    breakpoints.Add(value);
                }
            }
        }
        clockLabelString   = "0";
        currentCycleString = "0";
        numInstructions    = 0;
        currentClock       = 0;
        startClock         = 0;
        updateClock(0);
    }
示例#17
0
    public void removeFreedomLineAndPlane()
    {
        VectorLine.Destroy(ref freedomLineVector);
        GameObject.Destroy(plane);

        freedomLineVector    = null;
        freedomLineVectorObj = null;
        plane = null;
    }
示例#18
0
 protected override void destroy_line()
 {
     if (line != null)
     {
         line.active = false;
         VectorLine.Destroy(ref line);
         line = null;
     }
 }
示例#19
0
    void SetLine()
    {
        //Make sure line is Destroyed
        VectorLine.Destroy(ref line);

        line = new VectorLine("Line", new List <Vector2>(), 2, LineType.Continuous, Joins.Fill);
        line.drawTransform = transform;
        line.collider      = true;
    }
示例#20
0
 public void DrawEnd()
 {
     foreach (var item in this.lines.Where(l => !this.visited.Contains(l.Key)).ToArray())
     {
         var line = item.Value;
         VectorLine.Destroy(ref line);
         this.lines.Remove(item.Key);
     }
 }
示例#21
0
 private void reinit()
 {
     Destroy(point1);
     Destroy(point2);
     Destroy(point3);
     Destroy(point4);
     VectorLine.Destroy(ref _fakeVectorline);
     VectorLine.Destroy(ref _vectorline);
 }
示例#22
0
 void OnDestroy()
 {
     if (m_destroyed)
     {
         return;                             // Paranoia check
     }
     m_destroyed = true;
     VectorManager.VisibilityRemove(m_objectNumber.i);
     VectorLine.Destroy(ref m_vectorLine);
 }
    //todo
    public void Destroy()
    {
        VectorLine.Destroy(_vectorLineList_types.ToArray());
        VectorLine.Destroy(_vectorLineList_topLayer.ToArray());
        _vectorLineList_types.Clear();
        _vectorsList_layer.Clear();

        //_gcodeRenderPointList.Clear () will invoke out of range exception
        //_gcodeRenderPointList.Clear ();
    }
示例#24
0
 public void Destroy()
 {
     VectorLine.Destroy(ref this.leftGravity);
     VectorLine.Destroy(ref this.leftForce);
     VectorLine.Destroy(ref this.leftBoth);
     VectorLine.Destroy(ref this.leftCircle);
     VectorLine.Destroy(ref this.rightGravity);
     VectorLine.Destroy(ref this.rightForce);
     VectorLine.Destroy(ref this.rightBoth);
     VectorLine.Destroy(ref this.rightCircle);
 }
示例#25
0
 public void clear()
 {
     if (this.light != null)
     {
         Destroy(this.light);
     }
     if (this.spring != null)
     {
         VectorLine.Destroy(ref this.spring);
     }
 }
示例#26
0
 public void RemoveLine(VectorLine vectorLine)
 {
     for (int i = 0; i < lineCount; i++)
     {
         if (vectorLine == lines[i])
         {
             RemoveLine(i);
             VectorLine.Destroy(ref vectorLine);
             break;
         }
     }
 }
示例#27
0
    public void ClearAttackLines()
    {
        int numberAttackLines = _attackLines.Count;

        for (int i = 0; i < numberAttackLines; i++)
        {
            VectorLine line = _attackLines[0];
            VectorLine.Destroy(ref line);
            _attackLines.RemoveAt(0);
            _currentAttackPathLine = null;
        }
    }
 public void goToNextLevel()
 {
     VectorLine.Destroy(ref JennyShoot.jennyShoot.gunLineVec);
     if (transitionSceneName == null)
     {
         Application.LoadLevel(Application.loadedLevel + 1);
     }
     else
     {
         SceneFadeInOut.sceneFadeInOut.nextSceneName = transitionSceneName;
         SceneFadeInOut.sceneFadeInOut.sceneEnding   = true;
     }
 }
示例#29
0
    private void switchToRegularUpdateMode(GameObject plane)
    {
        LeftRadialMenu.SetActive(true);
        lightObj.SetActive(true);
        plane.SetActive(false);
        VectorLine.Destroy(ref dottedLine);
        VectorLine.Destroy(ref failLine);
        freedomLineObj = null;
        failLineObj    = null;
        dottedLine     = null;

        constraintMode = false;
    }
示例#30
0
 void OnDestroy()
 {
     if (m_destroyed)
     {
         return;                             // Paranoia check
     }
     m_destroyed = true;
     VectorManager.DistanceRemove(m_objectNumber.i);
     if (m_useLine)
     {
         VectorLine.Destroy(ref m_vectorLine);
     }
 }