Made harry rotate
This commit is contained in:
@@ -36,10 +36,25 @@ namespace InterfaceOff
|
||||
|
||||
t.sizeDelta = new Vector2(80, 80);
|
||||
t.localPosition = Positions[i];
|
||||
t.eulerAngles = new Vector3(0, 0, Random.Range(0, 4) * 90);
|
||||
|
||||
Image img = go.GetComponent<Image>();
|
||||
img.material = new Material(Shader.Find("UI/Default"));
|
||||
img.sprite = sprites[i];
|
||||
|
||||
Button button = go.GetComponent<Button>();
|
||||
button.onClick.AddListener(() =>
|
||||
{
|
||||
RectTransform rect = button.GetComponent<RectTransform>();
|
||||
|
||||
if (!(rect.rotation.eulerAngles.z < 45 && rect.rotation.eulerAngles.z > -45))
|
||||
{
|
||||
Vector3 rot = rect.rotation.eulerAngles;
|
||||
rot += new Vector3(0, 0, 90);
|
||||
|
||||
rect.rotation = Quaternion.Euler(rot);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user