コード例 #1
0
    IEnumerator FadeOut(float time, bool transition, DoorBehaviour door)
    {
        Color c            = blackScreen.GetComponent <Image>().color;
        Color initialColor = c;
        Color finalColor   = new Color(0, 0, 0, 0);
        float elapsedTime  = 0.0f;

        while (elapsedTime < time)
        {
            elapsedTime += Time.deltaTime;
            c            = Color.Lerp(initialColor, finalColor, elapsedTime / time);
            blackScreen.GetComponent <Image>().color = c;
            yield return(null);
        }
        blackScreen.GetComponent <Image>().color = finalColor;
        if (transition)
        {
            player.GetComponent <PlayerPlatformController>().SetInputActivated(true);
            mainCamera.GetComponent <CameraBehaviour>().SetFollowTarget(true);
            if (door != null)
            {
                door.TurnOnTurnOff();
            }
        }
    }
コード例 #2
0
    IEnumerator InterpolatePositionChangingChamber(float time, Vector2 finalPosition, DoorBehaviour door)
    {
        float   elapsedTime     = 0.0f;
        Vector2 initialPosition = GetComponent <Transform>().position;

        while (elapsedTime < time)
        {
            elapsedTime += Time.deltaTime;
            GetComponent <Transform>().position = Vector2.Lerp(initialPosition, finalPosition, elapsedTime / time);
            yield return(null);
        }
        GetComponent <Transform>().position = finalPosition;
        Blink(true);
        GetComponent <CapsuleCollider2D>().enabled = true;
        SetInputActivated(true);

        door.TurnOnTurnOff();
    }