/// <summary> /// 设置需要移动到的位置 /// </summary> /// <param name="x"></param> /// <param name="y"></param> public void SetPosition(float x, float y) { Image img = this.gameObject.GetComponent <Image>(); Vector2 vec2 = new Vector2(x, y); img.rectTransform.anchoredPosition = vec2; this.swapAnimotionOption = new SwapAnimotionOption(vec2); }
void Start() { Image img = this.gameObject.GetComponent <Image>(); this.swapAnimotionOption = new SwapAnimotionOption(img.rectTransform.anchoredPosition); }