Introduced Hangman in DEV-compatible branch
This commit is contained in:
committed by
Tibe Habils
parent
b5328d0b9d
commit
e23de9a2d3
62
Assets/Hangman/Scripts/HangManWebcam.cs
Normal file
62
Assets/Hangman/Scripts/HangManWebcam.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class HangManWebcam : WebCam
|
||||
{
|
||||
/// <summary>
|
||||
/// The display for player 1
|
||||
/// </summary>
|
||||
public RawImage display1;
|
||||
|
||||
/// <summary>
|
||||
/// The display for player 2
|
||||
/// </summary>
|
||||
public RawImage display2;
|
||||
|
||||
/// <summary>
|
||||
/// We use a different awake, since we dont want the camera to start immediatelly
|
||||
/// </summary>
|
||||
void Awake()
|
||||
{
|
||||
WebCamDevice device = WebCamTexture.devices[camdex];
|
||||
tex = new WebCamTexture(device.name);
|
||||
display.texture = tex;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hangman uses two different webcam_textures, we need to be able to toggle between them
|
||||
/// </summary>
|
||||
public void Switch_texture()
|
||||
{
|
||||
if(display == display1)
|
||||
{
|
||||
display = display2;
|
||||
}
|
||||
else
|
||||
{
|
||||
display = display1;
|
||||
}
|
||||
// Give the webcamTexture to the new webcam
|
||||
display.texture = tex;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scene changing is implemented here to avoid problems with webcam
|
||||
/// </summary>
|
||||
public new void GotoThemeSelection()
|
||||
{
|
||||
//minigameList.GetIndexInMinigameList(MinigameIndex.HANGMAN);
|
||||
if (tex != null)
|
||||
{
|
||||
if (tex.isPlaying)
|
||||
{
|
||||
display.texture = null;
|
||||
tex.Stop();
|
||||
tex = null;
|
||||
}
|
||||
}
|
||||
SystemController.GetInstance().BackToPreviousScene();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user