Exemple #1
0
    // Normalize predicted future locations by parent position
    override public void HandlePostMoveDraws()
    {
        // Clear old draws.
        foreach (LineRenderer line in lookAheadLines)
        {
            Destroy(line.gameObject);
        }
        lookAheadLines.Clear();

        // Get flyBys *BEFORE* position normalization.
        List <bool> flyBys = FindAllPredictedFlybys();

        // Normalize drawn display positions to primary parent's position
        SystemObject parent = PrimaryGravityParent(0).GetComponent <SystemObject>();

        for (int i = 0; i < frames_lookahead; i++)
        {
            projectedLocations[i] -= parent.NetDelta(i);
        }

        // Find all flyBys and draw them in a different color than non-flyBys.
        bool           flyByInProgress = flyBys[0];
        List <Vector2> flyBy           = new List <Vector2> {
        };

        for (int i = 0; i < frames_lookahead; i++)
        {
            flyBy.Add(projectedLocations[i]);
            // Flyby status changed, time to start a new line.
            if (flyByInProgress != flyBys[i])
            {
                LineBetweenPositions(flyBy, flyByInProgress);
                flyBy           = new List <Vector2> {
                };
                flyByInProgress = !flyByInProgress;
            }
        }
        LineBetweenPositions(flyBy, flyByInProgress);
    }