iTween.ConflictCheck C# (CSharp) Method

ConflictCheck() private method

private ConflictCheck ( ) : void
return void
    void ConflictCheck()
    {
        //if a new iTween is about to run and is of the same type as an in progress iTween this will destroy the previous if the new one is NOT identical in every way or it will destroy the new iTween if they are:
        Component[] tweens = GetComponents(typeof(iTween));
        foreach (iTween item in tweens) {
            if(item.type == "value"){
                return;
            }else if(item.isRunning && item.type==type){
                //cancel out if this is a shake or punch variant:
                if (item.method != method) {
                    return;
                }

                //step 1: check for length first since it's the fastest:
                if(item.tweenArguments.Count != tweenArguments.Count){
                    item.Dispose();
                    return;
                }

                //step 2: side-by-side check to figure out if this is an identical tween scenario to handle Update usages of iTween:
                foreach (DictionaryEntry currentProp in tweenArguments) {
                    if(!item.tweenArguments.Contains(currentProp.Key)){
                        item.Dispose();
                        return;
                    }else{
                        if(!item.tweenArguments[currentProp.Key].Equals(tweenArguments[currentProp.Key]) && (string)currentProp.Key != "id"){//if we aren't comparing ids and something isn't exactly the same replace the running iTween:
                            item.Dispose();
                            return;
                        }
                    }
                }

                //step 3: prevent a new iTween addition if it is identical to the currently running iTween
                Dispose();
                //Destroy(this);
            }
        }
    }
iTween