Made image buttons get destroyed when done
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace InterfaceOff
|
||||
|
||||
@@ -24,6 +24,8 @@ namespace InterfaceOff
|
||||
new(-45, -45),
|
||||
new(45f, -45)
|
||||
};
|
||||
|
||||
private int m_TilesRotatedCorrectly;
|
||||
|
||||
public override void OnWindowInstantiation()
|
||||
{
|
||||
@@ -36,7 +38,7 @@ namespace InterfaceOff
|
||||
|
||||
t.sizeDelta = new Vector2(80, 80);
|
||||
t.localPosition = Positions[i];
|
||||
t.eulerAngles = new Vector3(0, 0, Random.Range(0, 4) * 90);
|
||||
t.eulerAngles = new Vector3(0, 0, Random.Range(1, 4) * 90);
|
||||
|
||||
Image img = go.GetComponent<Image>();
|
||||
img.material = new Material(Shader.Find("UI/Default"));
|
||||
@@ -54,8 +56,22 @@ namespace InterfaceOff
|
||||
|
||||
rect.rotation = Quaternion.Euler(rot);
|
||||
}
|
||||
|
||||
if (rect.rotation.eulerAngles.z < 45 && rect.rotation.eulerAngles.z > -45)
|
||||
{
|
||||
m_TilesRotatedCorrectly++;
|
||||
button.interactable = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (m_TilesRotatedCorrectly == 4)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user