private void SetPresentStartSprites(RepeatLevelClass level) { foreach (var item in level.Answers) { var go = GameObject.Find(item.Key); SpriteRenderer spriteRndr = go.GetComponent <SpriteRenderer>(); spriteRndr.sprite = this.present; Vector3 pos = GameManegmentHelper.gameTwoPresentsStartPosition.ContainsKey(go.name) ? GameManegmentHelper.gameTwoPresentsStartPosition[go.name] : new Vector3(); GameManegmentHelper.SetObjectPosition(go, pos); } }
private IEnumerator YieldingUpdateSprites(KeyValuePair <string, KeyValuePair <string, bool> > item) { bool workDone = false; while (!workDone) { // Let the engine run for a frame. yield return(null); var go = GameObject.Find(item.Key); SpriteRenderer spriteRndr = go.GetComponent <SpriteRenderer>(); spriteRndr.sprite = this.present; Vector3 pos = GameManegmentHelper.gameTwoPresentsStartPosition.ContainsKey(go.name) ? GameManegmentHelper.gameTwoPresentsStartPosition[go.name] : new Vector3(); GameManegmentHelper.SetObjectPosition(go, pos); workDone = true; // Do Work... } }