Skip to content

Commit 4cdee82

Browse files
feat: cinematic camera manager initial design
1 parent e47fe81 commit 4cdee82

File tree

4 files changed

+107
-7
lines changed

4 files changed

+107
-7
lines changed

COTL_API.Common.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<PropertyGroup>
33
<TargetFramework>net472</TargetFramework>
4-
<Version>0.2.12</Version>
4+
<Version>0.2.13</Version>
55
<LangVersion>latest</LangVersion>
66
<DebugType>portable</DebugType>
77
<IsPackable>true</IsPackable>

COTL_API/COTL_API.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
<PackageIcon>icon.png</PackageIcon>
1414
</PropertyGroup>
1515

16-
<Import Project="../COTL_API.Common.props"/>
16+
<Import Project="../COTL_API.Common.props" />
1717

1818
<ItemGroup>
19-
<PackageReference Include="CultOfTheLamb.GameLibs" Version="1.4.6.596-r.0"/>
19+
<PackageReference Include="CultOfTheLamb.GameLibs" Version="1.4.6.596-r.0" />
2020
<Reference Include="UnifyLibrary">
2121
<HintPath>..\lib\UnifyLibrary.dll</HintPath>
2222
</Reference>
23-
<None Include="../README.md" Pack="true" PackagePath="/"/>
24-
<None Include="../LICENSE" Pack="true" PackagePath="/"/>
25-
<None Include="../icon.png" Pack="true" PackagePath="/"/>
23+
<None Include="../README.md" Pack="true" PackagePath="/" />
24+
<None Include="../LICENSE" Pack="true" PackagePath="/" />
25+
<None Include="../icon.png" Pack="true" PackagePath="/" />
2626
</ItemGroup>
2727
</Project>
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
using System.Collections;
2+
using UnityEngine;
3+
4+
namespace COTL_API.Utility;
5+
6+
public class CinematicCameraManager
7+
{
8+
9+
public static List<IEnumerator> ActiveFocusPoints = [];
10+
public static void Zoom(float targetZoom)
11+
{
12+
GameManager.GetInstance().CameraSetTargetZoom(targetZoom);
13+
}
14+
15+
public static void ZoomReset()
16+
{
17+
GameManager.GetInstance().CameraResetTargetZoom();
18+
}
19+
20+
public static SimpleSetCamera CreateAndActivateFocusPoint(Vector3 position)
21+
{
22+
var cam = CreateFocusPoint(position);
23+
cam.Play();
24+
return cam;
25+
}
26+
27+
public static void CreateAndPrepareTimedFocusPoint(Vector3 position, float duration)
28+
{
29+
ActiveFocusPoints.Add(CreateTimedFocusPoint(position, duration));
30+
}
31+
32+
private static IEnumerator CreateTimedFocusPoint(Vector3 position, float duration)
33+
{
34+
var cam = CreateFocusPoint(position);
35+
cam.Play();
36+
yield return new WaitForSeconds(duration);
37+
}
38+
39+
private static SimpleSetCamera CreateFocusPoint(Vector3 position)
40+
{
41+
var cam = new GameObject("CinematicCameraFocusPoint");
42+
cam.transform.position = position;
43+
var ssc = cam.AddComponent<SimpleSetCamera>();
44+
ssc.AutomaticallyActivate = false;
45+
return ssc;
46+
}
47+
48+
public static IEnumerator ActivateAllCreatedFocusPoints()
49+
{
50+
foreach (var cam in ActiveFocusPoints)
51+
{
52+
yield return cam;
53+
}
54+
}
55+
56+
public static void ResetAllFocusPoints(float speed = 1f)
57+
{
58+
GameManager.GetInstance().CamFollowTarget.ResetTargetCamera(speed);
59+
ActiveFocusPoints.Clear();
60+
}
61+
62+
public static void AddFollowTarget(GameObject target, float weight = 1f)
63+
{
64+
CameraFollowTarget.Instance?.AddTarget(target, weight);
65+
}
66+
67+
public static void RemoveFollowTarget(GameObject target)
68+
{
69+
CameraFollowTarget.Instance?.RemoveTarget(target);
70+
}
71+
72+
public static void SetCameraLimits(bool enabled, Bounds limits)
73+
{
74+
if (!enabled)
75+
CameraFollowTarget.Instance?.DisableCameraLimits();
76+
else
77+
CameraFollowTarget.Instance?.SetCameraLimits(limits);
78+
}
79+
80+
public static void ShowLetterbox(bool show, bool showHudAfterHide = true, string subtitle = "")
81+
{
82+
if (show)
83+
{
84+
LetterBox.Show(false);
85+
if (subtitle != "")
86+
LetterBox.Instance?.ShowSubtitle(subtitle);
87+
}
88+
89+
else
90+
LetterBox.Hide(showHudAfterHide);
91+
}
92+
93+
public static void ShowHUD(bool show, int delay = 1)
94+
{
95+
if (show)
96+
HUD_Manager.Instance?.Show(delay);
97+
else
98+
HUD_Manager.Instance?.Hide(false);
99+
}
100+
}

thunderstore.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ schemaVersion = "0.0.1"
44
[package]
55
namespace = "xhayper"
66
name = "COTL_API"
7-
versionNumber = "0.2.12"
7+
versionNumber = "0.2.13"
88
description = "A library to easily interact with Cult of the Lamb"
99
websiteUrl = "https://cotl-api.vercel.app/"
1010
containsNsfwContent = false

0 commit comments

Comments
 (0)