Skip to content

Commit

Permalink
Merge pull request #104 from NicolasLaure/credits-first-roll
Browse files Browse the repository at this point in the history
Fix camera bug in build
  • Loading branch information
Maxi-F authored Nov 6, 2024
2 parents 6afb74e + 7a55ccf commit c65d433
Show file tree
Hide file tree
Showing 11 changed files with 177 additions and 32 deletions.
40 changes: 40 additions & 0 deletions Assets/Input/PlayerInput.inputactions
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,24 @@
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "logs",
"type": "Button",
"id": "9d046628-20f2-479f-9179-527a34470688",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "closeLogs",
"type": "Button",
"id": "e3b40258-7512-4624-ab9b-e4fb60826b0a",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
}
],
"bindings": [
Expand Down Expand Up @@ -216,6 +234,28 @@
"action": "SkipSequence",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "d6960094-9b0d-42e3-a73c-d20e6ffe9de0",
"path": "<Keyboard>/f2",
"interactions": "",
"processors": "",
"groups": "",
"action": "logs",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "a8377c2f-64a9-42cf-9356-8a3f1cadf8a8",
"path": "<Keyboard>/f3",
"interactions": "",
"processors": "",
"groups": "",
"action": "closeLogs",
"isComposite": false,
"isPartOfComposite": false
}
]
},
Expand Down
34 changes: 34 additions & 0 deletions Assets/Prefabs/Inputs/InputReader.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,40 @@ MonoBehaviour:
m_CallState: 2
m_ActionId: 600776b7-dd49-4135-9a79-31d6a82216c9
m_ActionName: TopDownCombat/SkipSequence[/Keyboard/f1]
- m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 11400000, guid: 80e377593c74edf4f94fc87a74c09ad1, type: 2}
m_TargetAssemblyTypeName: Events.ScriptableObjects.EventChannelSO`1[[System.Boolean,
mscorlib
m_MethodName: RaiseEvent
m_Mode: 6
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 1
m_CallState: 2
m_ActionId: 9d046628-20f2-479f-9179-527a34470688
m_ActionName: TopDownCombat/logs[/Keyboard/f2]
- m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 11400000, guid: 80e377593c74edf4f94fc87a74c09ad1, type: 2}
m_TargetAssemblyTypeName: Events.ScriptableObjects.EventChannelSO`1[[System.Boolean,
mscorlib
m_MethodName: RaiseEvent
m_Mode: 6
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_ActionId: e3b40258-7512-4624-ab9b-e4fb60826b0a
m_ActionName: TopDownCombat/closeLogs[/Keyboard/f3]
m_NeverAutoSwitchControlSchemes: 0
m_DefaultControlScheme:
m_DefaultActionMap: TopDownCombat
Expand Down
8 changes: 4 additions & 4 deletions Assets/Prefabs/Managers/LevelManager.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ MonoBehaviour:
creditsScene: Credits
inputHandler: {fileID: 11400000, guid: 4902f51743585ca40aec021ece06aa06, type: 2}
onEnemyDamageEvent: {fileID: 11400000, guid: 41331d8fc0079ac47bec86270d050339, type: 2}
onEnemyShouldLeaveEvent: {fileID: 11400000, guid: 1f421373e2afbde429cd720ecda18428, type: 2}
onEnemyLeftEvent: {fileID: 11400000, guid: 4eccd1b235bb84a40ac8ca3371247ebd, type: 2}
onEnemyDeathEvent: {fileID: 11400000, guid: 36bbe8a4a81fcf74da11d75999d01f40, type: 2}
onPlayerDeathEvent: {fileID: 11400000, guid: 1609b932e078810448a25604c23359d3, type: 2}
onTryAgainCanvasEvent: {fileID: 11400000, guid: 45952cb3995e2054ea77145faefe979e, type: 2}
Expand All @@ -79,10 +81,7 @@ MonoBehaviour:
- {fileID: 0}
- {fileID: 0}
player: {fileID: 0}
playersVelocity: 10
otherPlayersEndZPosition: 44
playerInitZPosition: 1.15
startCameraData: {fileID: 11400000, guid: c52b19016cf766c4990fae22f19b1cbb, type: 2}
startLevelConfig: {fileID: 11400000, guid: 8f12f6003f84b9b4292871d310b6bed6, type: 2}
onCinematicStartEvent: {fileID: 11400000, guid: 49bed95fec698814188e97e4aef4801b, type: 2}
onCinematicPlayerLockStart: {fileID: 11400000, guid: b711b8f3d88f6614bb9d23a652188ca8, type: 2}
onCinematicPlayerLockFinished: {fileID: 11400000, guid: 83f6a3608cca1b64a9e546fae228e30e, type: 2}
Expand All @@ -92,6 +91,7 @@ MonoBehaviour:
onCinematicUICanvasEvent: {fileID: 11400000, guid: 89b54cb7a8c4db445b3626518651b589, type: 2}
onCinematicEnded: {fileID: 11400000, guid: 9f9b493eaa207164b9413b5af5fee35b, type: 2}
onGameplayUICanvasEvent: {fileID: 11400000, guid: 320bab34c80c172448a6c8a73219b3fd, type: 2}
onNewRoadsVelocity: {fileID: 11400000, guid: 21efa5342df3fb84ab0e65389176d7cf, type: 2}
onCameraMovementEvent: {fileID: 11400000, guid: 90b6045fa5889cc42af5977d80c68a89, type: 2}
--- !u!114 &4611192124218542088
MonoBehaviour:
Expand Down
14 changes: 14 additions & 0 deletions Assets/Scenes/Boot.unity
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ GameObject:
m_Component:
- component: {fileID: 460891771}
- component: {fileID: 460891772}
- component: {fileID: 460891773}
m_Layer: 0
m_Name: BootManager
m_TagString: Untagged
Expand Down Expand Up @@ -168,6 +169,19 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
sceneryManager: {fileID: 1074262472}
--- !u!114 &460891773
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 460891770}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 815b9034026a08b4eb944bd6e271b4f2, type: 3}
m_Name:
m_EditorClassIdentifier:
OnCheatToggleConsole: {fileID: 11400000, guid: 80e377593c74edf4f94fc87a74c09ad1, type: 2}
--- !u!114 &1074262472 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 6288261650114330022, guid: d1b9efb00f169a74eba642e6c29ec261, type: 3}
Expand Down
16 changes: 0 additions & 16 deletions Assets/Scenes/GameLoop.unity
Original file line number Diff line number Diff line change
Expand Up @@ -1739,14 +1739,6 @@ PrefabInstance:
propertyPath: player
value:
objectReference: {fileID: 1059696745}
- target: {fileID: 4072355942097122109, guid: 997a42626b659814cb0aa0d749e0b092, type: 3}
propertyPath: startLevelConfig
value:
objectReference: {fileID: 11400000, guid: 8f12f6003f84b9b4292871d310b6bed6, type: 2}
- target: {fileID: 4072355942097122109, guid: 997a42626b659814cb0aa0d749e0b092, type: 3}
propertyPath: onNewRoadsVelocity
value:
objectReference: {fileID: 11400000, guid: 21efa5342df3fb84ab0e65389176d7cf, type: 2}
- target: {fileID: 4072355942097122109, guid: 997a42626b659814cb0aa0d749e0b092, type: 3}
propertyPath: otherPlayers.Array.data[0]
value:
Expand Down Expand Up @@ -1779,18 +1771,10 @@ PrefabInstance:
propertyPath: levelLoopManager
value:
objectReference: {fileID: 1839552625}
- target: {fileID: 7147819174927887729, guid: 997a42626b659814cb0aa0d749e0b092, type: 3}
propertyPath: onEnemyLeftEvent
value:
objectReference: {fileID: 11400000, guid: 4eccd1b235bb84a40ac8ca3371247ebd, type: 2}
- target: {fileID: 7147819174927887729, guid: 997a42626b659814cb0aa0d749e0b092, type: 3}
propertyPath: playerHealthPoints
value:
objectReference: {fileID: 1059696746}
- target: {fileID: 7147819174927887729, guid: 997a42626b659814cb0aa0d749e0b092, type: 3}
propertyPath: onEnemyShouldLeaveEvent
value:
objectReference: {fileID: 11400000, guid: 1f421373e2afbde429cd720ecda18428, type: 2}
- target: {fileID: 9200447392731979298, guid: 997a42626b659814cb0aa0d749e0b092, type: 3}
propertyPath: m_LocalPosition.x
value: 0
Expand Down
20 changes: 20 additions & 0 deletions Assets/ScriptableObjects/Events/onLogsCheatEvent.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ee824795062d0024d8db887311a635f3, type: 3}
m_Name: onLogsCheatEvent
m_EditorClassIdentifier:
onEvent:
m_PersistentCalls:
m_Calls: []
onTypedEvent:
m_PersistentCalls:
m_Calls: []
8 changes: 8 additions & 0 deletions Assets/ScriptableObjects/Events/onLogsCheatEvent.asset.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions Assets/Scripts/Camera/CameraMovement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class CameraMovement : MonoBehaviour
{
[SerializeField] private CameraDataChannelSO onCameraMovementEvent;

private Coroutine movementCoroutine;
private Coroutine _movementCoroutine;
private void OnEnable()
{
onCameraMovementEvent?.onTypedEvent.AddListener(HandleCameraMovement);
Expand All @@ -22,28 +22,29 @@ private void OnDisable()

private void HandleCameraMovement(CameraSO cameraData)
{
if(movementCoroutine != null)
StopCoroutine(movementCoroutine);
if(_movementCoroutine != null)
StopCoroutine(_movementCoroutine);

movementCoroutine = StartCoroutine(HandleMovementCoroutine(cameraData));
_movementCoroutine = StartCoroutine(HandleMovementCoroutine(cameraData));
}

private IEnumerator HandleMovementCoroutine(CameraSO cameraData)
{
float timer = 0;
float startTime = Time.time;
Quaternion startRotation = gameObject.transform.rotation;
Quaternion endRotation = Quaternion.Euler(cameraData.eulerRotation);

while (timer < cameraData.timeToRotate)
{
timer = Time.time - startTime;

float rotationTime = cameraData.curve.Evaluate(timer / cameraData.timeToRotate);
gameObject.transform.rotation = Quaternion.Slerp(startRotation, cameraData.Rotation, rotationTime);
gameObject.transform.rotation = Quaternion.Slerp(startRotation, endRotation, rotationTime);
yield return null;
}

gameObject.transform.rotation = cameraData.Rotation;
gameObject.transform.rotation = endRotation;
}
}
}
6 changes: 0 additions & 6 deletions Assets/Scripts/Camera/CameraSO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,5 @@ public class CameraSO : ScriptableObject
public Vector3 eulerRotation;
public AnimationCurve curve;
public float timeToRotate;
public Quaternion Rotation { get; private set; }

