Made harry rotate

This commit is contained in:
2026-01-14 11:15:38 +00:00
parent 9236ef6d95
commit 441f738456
2 changed files with 60 additions and 0 deletions

View File

@@ -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);
}
});
}
}
}