Added info text
This commit is contained in:
@@ -2,6 +2,11 @@
|
||||
{
|
||||
public class BasicWindow : WindowBase
|
||||
{
|
||||
public override void OnWindowInstantiation()
|
||||
{
|
||||
Components.InfoText.text = "Close";
|
||||
}
|
||||
|
||||
public override void OnWindowClicked()
|
||||
{
|
||||
Destroy(gameObject);
|
||||
|
||||
@@ -17,10 +17,14 @@ namespace InterfaceOff
|
||||
|
||||
public override void OnWindowInstantiation()
|
||||
{
|
||||
Sprite[] sprites = CanvasManager.Instance.Images.GetRandomSpriteSet();
|
||||
/* Lets the player know what to do via text */
|
||||
Components.InfoText.text = "Rotate";
|
||||
|
||||
/* Creates the images to rotate */
|
||||
Sprite[] sprites = CanvasManager.Instance.Images.GetRandomSpriteSet();
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
/* Fetches/Creates needed components */
|
||||
GameObject go = Instantiate(CanvasManager.Instance.ImagePrefab, transform);
|
||||
RectTransform t = go.GetComponent<RectTransform>();
|
||||
|
||||
@@ -32,6 +36,7 @@ namespace InterfaceOff
|
||||
img.material = new Material(Shader.Find("UI/Default"));
|
||||
img.sprite = sprites[i];
|
||||
|
||||
/* Adds a function to the buttons for them to rotate */
|
||||
Button button = go.GetComponent<Button>();
|
||||
button.onClick.AddListener(() =>
|
||||
{
|
||||
@@ -54,7 +59,7 @@ namespace InterfaceOff
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
public override void OnWindowClicked()
|
||||
{
|
||||
if (m_TilesRotatedCorrectly == 4)
|
||||
{
|
||||
|
||||
@@ -4,17 +4,21 @@ namespace InterfaceOff
|
||||
{
|
||||
public class MovingWindow : WindowBase
|
||||
{
|
||||
private int m_Health = 5;
|
||||
private int m_Health = int.MaxValue;
|
||||
|
||||
public override void OnWindowInstantiation()
|
||||
{
|
||||
Components.WindowImage.color = Color.blue;
|
||||
/* Creates a random health value */
|
||||
m_Health = Random.Range(2, 6);
|
||||
Components.InfoText.text = $"{m_Health}";
|
||||
}
|
||||
|
||||
public override void OnWindowClicked()
|
||||
{
|
||||
/* Decreases health and destroys if at 0 */
|
||||
m_Health--;
|
||||
Components.InfoText.text = $"{m_Health}";
|
||||
|
||||
if (m_Health <= 0)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
|
||||
Reference in New Issue
Block a user