示例#1
0
    public void C3FixedUpdate()
    {
        float fscale = 0;

        transform.position = CVector3.toV3(position, scale, TrailPool.cameraScale, TrailPool.cameraX, TrailPool.cameraY, radius, out fscale);
        Vector3 oScale = new Vector3(fscale, 0, fscale);

        transform.localScale = oScale;

        if (CVector3.distance(lastPos, position) * scale * TrailPool.cameraScale > .3)
        {
            lastPos = position;
            //Debug.Log(CVector3.mag(velocity));
            //Debug.Log(Time.timeScale);
        }
        else
        {
            return;
        }
        if (trailObjs.Count < trail)
        {
            Trail temp = TrailPool.Get();
            temp.enabled  = true;
            temp.position = position;
            temp.CFixedUpdate();
            trailObjs.Enqueue(temp);
        }
        else if (trailObjs.Count > trail)
        {
            Trail temp = trailObjs.Dequeue();
            temp.Disable();
            TrailPool.AddToStack(temp);
        }
        else
        {
            Trail temp = trailObjs.Dequeue();
            temp.enabled  = true;
            temp.position = position;
            temp.CFixedUpdate();
            trailObjs.Enqueue(temp);
        }
    }