Files
Inter-Face-Off/Assets/Scripts/Windows/MovingWindow.cs
2026-01-15 11:17:27 +00:00

23 lines
692 B
C#

using UnityEngine;
namespace InterfaceOff
{
public class MovingWindow : WindowBase
{
public override void OnWindowInstantiation()
{
/* Adds a random advert to the display */
Components.WindowImage.sprite = AdvertRegistry.GetRandomAdvert();
Components.WindowImage.color = new Color(1, 1, 1, 1);
/* Calculates a random velocity direction */
float angle = Random.Range(0, Mathf.PI * 2);
Velocity = new Vector2(Mathf.Cos(angle), Mathf.Sin(angle)) * 100;
}
public override void OnWindowCloseButtonClicked()
{
Destroy(gameObject);
}
}
}