30 lines
866 B
C#
30 lines
866 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class GameHangManLetter : MonoBehaviour
|
|
{
|
|
char charThis;
|
|
public void SetLetter(char let)
|
|
{
|
|
charThis = let;
|
|
charThis = char.ToUpper(charThis);
|
|
transform.Find("txtLetter").GetComponent<Text>().text = charThis.ToString();
|
|
}
|
|
|
|
public void ChooseLetter()
|
|
{
|
|
if (GameObject.Find("ControllerHangMan").GetComponent<GameHangManModel>().ChooseLetter(charThis))
|
|
{
|
|
GameObject.Find("ControllerHangMan").GetComponent<GameHangManModel>().CreateSeparator(transform.GetSiblingIndex());
|
|
Destroy(gameObject);
|
|
}
|
|
else
|
|
{
|
|
Destroy(transform.GetChild(0).gameObject);
|
|
GetComponent<Image>().color = new Color(1f, .22f, .28f, 1);
|
|
}
|
|
}
|
|
}
|