示例#1
0
        private void Add(object data)
        {
            var roster   = target as Roster;
            var species  = data as Species;
            var creature = Creature.Create(species);

            if (roster.Ecosystem.CreatureGenerationInstructions && (_context == null || !_context.IsRunning))
            {
                _context = new EcosystemInstructionContext(roster, "Edit Creature", null);
                EditorUpdater.StartCoroutine(creature.GenerateTraits(_context));
            }

            using (new UndoScope(roster))
            {
                Undo.RegisterCreatedObjectUndo(creature, "Undo create creature");
                roster.Creatures.Add(creature);
            }
        }
示例#2
0
        private void OnEnable()
        {
            var creature = target as Creature;

            Definitions.Instance.CreatureTraits.Apply(creature.Traits, true);
            creature.CleanUpSkills();

            _speciesProperty = serializedObject.FindProperty("Species");

            _context = new EcosystemInstructionContext(creature, "Edit Creature", null);
            _traits  = new VariableStoreControl(creature.Traits, "Traits", null, false, false, DrawTrait);
            var moves = _moves.Setup(creature.Moves, "Moves", "", false, true, false, true, true, DrawMove);

            _skills.Setup(creature.Species.Skills, "Skills", "", false, false, false, false, false, DrawSkill);

            moves.elementHeightCallback += GetMoveHeight;
            moves.onAddDropdownCallback += AddMove;

            _regenerate.image = EditorGUIUtility.IconContent("d_preAudioLoopOff").image;
            _apply.image      = EditorGUIUtility.IconContent("d_preAudioLoopOff").image;
        }
示例#3
0
 private void Awake()
 {
     Traits.Subscribe(this, null);
     _context = new EcosystemInstructionContext(this, Species.name, null);
 }