makeLine.addPoint C# (CSharp) Method

addPoint() public method

public addPoint ( GameObject b, float t ) : void
b GameObject
t float
return void
    public void addPoint(GameObject b, float t)
    {
        Point p = new Point ();
        p.pos = b.transform.position;
        p.parent = lines[lines.Count - 1];
        p.color = color;
        p.width = Mathf.RoundToInt(100 * t);
        lines[lines.Count-1].points.Add (p);

        if(getPointCount ()>maxPoints){
            lines[0].points.RemoveAt(0);
            if (lines[0].points.Count == 0) {
                lines.RemoveAt(0);
            }
        }

        makeTexture();
        rebuildLine ();

        lineRen.SetPosition (getPointCount()-1, b.transform.position);
        rend.material.SetTextureScale ("_MainTex", new Vector2 ((getPointCount())*.1f , 1));

        /*
        if(getPointCount ()>=maxPoints){
            texOffset+=.1f;
            rend.material.SetTextureOffset("_MainTex", new Vector2(texOffset, 0));
        }
        */

        int cell = getHashedCell (b.transform.position);
        if (hashGrid.ContainsKey (cell)) {
            hashGrid [cell].Add (p);
        } else {
            hashGrid [cell] = new List<Point> ();
            hashGrid [cell].Add (p);
        }
    }