Beispiel #1
0
    public void StartAnimation(GameObject _gameObject)
    {
//		if (gameObject == null)
//			gameObject = _gameObject;
        if (gameObject.GetComponent <iTween> () == null)
        {
            iTween.MoveTo(gameObject, gameObject.transform.position, 0);
        }
        Type mytype = typeof(iTweenAnimation);

        FieldInfo[] myFields = mytype.GetFields();
        iTween      itween   = gameObject.GetComponent <iTween> ();
        Hashtable   hash     = new Hashtable();

//		foreach (MyHashObject item in table) {
//			hash.Add (item.Key, getValue (item));
//		}

        for (int i = 0; i < myFields.Length; i++)
        {
            hash.Add(myFields [i].Name, myFields [i].GetValue(this));
        }

        object[] parameters = new object[2];
        parameters [0] = gameObject;
        parameters [1] = hash;
        MethodInfo theMethod = itween.GetType().GetMethod(animation.ToString(), new Type[] {
            typeof(GameObject),
            typeof(Hashtable)
        });

//		Debug.Log (theMethod);
        theMethod.Invoke(this, parameters);
    }