Details

Last Updated
3 weeks ago
First Uploaded
3 weeks ago
Downloads
1.4M
Likes
10
Size
57KB
Dependency string
IntegrityChaos-LCCutscene-2.0.1
Dependants

LCCutscene (W.I.P.)

LCCutscene is a tool to create cutscenes and immersive animations to Lethal Company. (Originaly made for Diversity)

Examples

Cutscene:

Quickscene W.I.P.:

Usage

Cutscenes

  • Add the following namespace:
using LCCutscene;
  • Create your custom Cutscene using the Cutscene class:
Cutscene(Transform cutsceneTransform, Float cutsceneDuration)
{
    AllowPlayerDeath = false,
    AllowPlayerMovement = false,
    TransitionIn = Transition.FadeOut,
    TransitionOut = Transition.FadeOut,
    TransitionInSpeed = 1f,
    TransitionOutSpeed = 1f
};

NOTE:

The cutscene transform is used for the cutscene camera to clamp on and is recommended to be animated!

  • Play your new cutscene using the CutsceneManager:
CutsceneManager.Instance.PlayScene(Cutscene myCutscene);

NOTE:

Only one cutscene can be played at once! (Per player.)

Full Example:

using System.Collections;
using System.Collections.Generic;
using LCCutscene;
using UnityEngine;

public class MyCutscene : MonoBehaviour
{
    public Transform animatedTransform; // The Transform where the cutscene camera will clamp on. //
    public Animatior animator; // Animator for animating your cutscene. //

    private Cutscene scene; // The cutscene itself. //

    void Start()
    {
	    // Create your cutscene. //
        scene = new Cutscene(animatedTransform, 10f)
		{
		    AllowPlayerDeath = false,
		    AllowPlayerMovement = false,
		    TransitionIn = Transition.FadeOut,
		    TransitionOut = Transition.FadeOut
		};
    }

    public void PlayMyCutscene(Collider col)
    {
        CutsceneManager.Instance.PlayScene(scene); // Play your cutscene. //
        animator.SetBool("PlayCameraAnimation", true); // Play your custom animation for your animated transform and much more! //
    }
}

Quick Scenes [W.I.P.]

  • Add the following namespace:
using LCCutscene;
  • Create your custom Quickscene using the Quickscene class:
QuickScene(float duration, Transform targetPosition, float targetRotation, AnimationClip clip, Transform targetEndPosition = null, float? targetEndRotation = null, POVType pov = POVType.Full, PlayerPose startingPose = PlayerPose.Standing, PlayerPose endingPose = PlayerPose.Standing, bool snapPlayersToPositions = true, float snapSpeed = 10f)

NOTE:

The AnimationClip clip can also be changed to List<AnimationClip> clips for more complex animations for the player. These clips will be played one after another in order.

IMPORTANT:

POVType.ArmsOnly is currently in W.I.P. and won't be available until updated!

  • Play your new Quickscene using the CutsceneManager:
CutsceneManager.Instance.PlayScene(Quickscene myQuickscene);

NOTE:

Only one quickscene can be played at once! (Per player.)

Full Example (Vaulting over desk example):

using System.Collections;
using System.Collections.Generic;
using LCCutscene;
using UnityEngine;

public class MyQuickscene : MonoBehaviour
{
    public Transform startTarget; // The start position and rotation for the player to clamp on. //
    public Transform endTarget; // The end position and rotation for the player to clamp on. //
    public AnimationClip clip; // The animation clip for the Player. //

    public QuickScene scene; // The Quickscene itself. //

    void Start()
    {
	    // Create your Quickscene. //
        scene = new Quickscene(clip.length, startTarget, startTarget.rotation.eulerAngles.y, clip, endTarget, endTarget.rotation.eulerAngles.y);
    }

	// If the local player reaches a designated area while running, it triggers the quickscene. //
    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.TryGetComponent(out PlayerControllerB player))
        {
            if (player == StartOfRound.Instance.localPlayerController && !CutsceneManager.Instance.cutscenePlaying && player.isSprinting)
            {
                CutsceneManager.Instance.PlayScene(scene); // Play your Quickscene. //
            }
        }
    }
}

Syncing animations for other players (Quickscene only):

  • PlayAnimationOnOtherPlayer is used to play the same animation set to other players that aren't the local player:
public void PlayAnimationOnOtherPlayer(PlayerControllerB player, List<AnimationClip> clips)

public void PlayAnimationOnOtherPlayer(PlayerControllerB _player, QuickScene _quickScene)

TIP:

PlayAnimationOnOtherPlayer has two different option, either you use your own Quickscene or another animation set meant for third person viewing if it is needed.

  • StopAnimationOnOtherPlayer is used to play the same animation set to other players that aren't the local player:
public void StopAnimationOnOtherPlayer(PlayerControllerB player)

NOTE:

There's no need for any animation set or Quickscene for this function. This function's only purpose is to stop any custom animation on other players and returning to it's default state.

IMPORTANT:

There is no networking implemented in LCCutscene. It is recommended that you make your own networking to sync animations between players.

Subscribable events:

Here's a list of events that can be subscribed within the CutsceneManager:

  • OnSceneStart
  • OnSceneEnd
  • OnSceneTransitionIn
  • OnSceneTransitionOut

TIP:

Those can be used for more complex tinkering for cutscenes. They also have no arguments since everything is accessible within the manager itself.

Thunderstore development is made possible with ads. Please consider making an exception to your adblock.
Thunderstore development is made possible with ads. Please consider making an exception to your adblock.
Thunderstore development is made possible with ads. Please consider making an exception to your adblock.