Пример #1
0
    private void UpdateLinearTrail()
    {
        if (trailRenderer == null)
        {
            if (Slicer2D.Debug.enabled)
            {
                Debug.LogWarning("Slicer2D: Trail Renderer is not attached to the controller");
            }
            return;
        }

        int pointsCount = trailRenderer.GetPositions(trailPositions);

        if (pointsCount < 1)
        {
            return;
        }

        Vector2D pos = new Vector2D(trailPositions[pointsCount - 1]);

        List <Slice2D> results = linearTrail.Update(pos, trailRenderer.time);

        if (addForce)
        {
            foreach (Slice2D id in results)
            {
                AddForce.LinearTrail(id, addForceAmount);
            }
        }
    }
Пример #2
0
        public void Update()
        {
            for (int id = 0; id < trailRenderer.Length; id++)
            {
                if (trailRenderer[id] == null)
                {
                    if (id == 0)
                    {
                        Debug.LogWarning("Slicer2D: Trail Renderer is not attached to the controller");
                    }
                    return;
                }

                SetTrailPosition(trailRenderer[id], id);

                int pointsCount = trailRenderer[id].GetPositions(trailPositions[id]);
                if (pointsCount < 1)
                {
                    return;
                }

                Vector2D pos = new Vector2D(trailPositions[id][pointsCount - 1]);

                List <Slice2D> results = linearTrail[id].Update(pos, trailRenderer[id].time, sliceLayer);

                if (addForce)
                {
                    foreach (Slice2D p in results)
                    {
                        AddForce.LinearTrail(p, addForceAmount);
                    }
                }
            }
        }