Rule:Invoke Node

From Intrigues Wiki
Revision as of 18:57, 9 February 2024 by Tayfunwiki (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

If the Age Check method returns true, the Rule completes as success.
This node executes all methods of the IResult type that are marked with the [IInvokeAttribute].
using UnityEngine;

namespace Nullframes.Intrigues.Demo
{
    public class Demo_Methods : MonoBehaviour
    {
        [IInvoke("Age Check")]
        private IResult AgeCheck(Actor conspirator, Actor target) {
            if (conspirator == null || target == null) return IResult.Null;

            // Checks the age difference. Returns False if the difference is greater than 7.
            if (Math.Abs(conspirator.Age - target.Age) > 7) {
                return IResult.False;
            }

            return IResult.True;
        }
    }
}

- The difference from the default version lies in the parameter used in the method.

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