public SandwichSlice(SandwichVisual sandwich, Ingredient ingredient, int price, int index) { m_sandwich = sandwich; m_ingredient = ingredient; m_price = price; m_index = index; m_ingredientSprite = m_sandwich.AcquireSprite(); m_ingredientSprite.centerize(); if (index == 0) { m_ingredientSprite.setSpriteImage(ingredient.IngredientBottomSpriteName); } else { m_ingredientSprite.setSpriteImage(ingredient.IngredientSpriteName); } var size = Screen.width * 0.15f; var bottom = Screen.width * 0.1f; var offset = Screen.width * 0.02f; if (m_sandwich.IsTop) { m_ingredientSprite.setSize(size, -size); m_ingredientSprite.position = new Vector3(Screen.width * 0.55f, Screen.height - (bottom + index * offset), -(5.1f + 0.1f * index)); } else { m_ingredientSprite.setSize(size, size); m_ingredientSprite.position = new Vector3(Screen.width * 0.5f, bottom + index * offset, -(5.1f + 0.1f * index)); } if (price != 0) { m_tagSprite = m_sandwich.AcquireSprite(); m_tagSprite.centerize(); m_tagSprite.setSpriteImage(dicPrices[price]); //m_tagSprite.eulerAngles = new Vector3(0f, 0f, 180f / 15f * (float)index); m_tagSprite.eulerAngles = new Vector3(0f, 0f, Random.Range(-15f,15f)); if (m_sandwich.IsTop) { m_tagSprite.setSize(-Screen.width * 0.2f, -Screen.width * 0.1f); m_tagSprite.position = new Vector3(Screen.width * 0.85f, Screen.height - (bottom + index * offset), -(5.1f + 0.2f * index)); } else { m_tagSprite.setSize(Screen.width * 0.2f, Screen.width * 0.1f); m_tagSprite.position = new Vector3(Screen.width * 0.15f, bottom + index * offset, -(5.1f + 0.2f * index)); } } }