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; }