Hey,
One thing I noticed I was using a lot of nodes repeatedly for common tasks. And this made it harder to track down or update events.

So, I decided to combine some common nodes under one new custom node. And also provide a way to set these settings with presets. So, I would not have to update many game events if I changed my approach for something.

Unless I missed an easier way to do this in ORK(Happened many times :D), this seems like a good approach.

Here is an example I have cut down from my node I use. (I have a bunch of custom stuff in there)

To use it you have to create "GameflowSettingsStep" C# file in your project and paste this code inside.
You have two options here. You can use presets or custom settings.
Preset examples DialogueStart/End will Block player&camera control and fade screen in/out. (Have not tested preset fades).
Custom settings allow you to do all three the way you want.

With some coding experience and a bit of digging into the source code you can adapt this to your needs.
Hope this helps.
using UnityEngine;
using ORKFramework;
using ORKFramework.Menu;
using ORKFramework.Reflection;
using ORKFramework.Behaviours;
using System.Collections.Generic;
namespace ORKFramework.Events.Steps
{
[ORKEditorHelp("Gameflow Settings", "Gameflow Settings", "")]
[ORKEventStep(typeof(BaseEvent))]
[ORKNodeInfo("Animmal/Game")]
public class GameflowSettingsStep : BaseEventStep
{
public enum GAMEFLOWPRESETS { DialogueStart, DialogueEnd }

[ORKEditorLayout("CustomSettings", false, endCheckGroup = true, autoInit = true)]
public GAMEFLOWPRESETS Presets = GAMEFLOWPRESETS.DialogueStart;



[ORKEditorHelp("Use Custom Settings", "If enabled, custom settings will be used instead of preset", "")]
public bool CustomSettings = false;

[ORKEditorLayout("CustomSettings", true, endCheckGroup = true, autoInit = true)]
[ORKEditorHelp("Use Player Block", "If enabled, player block options will be applied", "")]
[ORKEditorInfo(separator = true)]
public bool UsePlayerBlock = false;
[ORKEditorLayout("UsePlayerBlock", true, endCheckGroup = true, autoInit = true)]
[ORKEditorHelp("Block/Unblock", "If enabled, the player control will be blocked.\n" +
"If disabled, the player control will be unblocked.", "")]
public bool PlayerBlock = false;


[ORKEditorLayout("CustomSettings", true, endCheckGroup = true, autoInit = true)]
[ORKEditorHelp("Use Camera Block", "If enabled, camera block options will be applied", "")]
[ORKEditorInfo(separator = true)]
public bool UseCameraBlock = false;
[ORKEditorLayout("UseCameraBlock", true, endCheckGroup = true, autoInit = true)]
[ORKEditorHelp("Block/Unblock", "If enabled, the camera control will be blocked.\n" +
"If disabled, the camera control will be unblocked.", "")]
public bool CameraBlock = false;


[ORKEditorLayout("CustomSettings", true, endCheckGroup = true, autoInit = true)]
[ORKEditorHelp("Use Fade", "If enabled, fade options will be applied", "")]
[ORKEditorInfo(separator = true)]
public bool UseFade = false;
[ORKEditorLayout("UseFade", true, endCheckGroup = true, autoInit = true)]
[ORKEditorHelp("Wait", "Wait until fading has finished before the next step is executed.", "")]
public bool wait = false;
[ORKEditorLayout("UseFade", true, endCheckGroup = true, autoInit = true)]
[ORKEditorInfo(separator = true)]
public FadeColorSettings FadeColor = new FadeColorSettings();


public GameflowSettingsStep()
{

}

public override void Execute(BaseEvent baseEvent)
{
if (CustomSettings == false)
{
FadeColorSettings _FadeColor = new FadeColorSettings();

switch (Presets)
{
case GAMEFLOWPRESETS.DialogueStart:
baseEvent.DoCameraBlock(1);
baseEvent.DoPlayerBlock(1);
_FadeColor.alpha = true;
_FadeColor.startColor = new Color(0, 0, 0, 0);
_FadeColor.endColor = new Color(0, 0, 0, 1);
ORK.GUI.ScreenFader.FadeScreen(_FadeColor);
wait = true;
break;
case GAMEFLOWPRESETS.DialogueEnd:
baseEvent.DoCameraBlock(0);
baseEvent.DoPlayerBlock(0);
_FadeColor.alpha = true;
_FadeColor.startColor = new Color(0, 0, 0, 1);
_FadeColor.endColor = new Color(0, 0, 0, 0);
ORK.GUI.ScreenFader.FadeScreen(_FadeColor);
wait = true;
break;
default:
break;
}
}
else
{
if (UseCameraBlock)
baseEvent.DoCameraBlock(this.CameraBlock ? 1 : -1);
if (UsePlayerBlock)
baseEvent.DoPlayerBlock(this.PlayerBlock ? 1 : -1);
if (UseFade)
ORK.GUI.ScreenFader.FadeScreen(this.FadeColor);
}

if (this.wait)
{
baseEvent.StartTime(this.FadeColor.time, this.next);
}
else
{
baseEvent.StepFinished(this.next);
}
}

/*
============================================================================
Node name functions
============================================================================
*/
public override string GetNodeDetails()
{
return "Gameflow Settings";
}
}
}




  • A different solution would be using a global event - ORK 2.28.0 allows you to set a starting object (actor) when using a Call Global Event node, in case you need to do it on different actors/objects/combatants :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.