本文整理匯總了C#中UnityEngine.RectTransform.SetAsFirstSibling方法的典型用法代碼示例。如果您正苦於以下問題:C# RectTransform.SetAsFirstSibling方法的具體用法?C# RectTransform.SetAsFirstSibling怎麽用?C# RectTransform.SetAsFirstSibling使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UnityEngine.RectTransform
的用法示例。
在下文中一共展示了RectTransform.SetAsFirstSibling方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: MakeRipple
public void MakeRipple (int size, float animSpeed, float startAlpha, float endAlpha, Color color, Vector3 endPosition)
{
// Get references to components
thisImage = gameObject.GetComponent<Image> ();
thisRect = gameObject.GetComponent<RectTransform> ();
// Sets the ink blot to draw behind all other siblings (text, icon etc)
thisRect.SetAsFirstSibling ();
thisRect.sizeDelta = new Vector2 (size * 1.5f, size * 1.5f);
thisRect.localScale = new Vector3(0f, 0f, 1f);
if (gameObject.GetComponentInParent<MaterialUIScaler> ())
scaledSize = Mathf.RoundToInt(gameObject.GetComponentInParent<MaterialUIScaler>().scaleFactor * size);
else
scaledSize = size;
if (scaledSize <= 64 && im64px)
thisImage.sprite = im64px;
else if (scaledSize <= 128 && im128px)
thisImage.sprite = im128px;
else if (scaledSize <= 256 && im256px)
thisImage.sprite = im256px;
else if (scaledSize <= 384 && im384px)
thisImage.sprite = im384px;
else if (scaledSize <= 512 && im512px)
thisImage.sprite = im512px;
else if (scaledSize <= 640 && im640px)
thisImage.sprite = im640px;
else if (scaledSize <= 768 && im768px)
thisImage.sprite = im768px;
else if (scaledSize <= 896 && im896px)
thisImage.sprite = im896px;
else if (im1024px)
thisImage.sprite = im1024px;
tempColor = color;
tempColor.a = startAlpha;
thisImage.color = tempColor;
if (endPosition != new Vector3 (0, 0, 0))
{
moveTowardCenter = true;
endPos = endPosition;
}
// thisRect.localPosition = new Vector3 (thisRect.localPosition.x, thisRect.localPosition.y, 0f);
startPos = thisRect.position;
startColorAlpha = startAlpha;
endColorAlpha = endAlpha;
animationSpeed = animSpeed;
state = 1;
animStartTime = Time.realtimeSinceStartup;
animFirstStartTime = animStartTime;
}