本文整理汇总了C#中UISprite.centerize方法的典型用法代码示例。如果您正苦于以下问题:C# UISprite.centerize方法的具体用法?C# UISprite.centerize怎么用?C# UISprite.centerize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UISprite
的用法示例。
在下文中一共展示了UISprite.centerize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SandwichSlice
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));
}
}
}