Example #1
0
    private void Setup()
    {
        normalScrollSpeed = ScrollSpeed;
        scrollOffset      = 0;
        smoothOffset      = 0;
        phase             = CreditsPhase.GameName;

        logo.Visible = true;
        revolutionaryGames.Visible = true;
        supportedBy.Visible        = ShowAssociationName;
        developersHeading.Visible  = true;

        UpdateStaticItemPositions();

        if (dynamicParts != null)
        {
            foreach (var part in dynamicParts)
            {
                part.DetachAndQueueFree();
            }
        }

        dynamicParts = new List <DynamicPart>();
    }
Example #2
0
    public override void _Process(float delta)
    {
        if (!scrolling || phase == CreditsPhase.NotRunning)
        {
            return;
        }

        scrollOffset += delta * ScrollSpeed;
        smoothOffset  = Mathf.Round(scrollOffset);

        switch (phase)
        {
        case CreditsPhase.GameName:
        {
            UpdateStaticItemPositions();

            if (scrollOffset > GameNameEndOffset)
            {
                phase = CreditsPhase.DynamicPartEarly;
                LoadCurrentDevelopers();
            }

            break;
        }

        case CreditsPhase.DynamicPartEarly:
        {
            UpdateDynamicItems();
            UpdateStaticItemPositions();

            if (scrollOffset > GameNameInvisibleOffset)
            {
                logo.Visible = false;
                revolutionaryGames.Visible = false;
                supportedBy.Visible        = false;
                developersHeading.Visible  = false;

                phase = CreditsPhase.DynamicPart;
            }

            break;
        }

        case CreditsPhase.DynamicPart:
        {
            UpdateDynamicItems();

            // End once all parts have scrolled off-screen
            if (dynamicParts.Count < 1)
            {
                EmitSignal(nameof(OnFinishedSignal));
                scrolling = false;
            }

            break;
        }

        default:
            throw new InvalidOperationException("invalid phase");
        }
    }