Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Assets/FMOD_Banks/Android/Master.bank
Binary file not shown.
Binary file modified Assets/FMOD_Banks/Android/Master.strings.bank
Binary file not shown.
Binary file modified Assets/FMOD_Banks/Android/Music.bank
Binary file not shown.
Binary file modified Assets/FMOD_Banks/Android/SFX.bank
Binary file not shown.
7 changes: 7 additions & 0 deletions Assets/FMOD_Banks/Android/SFX.bank.meta

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

Binary file modified Assets/FMOD_Banks/Android/UI.bank
Binary file not shown.
7 changes: 7 additions & 0 deletions Assets/FMOD_Banks/Android/UI.bank.meta

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

Binary file modified Assets/FMOD_Banks/Desktop/Master.bank
Binary file not shown.
Binary file modified Assets/FMOD_Banks/Desktop/Master.strings.bank
Binary file not shown.
Binary file modified Assets/FMOD_Banks/Desktop/Music.bank
Binary file not shown.
Binary file modified Assets/FMOD_Banks/Desktop/SFX.bank
Binary file not shown.
Binary file modified Assets/FMOD_Banks/Desktop/UI.bank
Binary file not shown.
90 changes: 90 additions & 0 deletions Assets/Prefabs/CanvasUiGame.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,73 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!1 &478555337218132155
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2973069775376423401}
- component: {fileID: 2811562309334295289}
m_Layer: 5
m_Name: AudioPlayer
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2973069775376423401
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 478555337218132155}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5077411758500241539}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2811562309334295289
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 478555337218132155}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9a6610d2e704f1648819acc8d7460285, type: 3}
m_Name:
m_EditorClassIdentifier:
CollisionTag:
EventReference:
Guid:
Data1: 263623292
Data2: 1122466318
Data3: -489455458
Data4: -1494029249
Path: event:/Cinematics/Beep
Event:
PlayEvent: 0
StopEvent: 12
AllowFadeout: 1
TriggerOnce: 0
Preload: 0
AllowNonRigidbodyDoppler: 0
Params: []
OverrideAttenuation: 0
OverrideMinDistance: 1
OverrideMaxDistance: 20
--- !u!1 &549930013124068898
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -820,6 +887,7 @@ RectTransform:
- {fileID: 296364771073465774}
- {fileID: 3694135226426407179}
- {fileID: 4949596820761024886}
- {fileID: 2973069775376423401}
m_Father: {fileID: 9153207626135136974}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
Expand Down Expand Up @@ -861,6 +929,28 @@ MonoBehaviour:
videoClipStart: initGame
videoClipEndLose: GameLose
videoClipEndWin: GameWin
m_EventEmitter: {fileID: 2811562309334295289}
m_EventNameStart:
Guid:
Data1: 601025763
Data2: 1314430136
Data3: -1378094184
Data4: 2126824336
Path: event:/Cinematics/seq_InitGame
m_EventNameEndLoose:
Guid:
Data1: 263623292
Data2: 1122466318
Data3: -489455458
Data4: -1494029249
Path: event:/Utils/Beep
m_EventNameEndWin:
Guid:
Data1: 263623292
Data2: 1122466318
Data3: -489455458
Data4: -1494029249
Path: event:/Utils/Beep
--- !u!114 &764191257342872135
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
23 changes: 23 additions & 0 deletions Assets/Scripts/UIController.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using System.Collections;
using System.Diagnostics;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.UI;
using UnityEngine.Video;
using Debug = UnityEngine.Debug;

public class UIController : MonoBehaviour, IUiControllerService
{
Expand All @@ -12,7 +15,14 @@ public class UIController : MonoBehaviour, IUiControllerService
[SerializeField] private VideoPlayer videoPlayer;
[SerializeField] private GameObject video;
[SerializeField] private Button skipButton;

[Tooltip("Nombres de los videos")]
[SerializeField] private string videoClipStart, videoClipEndLose, videoClipEndWin;

[Header("FMOD events for videos")]
[SerializeField] private FMODUnity.StudioEventEmitter m_EventEmitter;
[SerializeField] private FMODUnity.EventReference m_EventNameStart, m_EventNameEndLoose, m_EventNameEndWin;

private IGameLoop _gameLoop;
public bool SelectedEndGame { get; private set; }
public bool SelectedStartGame { get; private set; }
Expand Down Expand Up @@ -63,13 +73,19 @@ public void ShowAnimationStart()
uiOfGame.SetActive(false);
videoPlayer.url = System.IO.Path.Combine(Application.streamingAssetsPath, "Videos", videoClipStart + ".mp4");
videoPlayer.Prepare();
AssignFMODEvent(m_EventNameStart);
videoPlayer.prepareCompleted += source =>
{
video.SetActive(true);
StartCoroutine(StartVideo());
};
}

private void AssignFMODEvent(FMODUnity.EventReference eventRef)
{
m_EventEmitter.EventReference = eventRef;
}

