public static List <InputDescription> GetInputs(this BehaviourTask task)
        {
            var inputs = new List <InputDescription>();

            if (task == null)
            {
                return(inputs);
            }

            var type             = task.GetType();
            var serializedFields = type.GetSerializedFieldsUpToBase();

            foreach (var f in serializedFields)
            {
                if (f.FieldType.IsSubclassOf(typeof(InputBase)))
                {
                    var inputObject = (InputBase)f.GetValue(task);
                    var definition  = f.FieldType.GetGenericTypeDefinition();
                    var description = new InputDescription(inputObject.ValueType, definition == typeof(InputValue <>), f.Name, f.Name);
                    inputs.Add(description);
                }
            }

            return(inputs);
        }
Exemple #2
0
        private static bool CheckForNoEditor(BehaviourTask task)
        {
            if (task == null)
            {
                return(true);
            }
            if (task.GetType().GetCustomAttribute <NoInspectorAttribute>() != null)
            {
                return(true);
            }

            return(false);
        }