Rule:Invoke Node: Difference between revisions
Tayfunwiki (talk | contribs) No edit summary |
Tayfunwiki (talk | contribs) No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
<b>Description</b><div class="description" style="padding-left:35px;">[[File:Rule-Invoke Node.png|thumb|If the Age Check method returns true, the Rule completes as success.]]This node executes all methods of the <span style="color:#bf7552">'''IResult'''</span> type that are marked with the <span style="color:#bf7552">[''' | <b>Description</b><div class="description" style="padding-left:35px;">[[File:Rule-Invoke Node.png|thumb|If the Age Check method returns true, the Rule completes as success.]]This node executes all methods of the <span style="color:#bf7552">'''IResult'''</span> type that are marked with the <span style="color:#bf7552">['''IInvokeAttribute''']. </span></div> | ||
<syntaxhighlight lang="c#" line="1" start="1"> | <syntaxhighlight lang="c#" line="1" start="1"> | ||
using UnityEngine; | using UnityEngine; | ||
Line 7: | Line 7: | ||
public class Demo_Methods : MonoBehaviour | public class Demo_Methods : MonoBehaviour | ||
{ | { | ||
[ | [IInvoke("Age Check")] | ||
private IResult | private IResult AgeCheck(Actor conspirator, Actor target) { | ||
if (conspirator == null || target == null) return IResult.Null; | |||
if ( | |||
// Checks the age difference. Returns False if the difference is greater than 7. | |||
return IResult. | if (Math.Abs(conspirator.Age - target.Age) > 7) { | ||
return IResult.False; | |||
} | } | ||
return IResult.True; | |||
} | } | ||
} | } | ||
} | } | ||
</syntaxhighlight>'''- The difference from the default version lies in the parameter used in the method.'''<blockquote>» The <span style="color:#bf7552">'''Invoke'''</span> node runs the <span style="color:#bf7552">'''Method'''</span> and continues the flow based on the <span style="color:#bf7552">'''returned'''</span> value.</blockquote> | </syntaxhighlight>'''- The difference from the default version lies in the parameter used in the method.'''<blockquote>» The <span style="color:#bf7552">'''Invoke'''</span> node runs the <span style="color:#bf7552">'''Method'''</span> and continues the flow based on the <span style="color:#bf7552">'''returned'''</span> value.</blockquote> |
Latest revision as of 17:57, 9 February 2024
Description
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.