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