public void ShowUiOfGame()
{
animationPanel.SetActive(false);
Expand All @@ -89,11 +105,17 @@ public void ShowStartPanel()
private IEnumerator StartVideo()
{
StartVideoPlayer();
StartAudioForVideo();
Debug.Log($"Start Video {videoPlayer.length}");
yield return new WaitForSeconds((float)videoPlayer.length);
FinishVideo();
}

private void StartAudioForVideo()
{
m_EventEmitter.Play();
}

private void StartVideoPlayer()
{
AnimationStartGame = false;
Expand Down Expand Up @@ -137,6 +159,7 @@ public void ShowEndGameAnimation(bool lose)
videoPlayer.url = System.IO.Path.Combine(Application.streamingAssetsPath, "Videos",
!lose ? videoClipEndWin + ".mp4" : videoClipEndLose + ".mp4");
videoPlayer.Prepare();
AssignFMODEvent(lose ? m_EventNameEndLoose: m_EventNameEndWin);
videoPlayer.prepareCompleted += source =>
{
video.SetActive(true);
Expand Down
44 changes: 22 additions & 22 deletions Packages/packages-lock.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"dependencies": {
"com.unity.2d.animation": {
"version": "9.1.3",
"version": "9.1.0",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.2d.common": "8.0.4",
"com.unity.2d.common": "8.0.2",
"com.unity.2d.sprite": "1.0.0",
"com.unity.collections": "1.1.0",
"com.unity.modules.animation": "1.0.0",
Expand All @@ -14,7 +14,7 @@
"url": "https://packages.unity.com"
},
"com.unity.2d.aseprite": {
"version": "1.1.7",
"version": "1.1.1",
"depth": 1,
"source": "registry",
"dependencies": {
Expand All @@ -26,7 +26,7 @@
"url": "https://packages.unity.com"
},
"com.unity.2d.common": {
"version": "8.0.4",
"version": "8.0.2",
"depth": 2,
"source": "registry",
"dependencies": {
Expand All @@ -46,13 +46,13 @@
"url": "https://packages.unity.com"
},
"com.unity.2d.psdimporter": {
"version": "8.0.5",
"version": "8.0.4",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.2d.common": "8.0.2",
"com.unity.2d.sprite": "1.0.0",
"com.unity.2d.animation": "9.1.1"
"com.unity.2d.animation": "9.1.0"
},
"url": "https://packages.unity.com"
},
Expand All @@ -63,11 +63,11 @@
"dependencies": {}
},
"com.unity.2d.spriteshape": {
"version": "9.0.5",
"version": "9.0.2",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.2d.common": "8.0.4",
"com.unity.2d.common": "8.0.1",
"com.unity.mathematics": "1.1.0",
"com.unity.modules.physics2d": "1.0.0"
},
Expand All @@ -83,7 +83,7 @@
}
},
"com.unity.2d.tilemap.extras": {
"version": "3.1.3",
"version": "3.1.2",
"depth": 1,
"source": "registry",
"dependencies": {
Expand All @@ -95,7 +95,7 @@
"url": "https://packages.unity.com"
},
"com.unity.burst": {
"version": "1.8.18",
"version": "1.8.12",
"depth": 1,
"source": "registry",
"dependencies": {
Expand Down Expand Up @@ -140,14 +140,14 @@
"depth": 0,
"source": "builtin",
"dependencies": {
"com.unity.2d.animation": "9.1.3",
"com.unity.2d.animation": "9.1.0",
"com.unity.2d.pixel-perfect": "5.0.3",
"com.unity.2d.psdimporter": "8.0.5",
"com.unity.2d.psdimporter": "8.0.4",
"com.unity.2d.sprite": "1.0.0",
"com.unity.2d.spriteshape": "9.0.5",
"com.unity.2d.spriteshape": "9.0.2",
"com.unity.2d.tilemap": "1.0.0",
"com.unity.2d.tilemap.extras": "3.1.3",
"com.unity.2d.aseprite": "1.1.7"
"com.unity.2d.tilemap.extras": "3.1.2",
"com.unity.2d.aseprite": "1.1.1"
}
},
"com.unity.ide.rider": {
Expand Down Expand Up @@ -194,7 +194,7 @@
"url": "https://packages.unity.com"
},
"com.unity.render-pipelines.core": {
"version": "14.0.11",
"version": "14.0.10",
"depth": 1,
"source": "builtin",
"dependencies": {
Expand All @@ -211,17 +211,17 @@
"dependencies": {
"com.unity.mathematics": "1.2.1",
"com.unity.burst": "1.8.9",
"com.unity.render-pipelines.core": "14.0.11",
"com.unity.shadergraph": "14.0.11",
"com.unity.render-pipelines.core": "14.0.10",
"com.unity.shadergraph": "14.0.10",
"com.unity.render-pipelines.universal-config": "14.0.9"
}
},
"com.unity.render-pipelines.universal-config": {
"version": "14.0.10",
"version": "14.0.9",
"depth": 1,
"source": "builtin",
"dependencies": {
"com.unity.render-pipelines.core": "14.0.10"
"com.unity.render-pipelines.core": "14.0.9"
}
},
"com.unity.searcher": {
Expand All @@ -232,11 +232,11 @@
"url": "https://packages.unity.com"
},
"com.unity.shadergraph": {
"version": "14.0.11",
"version": "14.0.10",
"depth": 1,
"source": "builtin",
"dependencies": {
"com.unity.render-pipelines.core": "14.0.11",
"com.unity.render-pipelines.core": "14.0.10",
"com.unity.searcher": "4.9.2"
}
},
Expand Down
Loading
Loading