Пример #1
0
        private void AddNewGoalPartItem(WorldStateDescription _goalPart)
        {
            if (m_SelectedListItem is GoalListItem selectedGoalListItem)
            {
                GoalDescription selectedDescription = selectedGoalListItem.GetDescription();

                int newIndex = PuppeteerEditorHelper.Append(ref selectedDescription.GoalParts, _goalPart);

                WorldStateItem goalPartItem = CreateGoalPartItem(selectedDescription.GoalParts[newIndex]);

                m_SelectedListItem.MarkUnsavedChanges(true);
                AddUnsavedMarker();

                PuppeteerEditorHelper.UpdateSelectedWorldStateItem(ref m_SelectedGoalPartItem, goalPartItem);
            }
        }
Пример #2
0
        private void AddNewUtilityItem(UtilityDescription _utilityDescription)
        {
            if (m_SelectedListItem is GoalListItem selectedGoalListItem)
            {
                GoalDescription selectedDescription = selectedGoalListItem.GetDescription();

                int newIndex = PuppeteerEditorHelper.Append(ref selectedDescription.UtilityParts, _utilityDescription);

                WorkingMemoryUtilityItem utilityItem = CreateUtilityItem(selectedDescription.UtilityParts[newIndex]);

                m_SelectedListItem.MarkUnsavedChanges(true);
                AddUnsavedMarker();

                UpdateSelectedUtilityItem(utilityItem);
            }
        }
Пример #3
0
        private void AddNewWorldStateItem(VisualElement _targetContainer, WorldStateDescription _worldStateDescription)
        {
            if (m_SelectedListItem is ActionListItem selectedActionListItem)
            {
                ActionDescription selectedDescription = selectedActionListItem.GetDescription();

                WorldStateItem worldStateItem;

                if (_targetContainer == m_ActionConfigurator.EffectsContainer)
                {
                    int newIndex = PuppeteerEditorHelper.Append(ref selectedDescription.Effects, _worldStateDescription);
                    worldStateItem           = CreateWorldStateItem(selectedDescription.Effects[newIndex]);
                    worldStateItem.OnDelete += _item =>
                    {
                        PuppeteerEditorHelper.DeleteWorldStateItem(this, m_SelectedListItem as ActionListItem,
                                                                   ref (m_SelectedListItem as ActionListItem).GetDescription().Effects, _item, null);
                    };
                }
                else
                {
                    int newIndex = PuppeteerEditorHelper.Append(ref selectedDescription.Preconditions, _worldStateDescription);
                    worldStateItem           = CreateWorldStateItem(selectedDescription.Preconditions[newIndex]);
                    worldStateItem.OnDelete += _item =>
                    {
                        PuppeteerEditorHelper.DeleteWorldStateItem(this, m_SelectedListItem as ActionListItem,
                                                                   ref (m_SelectedListItem as ActionListItem).GetDescription().Preconditions, _item, null);
                    };
                }

                _targetContainer.Add(worldStateItem);

                m_SelectedListItem.MarkUnsavedChanges(true);
                AddUnsavedMarker();

                PuppeteerEditorHelper.UpdateSelectedWorldStateItem(ref m_SelectedWorldStateItem, worldStateItem);
            }
        }