Esempio n. 1
0
            private void CreateVariable(VariableSchema schema, string name, VariableType type)
            {
                var names      = schema.Definitions.Select(value => value.Name).ToArray();
                var uniqueName = ObjectNames.GetUniqueName(names, name);

                schema.AddDefinition(uniqueName, type);
            }
Esempio n. 2
0
        public override void Setup(SerializedProperty property, FieldInfo fieldInfo)
        {
            Schema = GetObject <VariableSchema>(property);
            Values = new EditableList <VariableValue>();

            var values = Values.Setup(Schema.Definitions, Schema.Name, EditorHelper.GetTooltip(fieldInfo), true, true, false, true, true, DrawValue, RemoveValue);

            values.onAddDropdownCallback += AddValueDropdown;
        }
Esempio n. 3
0
        private void AddAbility(Ecosystem ecosystem, string name, VariableSchema schema)
        {
            var ability       = CreateInstance <Ability>();
            var existingNames = ecosystem.Abilities.Select(i => i.name).ToArray();

            ability.hideFlags = HideFlags.HideInHierarchy;
            ability.name      = ObjectNames.GetUniqueName(existingNames, name);
            ability.Ecosystem = ecosystem;

            if (schema != null)
            {
                schema.Apply(ability.Traits, false);
            }

            using (new UndoScope(ecosystem))
            {
                ecosystem.Abilities.Add(ability);

                Undo.RegisterCreatedObjectUndo(ability, "Undo create ability");
                AssetDatabase.AddObjectToAsset(ability, ecosystem);
                AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(ecosystem));
            }
        }
Esempio n. 4
0
 public AddPopup(VariableSchema schema)
 {
     _schema = schema;
 }