I've been using iTween for a while now with really good results. There is one little aspect that is bugging me off.
I'm making a bejeweled clone, and my issue is with a certain mechanic: You choose one jewel, then another jewel and they swap places. If no matches are found, they return to their places.
What I do when moving them is call this function on each selected jewel:
public void swapTo(Vector3 dest, bool b){
b_Swapping = true;
iTween.MoveTo(gameObject, iTween.Hash("position", dest, "easetype","linear", "time", 0.5, "oncomplete", "onMoveComplete"));
}
That MoveTo calls to onMoveComplete when, you guessed it, it finishes.
private void onMoveComplete(){
b_Selected = false;
b_Swapping = false;
OT_spr.alpha = 1.0f;
updateRects();
Debug.Log(i_index + " move complete");
}
Then my "JewelManager" class checks for the surrounding jewels and possible matches, and if neither of them have matches, it calls "returnToOrigin" with the other jewel's position:
public void returnToOrigin(Vector2 v2){
b_Swapping = true;
iTween.MoveTo(gameObject, iTween.Hash("position", v2, "time", 0.5, "oncomplete", "onMoveComplete"));
Debug.Log(i_index + " should be moving");
}
Both oncomplete calls trigger by showing the "move complete" dialog. But the MoveTo() in returnToOrigin() doesn't visually act. iTween executes the action but doesn't actually move the jewels.
I'm now asking after constantly checking the correct positions, even used iTween.Stop() just in case, to no avail.
Am I missing something or is this a bug?
Thanks in advance! :)
↧