Inheritance: MonoBehaviour
Example #1
0
    void killOld()
    {
        if (lines.Count > 0)
        {
            makeLine other = (makeLine)lines [0].GetComponent(typeof(makeLine));
            vertexCount = other.getPointCount();

//			if(vertexCount>maxVertexCount){
//				other.dequeueLine(0,1);
//			}

//
//			if (lines.Count > maxLines)
//				other.isBeingDestroyed = true;
//			else
//				other.isBeingDestroyed = false;

            vertexCount = 0;

//			for(int i = 0 ; i < lines.Count ; i++){
//				other = (makeLine)lines [i].GetComponent (typeof(makeLine));
//				vertexCount += other.getPointCount();
//				if (other.isDestroyed) {
//					Destroy (lines [i].gameObject);
//					lines.Remove (lines [i]);
//				}
//			}
        }
    }
Example #2
0
 public void eraseLine(bool draw)
 {
     for (int i = 0; i < lines.Count; i++)
     {
         makeLine other = (makeLine)lines[i].GetComponent(typeof(makeLine));
         other.addPoints(brush, draw);
     }
 }
Example #3
0
        public void addLine()
        {
            if (lines.Count < 1)
            {
                lines.Add(Instantiate(line));
            }
            makeLine other = (makeLine)lines[0].GetComponent(typeof(makeLine));

            other.addNewLine(brush);
            other.maxPoints = maxVertexCount;
            //		lines.Add(Instantiate(line));
        }
Example #4
0
        public void drawLine(bool draw)
        {
            makeLine other = (makeLine)lines[lines.Count - 1].GetComponent(typeof(makeLine));

            other.addPoints(brush, draw);
        }
 // MARK: Data Marshalling
 void UpdateMakeLines(Stream s, ref makeLine[] mlines)
 {
     var frame = s.ReadLineFrame();
     for(var i = 0; i < mlines.Length; i++) {
         foreach (var l in frame[i]) {
             foreach (var p in l.points) {
                 var cell = mlines[i].getHashedCell(p.pos);
                 if (!mlines[i].hashGrid.ContainsKey(cell)) {
                     mlines[i].hashGrid[cell] = new List<makeLine.Point>();
                 }
                 mlines[i].hashGrid[cell].Add(p);
             }
         }
         mlines[i].lines = frame[i];
         lines[i].lines[0] = mlines[i].gameObject;
         mlines[i].makeTexture();
         mlines[i].rebuildLine();
     }
 }
 public static void WriteLineFrame(this Stream s, ref makeLine[] mlines)
 {
     var frame = new List<List<makeLine.Line>>();
     foreach (var ml in mlines) {
         frame.Add(ml.lines);
     }
     s.WriteLineFrame(ref frame);
 }
    public static void Write(this BinaryWriter writer, makeLine.Point p)
    {
        var pos = p.pos;

        writer.Write(pos.x);
        writer.Write(pos.y);
        writer.Write(pos.z);
    }
    public static void Write(this BinaryWriter writer, makeLine.Line l)
    {
        writer.Write(l.points.Count);

        foreach(var p in l.points) {
            writer.Write(p);
        }
    }