Skip to content

Commit

Permalink
Streaming assets
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasVinicius314 committed Sep 15, 2022
1 parent 19eb678 commit cc49a97
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Assets/Prefabs/Player.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ VideoPlayer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1791320227682299352}
m_Enabled: 1
m_VideoClip: {fileID: 32900000, guid: 1e1f7c5ecdf0b224bac09727d97cd45a, type: 3}
m_VideoClip: {fileID: 0}
m_TargetCameraAlpha: 1
m_TargetCamera3DLayout: 0
m_TargetCamera: {fileID: 3591939341705465154}
Expand Down
19 changes: 11 additions & 8 deletions Assets/Scripts/PlayerScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,24 @@ public void HandleCharacterControllerUpdate()

void HandleConfigInitialization()
{
// TODO: Colocar na classe
GameManagerScript.instance.DisableMenu();

if (!LocalPrefs.GetGamepadEnabled())
{
GameManagerScript.instance.DisableGamepad();
}

// TODO: Colocar como atributo da classe
var videoPlayer = Camera.main.gameObject.GetComponent<VideoPlayer>();

videoPlayer.source = VideoSource.Url;
videoPlayer.url = AssetLoader.GetPath("Video/black-hole.mp4");

videoPlayer.Prepare();
videoPlayer.prepareCompleted += (source) =>
{
videoPlayer.Play();
};

GameManagerScript.instance.DisableMenu();

if (!LocalPrefs.GetGamepadEnabled())
{
GameManagerScript.instance.DisableGamepad();
}
}

void HandleModelAnimation(GameObject model)
Expand Down
9 changes: 9 additions & 0 deletions Assets/Scripts/Utils/AssetLoader.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using UnityEngine;

public static class AssetLoader
{
public static string GetPath(string file)
{
return System.IO.Path.Combine(Application.streamingAssetsPath, file);
}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/Utils/AssetLoader.cs.meta

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

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit cc49a97

Please sign in to comment.