public static GameObject Create(string text, Vector2 screenPosition, Color color) { GameObject prefab = CasualEngine.Get <RavenhillEngine>().GetService <IResourceService>().GetCachedPrefab("screen_text"); GameObject instance = Instantiate <GameObject>(prefab); instance.GetComponent <ScreenText>().Setup(new Data { text = text, color = color, screenPosition = screenPosition }); return(instance); }
public static DropObject Create(DropItem dropItem, Transform sourceTransform = null) { GameObject prefab = CasualEngine.Get <RavenhillEngine>() .GetService <IResourceService>() .Cast <RavenhillResourceService>() .GetCachedPrefab("drop_object"); GameObject instance = GameObject.Instantiate <GameObject>(prefab); CanvasService canvasService = CasualEngine.Get <RavenhillEngine>() .GetService <ICanvasSerive>() .Cast <CanvasService>(); canvasService.AddToFirstGroup(instance.transform); DropObject dropObject = instance.GetComponent <DropObject>(); dropObject.Setup(dropItem, sourceTransform); return(dropObject); }
public static void SetListener(this Button button, UnityAction action) { button.SetListener(action, CasualEngine.Get <RavenhillEngine>().GetService <IAudioService>()); }
public static void SetListener(this Toggle toggle, UnityAction <bool> action) { toggle.SetListener(action, CasualEngine.Get <RavenhillEngine>().GetService <IAudioService>()); }