Improve folder structure
This commit is contained in:
8
Assets/Courses/Images.meta
Normal file
8
Assets/Courses/Images.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 516e697f1b5d3e84b8a012ae5af3884a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Courses/ScriptableObjects.meta
Normal file
8
Assets/Courses/ScriptableObjects.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a68750d2e1dc17244978420ed62508cd
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Courses/Scripts.meta
Normal file
8
Assets/Courses/Scripts.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10f6ce1d7fe8c8e49b57e6d5fd69ec9b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
71
Assets/Courses/Scripts/StartPause.cs
Normal file
71
Assets/Courses/Scripts/StartPause.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Video;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class StartPause : MonoBehaviour
|
||||
{
|
||||
public VideoPlayer player;
|
||||
public Button button;
|
||||
public Sprite pauseSprite;
|
||||
public Image image;
|
||||
|
||||
private int word_i = 0;
|
||||
// In my example, i have 4 videos/images
|
||||
private int max_words = 4;
|
||||
|
||||
// Start is called before the first frame update
|
||||
public void Start()
|
||||
{
|
||||
next_video();
|
||||
//next_image();
|
||||
|
||||
button.image.sprite = pauseSprite;
|
||||
Color col = button.image.color;
|
||||
col.a = 255;
|
||||
button.image.color = col;
|
||||
}
|
||||
|
||||
// These two functions generate video and image from files
|
||||
private void next_video(){
|
||||
// TODO: fix with dynamic loading
|
||||
player.url = $"Assets/Courses/Videos/{word_i}.mp4";
|
||||
}
|
||||
|
||||
// This doesn't work
|
||||
private void next_image(){
|
||||
// TODO: fix with dynamic loading
|
||||
Sprite tex = Resources.Load($"Assets/Courses/Images/{word_i}.png") as Sprite;
|
||||
image.sprite = tex;
|
||||
}
|
||||
|
||||
// Activate by pressing the center of the screen
|
||||
public void Pause()
|
||||
{
|
||||
if (!player.isPlaying)
|
||||
{
|
||||
player.Play();
|
||||
Color col = button.image.color;
|
||||
col.a = 0;
|
||||
button.image.color = col;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.Pause();
|
||||
Color col = button.image.color;
|
||||
col.a = 255;
|
||||
button.image.color = col;
|
||||
}
|
||||
}
|
||||
|
||||
// Press next-sign button for next word
|
||||
public void NextSign(){
|
||||
// Fetch next video and image from log
|
||||
// Idea : do this by numbering video's and images and using increment to find them.
|
||||
word_i++;
|
||||
word_i %= max_words;
|
||||
next_video();
|
||||
//next_image();
|
||||
}
|
||||
}
|
||||
11
Assets/Courses/Scripts/StartPause.cs.meta
Normal file
11
Assets/Courses/Scripts/StartPause.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ae746f332e314e84c9df74b892c75d4d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
50
Assets/Courses/Scripts/Webcam.cs
Normal file
50
Assets/Courses/Scripts/Webcam.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class Webcam : MonoBehaviour
|
||||
{
|
||||
int camdex = 0;
|
||||
WebCamTexture tex;
|
||||
|
||||
public RawImage display;
|
||||
public Button nextSignButton;
|
||||
|
||||
void Awake(){
|
||||
WebCamDevice device = WebCamTexture.devices[camdex];
|
||||
tex = new WebCamTexture(device.name);
|
||||
display.texture = tex;
|
||||
|
||||
tex.Play();
|
||||
}
|
||||
|
||||
public void SwapCam(){
|
||||
if(WebCamTexture.devices.Length > 0){
|
||||
// Stop the old camera
|
||||
display.texture = null;
|
||||
tex.Stop();
|
||||
tex = null;
|
||||
|
||||
// Find the new camera
|
||||
camdex += 1;
|
||||
camdex %= WebCamTexture.devices.Length;
|
||||
|
||||
// Start the new camera
|
||||
WebCamDevice device = WebCamTexture.devices[camdex];
|
||||
tex = new WebCamTexture(device.name);
|
||||
display.texture = tex;
|
||||
|
||||
tex.Play();
|
||||
}
|
||||
}
|
||||
// Scene changing is implemented here to avoid problems with webcam
|
||||
public void loadScene(string sceneName) {
|
||||
display.texture = null;
|
||||
tex.Stop();
|
||||
tex = null;
|
||||
|
||||
SceneManager.LoadScene(sceneName);
|
||||
}
|
||||
}
|
||||
11
Assets/Courses/Scripts/Webcam.cs.meta
Normal file
11
Assets/Courses/Scripts/Webcam.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a85f8bd9399680347b4be72850a56fcf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Courses/Videos.meta
Normal file
8
Assets/Courses/Videos.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e2ba56e4f21b5a148befc51b0728a725
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Courses/Videos/0.mp4
Normal file
BIN
Assets/Courses/Videos/0.mp4
Normal file
Binary file not shown.
18
Assets/Courses/Videos/0.mp4.meta
Normal file
18
Assets/Courses/Videos/0.mp4.meta
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf0807dbf3931c846951ab6ce07286f7
|
||||
VideoClipImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
frameRange: 0
|
||||
startFrame: -1
|
||||
endFrame: -1
|
||||
colorSpace: 0
|
||||
deinterlace: 0
|
||||
encodeAlpha: 0
|
||||
flipVertical: 0
|
||||
flipHorizontal: 0
|
||||
importAudio: 1
|
||||
targetSettings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Courses/Videos/1.mp4
Normal file
BIN
Assets/Courses/Videos/1.mp4
Normal file
Binary file not shown.
18
Assets/Courses/Videos/1.mp4.meta
Normal file
18
Assets/Courses/Videos/1.mp4.meta
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a387512265e5e747bd69194d90a9c76
|
||||
VideoClipImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
frameRange: 0
|
||||
startFrame: -1
|
||||
endFrame: -1
|
||||
colorSpace: 0
|
||||
deinterlace: 0
|
||||
encodeAlpha: 0
|
||||
flipVertical: 0
|
||||
flipHorizontal: 0
|
||||
importAudio: 1
|
||||
targetSettings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Courses/Videos/2.mp4
Normal file
BIN
Assets/Courses/Videos/2.mp4
Normal file
Binary file not shown.
18
Assets/Courses/Videos/2.mp4.meta
Normal file
18
Assets/Courses/Videos/2.mp4.meta
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c64e80628c275574aa425e17639b1c19
|
||||
VideoClipImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
frameRange: 0
|
||||
startFrame: -1
|
||||
endFrame: -1
|
||||
colorSpace: 0
|
||||
deinterlace: 0
|
||||
encodeAlpha: 0
|
||||
flipVertical: 0
|
||||
flipHorizontal: 0
|
||||
importAudio: 1
|
||||
targetSettings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Courses/Videos/3.mp4
Normal file
BIN
Assets/Courses/Videos/3.mp4
Normal file
Binary file not shown.
18
Assets/Courses/Videos/3.mp4.meta
Normal file
18
Assets/Courses/Videos/3.mp4.meta
Normal file
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e201d74a82223164684a7771abbbcfe0
|
||||
VideoClipImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
frameRange: 0
|
||||
startFrame: -1
|
||||
endFrame: -1
|
||||
colorSpace: 0
|
||||
deinterlace: 0
|
||||
encodeAlpha: 0
|
||||
flipVertical: 0
|
||||
flipHorizontal: 0
|
||||
importAudio: 1
|
||||
targetSettings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
39
Assets/Courses/Videos/Video-Render.renderTexture
Normal file
39
Assets/Courses/Videos/Video-Render.renderTexture
Normal file
@@ -0,0 +1,39 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!84 &8400000
|
||||
RenderTexture:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Video-Render
|
||||
m_ImageContentsHash:
|
||||
serializedVersion: 2
|
||||
Hash: 00000000000000000000000000000000
|
||||
m_ForcedFallbackFormat: 4
|
||||
m_DownscaleFallback: 0
|
||||
m_IsAlphaChannelOptional: 0
|
||||
serializedVersion: 5
|
||||
m_Width: 720
|
||||
m_Height: 360
|
||||
m_AntiAliasing: 1
|
||||
m_MipCount: -1
|
||||
m_DepthStencilFormat: 94
|
||||
m_ColorFormat: 8
|
||||
m_MipMap: 0
|
||||
m_GenerateMips: 1
|
||||
m_SRGB: 0
|
||||
m_UseDynamicScale: 0
|
||||
m_BindMS: 0
|
||||
m_EnableCompatibleFormat: 1
|
||||
m_TextureSettings:
|
||||
serializedVersion: 2
|
||||
m_FilterMode: 1
|
||||
m_Aniso: 0
|
||||
m_MipBias: 0
|
||||
m_WrapU: 1
|
||||
m_WrapV: 1
|
||||
m_WrapW: 1
|
||||
m_Dimension: 2
|
||||
m_VolumeDepth: 1
|
||||
m_ShadowSamplingMode: 2
|
||||
8
Assets/Courses/Videos/Video-Render.renderTexture.meta
Normal file
8
Assets/Courses/Videos/Video-Render.renderTexture.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 34d40204d22eba24c8cf05a135e6785e
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 8400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user