private void CalculateInsideOutChunks()
        {
            for (int i = 0; i < _allChunkLister.Count; i++)
            {
                for (int k = 0; k < _allChunkLister[i].ChunkCount; k++)
                {
                    ChunkLinker.Chunk chunk = _allChunkLister[i].GetChunk(k);
                    bool isInside           = chunk.IsControllerInsideChunk(_controller, _allChunkLister[i].Points);
                    bool isAlreadyInside    = IsAlreadyInsideChunk(chunk);

                    if (!isAlreadyInside && isInside)
                    {
                        chunk.ActionChunk.TriggerEnter(chunk);
                        _chunksInside.Add(chunk);
                    }
                    else if (isAlreadyInside && isInside)
                    {
                        chunk.ActionChunk.TriggerStay(chunk);
                    }
                    else if (isAlreadyInside && !isInside)
                    {
                        chunk.ActionChunk.TriggerExit(chunk);
                        _chunksInside.Remove(chunk);
                    }
                }
            }
        }
Esempio n. 2
0
        private static void DrawOneChunk(SplineBase spline, ChunkLinker.Chunk chunk, PointsOnSplineExtension points, float offset, bool isSelected)
        {
            float a     = chunk.PositionA(points);
            float b     = chunk.PositionB(points);
            Color color = chunk.Color;

            if (!isSelected)
            {
                color.a *= 0.6f;
            }

            float min    = spline.ConvertPathUnit(spline.MinPos, SplineBase.PositionUnits.PathUnits, points.PositionUnits);
            float max    = spline.ConvertPathUnit(spline.MaxPos, SplineBase.PositionUnits.PathUnits, points.PositionUnits);
            float lenght = spline.MaxUnit(points.PositionUnits);

            if (chunk.SamePosition())
            {
                b = a + lenght;
            }

            if (!spline.Looped)
            {
                if (chunk.SamePosition())
                {
                    DrawPathGizmo(spline, color, min, a, points.PositionUnits, offset);
                    DrawPathGizmo(spline, color, a, max, points.PositionUnits, offset);
                }
                else if (b < a)
                {
                    DrawPathGizmo(spline, color, a, max, points.PositionUnits, offset);
                    DrawPathGizmo(spline, color, min, b, points.PositionUnits, offset);
                }
                else
                {
                    DrawPathGizmo(spline, color, a, b, points.PositionUnits, offset);
                }
            }
            else
            {
                if (b < a)
                {
                    DrawPathGizmo(spline, color, min, b, points.PositionUnits, offset, false, true);
                    DrawPathGizmo(spline, color, a, lenght, points.PositionUnits, offset, true, false);
                }
                else
                {
                    DrawPathGizmo(spline, color, a, b, points.PositionUnits, offset);
                }
            }
        }
 public bool IsAlreadyInsideChunk(ChunkLinker.Chunk chunk)
 {
     return(_chunksInside.Contains(chunk));
 }