/*** * Animates the swapping process for two runes. * * @param r1 The first rune to be swapped. This one will be on top. * @param r2 The second rune to be swapped. */ void AnimateRuneSwap(Rune r1, Rune r2) { // Set the sorting layer on both runes to make sure they do not clip and the swap looks clean r1.ToggleGlow(false); r1.BringToFront(); r2.BringToBack(); Vector3 posRune1 = new Vector3(r1.coords.x, r1.coords.y, 0.0f); Vector3 posRune2 = new Vector3(r2.coords.x, r2.coords.y, 0.0f); iTween.MoveTo(r1.gameObject, iTween.Hash("position", posRune2, "time", 0.3f, "easeType", "linear")); iTween.MoveTo(r2.gameObject, iTween.Hash("position", posRune1, "time", 0.3f, "easeType", "linear", "oncomplete", "OnSwapCompleted", "oncompletetarget", this.gameObject, "oncompleteparams", r2)); PlaySound(SoundClips.Swap); }