Rule:Invoke Node

From Intrigues Wiki
Revision as of 17:53, 9 February 2024 by Tayfunwiki (talk | contribs) (Created page with "<b>Description</b><div class="description" style="padding-left:35px;">This node executes all methods of the <span style="color:#bf7552">'''IResult'''</span> type that are marked with the <span style="color:#bf7552">['''SchemeAttribute''']. </span></div> thumb|Invoke Node.gif thumb|Invoke Node.gif <syntaxhighlight lang="c#" line="1" start="1"> using UnityEngine; namespace Nullframes.Intrigues.Demo { public class Demo_Method...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

This node executes all methods of the IResult type that are marked with the [SchemeAttribute].
Invoke Node.gif
Invoke Node.gif
using UnityEngine;

namespace Nullframes.Intrigues.Demo
{
    public class Demo_Methods : MonoBehaviour
    {
        [Scheme("Conspirator Level Up")]
        private IResult LevelUp(Scheme scheme) {
            LevelComponent levelComponent = scheme.Conspirator.GetComponent<LevelComponent>();
            if (levelComponent != null) {
                levelComponent.LevelUp();
                return IResult.True; // Level is Up.
            }
            return IResult.Null; // LevelComponent not found.
        }
        
        [Scheme("Conspirator Level > 5")]
        private IResult LevelGreaterThanFive(Scheme scheme) {
            LevelComponent levelComponent = scheme.Conspirator.GetComponent<LevelComponent>();
            if (levelComponent != null) {
                if (levelComponent.Level > 5) {
                    return IResult.True; // Level greater than 5
                }
                return IResult.False; // Level lesser or equal than 5
            }
            return IResult.Null; // LevelComponent not found.
        }
    }
}

» The Invoke node runs the Method and continues the flow based on the returned value.