private static void CheckForRequiredComponents(GameObject go)
 {
     if (!FsmEditorSettings.CheckForRequiredComponent || go == null)
     {
         return;
     }
     object[] array = FsmErrorChecker.attributes;
     for (int i = 0; i < array.Length; i++)
     {
         Attribute attribute = (Attribute)array[i];
         CheckForComponentAttribute checkForComponentAttribute = attribute as CheckForComponentAttribute;
         if (checkForComponentAttribute != null)
         {
             FsmErrorChecker.CheckGameObjectHasComponent(go, checkForComponentAttribute.get_Type0());
             FsmErrorChecker.CheckGameObjectHasComponent(go, checkForComponentAttribute.get_Type1());
             FsmErrorChecker.CheckGameObjectHasComponent(go, checkForComponentAttribute.get_Type2());
         }
     }
 }
Beispiel #2
0
        private static void FindCheckForComponentAttribute(Type actionType, FieldInfo field)
        {
            CheckForComponentAttribute attribute = CustomAttributeHelpers.GetAttribute <CheckForComponentAttribute>(field);

            if (attribute != null)
            {
                if (attribute.get_Type0() != null)
                {
                    ActionTargets.AddActionTarget(actionType, new ActionTarget(attribute.get_Type0(), field.get_Name(), false));
                }
                if (attribute.get_Type1() != null)
                {
                    ActionTargets.AddActionTarget(actionType, new ActionTarget(attribute.get_Type1(), field.get_Name(), false));
                }
                if (attribute.get_Type2() != null)
                {
                    ActionTargets.AddActionTarget(actionType, new ActionTarget(attribute.get_Type2(), field.get_Name(), false));
                }
            }
        }