private void OnValidate()
{
Rotation = Quaternion.Euler(eulerRotation);
}
}
}
39 changes: 39 additions & 0 deletions Assets/Scripts/Utils/ConsoleViewer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Events;
using Events.ScriptableObjects;
using UnityEngine;
public class ConsoleViewer : MonoBehaviour
{
[SerializeField] private BoolEventChannelSO OnCheatToggleConsole;
string myLog = "*begin log";
string filename = "";
bool doShow = false;
int kChars = 700;
void OnEnable()
{
Application.logMessageReceived += Log;
OnCheatToggleConsole.onTypedEvent.AddListener(ToggleConsole);
}
void OnDisable()
{
Application.logMessageReceived -= Log;
OnCheatToggleConsole.onTypedEvent.RemoveListener(ToggleConsole);
}
void ToggleConsole(bool value)
{
doShow = value;
}
public void Log(string logString, string stackTrace, LogType type)
{
// for onscreen...
myLog = myLog + " " + logString + "\n";
if (myLog.Length > kChars) { myLog = myLog.Substring(myLog.Length - kChars); }
}

void OnGUI()
{
if (!doShow) { return; }
GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity,
new Vector3(Screen.width / 1200.0f, Screen.height / 800.0f, 1.0f));
GUI.TextArea(new Rect(10, 10, 540, 370), myLog);
}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/Utils/ConsoleViewer.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c65d433

Please sign in to comment.