//Binding Code to A Generic Type public override void initState <T>(SBObservable <T> model) { //Translate Data model.dataUpdated += (T obj) => { //Ugly type casting, but know a better way? Texture2D newT2 = (Texture2D)(object)obj; Image.sprite = Sprite.Create(newT2, new Rect(0.0f, 0.0f, newT2.width, newT2.height), new Vector2(0.5f, 0.5f), 100.0f); }; }
// JUST FOR TESETING public IEnumerator TakeSnapshot(int width, int height, SBObservable <Texture2D> store) { yield return(new WaitForSeconds(4.1F)); yield return(new WaitForEndOfFrame()); Texture2D texture = new Texture2D(width, height, TextureFormat.RGB24, true); texture.ReadPixels(new Rect(0, 0, width, height), 0, 0); texture.Apply(); store.Data = texture; }
public abstract void initState <T>(SBObservable <T> model);
public void registerStore <T>(SBObservable <T> newStore, SBStateName stateName) { sbStores.Add(stateName, newStore); }