Пример #1
0
 GameObject CreateActionFromData(StoryActionData sad, System.Action actionActivated)
 {
     if (sad.actionType == StoryActionData.ActionType.Skill)
     {
         return(CreateSkillStoryActionVisuals(CreateSkillStoryAction(sad), actionActivated));
     }
     else
     {
         return(CreateStoryActionVisuals(sad, actionActivated));
     }
 }
Пример #2
0
    GameObject CreateStoryActionVisuals(StoryActionData data, System.Action actionActivated)
    {
        var actionGO = GameObject.Instantiate(PrefabGetter.storyActionPrefab) as GameObject;
        var visuals  = actionGO.GetComponent <StoryActionVisuals>();

        visuals.restrictions = data.restrictions.ConvertAll(r => r.Create(playerCharacter.GetCharacter()));
        visuals.Setup(data.storyDescription, data.gameplayDescription);
        visuals.ActivatedEvent += actionActivated;
        if (data.successMessage != "")
        {
            visuals.FinishedEvent += () => textArea.AddLine(data.successMessage);
        }
        visuals.actionEvents = data.successEvents.ConvertAll(ae => ae.Create());

        return(actionGO);
    }
Пример #3
0
    SkillStoryAction CreateSkillStoryAction(StoryActionData actionData)
    {
        var sa = DesertContext.StrangeNew <SkillStoryAction>();

        sa.skill            = actionData.skill;
        sa.difficulty       = actionData.difficulty;
        sa.storyDescription = actionData.storyDescription;
        sa.gameDescription  = actionData.gameplayDescription;
        sa.successMessage   = actionData.successMessage;
        sa.failMessage      = actionData.failedMessage;
        sa.successEvents    = actionData.successEvents.ConvertAll(ae => ae.Create());
        sa.failEvents       = actionData.failEvents.ConvertAll(ae => ae.Create());
        sa.restrictions     = actionData.restrictions.ConvertAll(r => r.Create(playerCharacter.GetCharacter()));

        return(sa);
    }
Пример #4
0
    public override void OnInspectorGUI()
    {
        storyAction = target as StoryActionData;

        storyAction.actionType = (StoryActionData.ActionType)EditorGUILayout.EnumPopup("Action Type", storyAction.actionType);
        ShowDescriptions();
        ShowRestrictions();

        if (storyAction.actionType == StoryActionData.ActionType.Skill)
        {
            ShowSkillActionData();
        }

        else if (storyAction.actionType == StoryActionData.ActionType.Immediate)
        {
            ShowImmediateActionData();
        }

        EditorUtility.SetDirty(storyAction);
    }
Пример #5
0
 void DestroyAction(StoryActionData data)
 {
     GameObject.DestroyImmediate(data, true);
 }