public static bool Trigger(GameObject go, AboutToQuitDelegate cb)
    {
        if (go == null)
        {
            return(false);
        }
        CreditsFadeOutAndEnd creditsFadeOutAndEnd = go.GetComponent <CreditsFadeOutAndEnd>();

        if (creditsFadeOutAndEnd == null)
        {
            creditsFadeOutAndEnd = go.AddComponent <CreditsFadeOutAndEnd>();
        }
        return(creditsFadeOutAndEnd.Trigger(cb));
    }
Пример #2
0
    private void UpdateFromState()
    {
        if (state < State.Ground)
        {
            if (MenuCameraEffects.instance.creditsAdjust == 0f && MenuSystem.instance.state == MenuSystemState.Inactive)
            {
                MenuCameraEffects.FadeInCredits();
            }
        }
        else if (MenuCameraEffects.instance.creditsAdjust != 0f && !MenuCameraEffects.instance.CreditsAdjustInTransition && MenuSystem.instance.state == MenuSystemState.Inactive)
        {
            MenuCameraEffects.FadeOut(1.5f);
        }
        SetCloudState(state < State.Ground);
        if (!skipDrag)
        {
            bool flag = state < State.NearGround;
            if (flag != lastDrag)
            {
                lastDrag    = flag;
                currentDrag = ((!flag) ? 0.05f : 0.4f);
                for (int i = 0; i < Human.all.Count; i++)
                {
                    Human human = Human.all[i];
                    if (humansInLevel.Contains(human) && !skipDrag)
                    {
                        human.SetDrag(currentDrag);
                    }
                    human.state = HumanState.Spawning;
                }
            }
        }
        bool flag2 = state >= State.FadeOut;

        if (fadeRunning == flag2)
        {
            return;
        }
        fadeRunning = flag2;
        if (flag2)
        {
            CreditsFadeOutAndEnd.Trigger(base.gameObject, delegate
            {
                GetComponentInParent <Level>().respawnLocked = true;
                ClearDrag();
                hasFinishedCredits = true;
                startupDoor.SetActive(value: false);
                for (int j = 0; j < blocks.Count; j++)
                {
                    blocks[j].gameObject.SetActive(value: false);
                }
            });
            return;
        }
        CreditsFadeOutAndEnd component = base.gameObject.GetComponent <CreditsFadeOutAndEnd>();

        if (component != null)
        {
            component.Cancel();
        }
    }