Beispiel #1
0
    private void UpdateComplexTrail()
    {
        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 = complexTrail.Update(pos, trailRenderer.time);

        if (addForce)
        {
            foreach (Slice2D id in results)
            {
                AddForce.ComplexTrail(id, addForceAmount);
            }
        }
    }
        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 = complexTrail[id].Update(pos, trailRenderer[id].time, sliceLayer);

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