pointInfo CreatePointInfo(Vector3 worldPos)
    {
        // create material instance first.
        if (_chainMatInst == null)
        {
            _chainMatInst = Utils.CloneMaterial(_chainMat);
            //_chainMatInst.mainTexture = _thunderTexture.TexturePtr;
        }

        pointInfo  pi = new pointInfo();
        GameObject go = GameObject.Instantiate(_chainRes) as GameObject;

        pi.chain = go;
        pi.chain.GetComponentInChildren <Renderer>().sharedMaterial = _chainMatInst;
        pi.chainTrans        = go.transform;
        pi.chainTrans.parent = LevelManager.Singleton.BulletRoot;

        //pi.spark = GameObject.Instantiate(_spark) as GameObject;
        //pi.sparkParticle = pi.spark.GetComponent<ParticleSystem>();
        //Material newMat = new Material(_sparkMat.shader);
        //newMat.CopyPropertiesFromMaterial(_sparkMat);
        //newMat.hideFlags = HideFlags.DontSave;
        //pi.spark.gameObject.GetComponentInChildren<Renderer>().sharedMaterial = newMat;
        //pi.sparkMat = newMat;
        //pi.sparkTrans = pi.spark.transform;
        //pi.sparkTrans.parent = LevelManager.Singleton.BulletRoot;

        pi.worldPos = worldPos;
        pi.Deactive();
        return(pi);
    }
    public void Clear()
    {
        while (_activeCnt > 1)
        {
            RemoveFirst();
        }
        pointInfo pi = _pointList[_head];

        pi.Deactive();
        pi.previous = null;
        pi.next     = null;
        _activeCnt  = 0;
        _endPoint   = null;
    }
 public void RemoveFirst()
 {
     if (_activeCnt > 0)
     {
         pointInfo pi = _pointList[_head];
         pi.Deactive();
         if (pi.previous != null)
         {
             pi.previous.next = null;
             pi.previous      = null;
         }
         if (pi.next != null)
         {
             pi.next.previous = null;
             pi.next          = null;
         }
         _head = ((_head + 1) % _pointList.Count);
         --_activeCnt;
     }
 }