public void ChooseSprite(FeedBackImage fbi) { int index = (int) fbi; rend = GetComponent<SpriteRenderer>(); rend.sprite = sprites [index]; //pra não ter que pensar muito nisso direction -= 2 * index; }
void CallFeedback(FeedBackImage fbi) { Vector3 pos = new Vector3(Random.Range(0, screenSize.x/2) - screenSize.x/4, -1.0f); GameObject fee = (GameObject)Instantiate (feedBack, pos, Quaternion.identity); Feedback feedbackScript = fee.GetComponent<Feedback> (); feedbackScript.ChooseSprite (fbi); Destroy (fee, feedTime); }