Esempio n. 1
0
        public static IPropertyDescriptor GetOne(
            Type type,
            string name,
            BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.FlattenHierarchy | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetProperty | BindingFlags.SetProperty | BindingFlags.IgnoreCase
            )
        {
            IPropertyDescriptor ret = null;
            var nameParts           = name.Split('.');   // for example DateTime time, we can access time.TotalSeconds so we first find time, then we find TotalSeconds

            foreach (var namePart in nameParts)
            {
                if (ret == null)
                {
                    ret = GetOnePart(type, namePart, bindingFlags);
                    if (ret == null)
                    {
                        return(null);
                    }
                }
                else
                {
                    ret = new SequenceWrapper(ret, GetOnePart(ret.Type, namePart, bindingFlags));
                }
            }
            return(ret);
        }
Esempio n. 2
0
 /// <summary>
 /// Executes the FireTag as specified 
 /// </summary>
 /// <param name="param">Parameter.</param>
 public IEnumerator Run(params object[] param)
 {
     if(Global.Rank < minimumRank)
     {
         return false;
     }
     AbstractEnemy enemy = param [0] as AbstractEnemy;
     ActionAttackPattern pattern = param [1] as ActionAttackPattern;
     float floatParam = (param.Length > 2) ? (float)param [2] : 0.0f;
     SequenceWrapper prevRotation = new SequenceWrapper ();
     IEnumerator pause, actionEnumerator;
     if(actions != null && actions.Length > 0)
     {
         if(loopUntilEnd)
         {
             while(pattern.currentHealth > 0)
             {
                 foreach(Action action in actions)
                 {
                     pause = Global.WaitForUnpause();
                     while(pause.MoveNext())
                     {
                         yield return pause.Current;
                     }
                     actionEnumerator = action.Execute(enemy, pattern, floatParam, prevRotation);
                     while(actionEnumerator.MoveNext())
                     {
                         yield return actionEnumerator.Current;
                     }
                 }
                 float waitC = wait.Value;
                 if(waitC <= Time.fixedDeltaTime)
                 {
                     yield return new WaitForFixedUpdate();
                 }
                 else
                 {
                     float currentTime = 0f;
                     while(currentTime < waitC)
                     {
                         pause = Global.WaitForUnpause();
                         while(pause.MoveNext())
                         {
                             yield return pause.Current;
                         }
                         yield return new WaitForFixedUpdate();
                         currentTime += Time.fixedDeltaTime;
                     }
                 }
             }
         }
         else
         {
             foreach(Action action in actions)
             {
                 pause = Global.WaitForUnpause();
                 while(pause.MoveNext())
                 {
                     yield return pause.Current;
                 }
                 actionEnumerator = action.Execute(enemy, pattern, floatParam, prevRotation);
                 while(actionEnumerator.MoveNext())
                 {
                     yield return actionEnumerator.Current;
                 }
             }
         }
     }
 }