Invoke Node: Difference between revisions
Tayfunwiki (talk | contribs) No edit summary |
Tayfunwiki (talk | contribs) No edit summary |
||
Line 3: | Line 3: | ||
[[File:Invoke-2.gif|thumb|Invoke Node.gif]] | [[File:Invoke-2.gif|thumb|Invoke Node.gif]] | ||
<syntaxhighlight lang="c#" line="1" start="1"> | <syntaxhighlight lang="c#" line="1" start="1"> | ||
using UnityEngine; | using UnityEngine; | ||
Line 12: | Line 11: | ||
[Scheme("Conspirator Level Up")] | [Scheme("Conspirator Level Up")] | ||
private IResult LevelUp(Scheme scheme) { | private IResult LevelUp(Scheme scheme) { | ||
LevelComponent levelComponent = scheme.Conspirator.GetComponent<LevelComponent>(); | LevelComponent levelComponent = scheme.Conspirator.GetComponent<LevelComponent>(); | ||
if (levelComponent != null) { | if (levelComponent != null) { | ||
levelComponent.LevelUp(); | levelComponent.LevelUp(); | ||
return IResult.True; | return IResult.True; // Level is Up. | ||
} | } | ||
return IResult.Null; | return IResult.Null; // LevelComponent not found. | ||
} | } | ||
[Scheme("Conspirator Level > 5")] | [Scheme("Conspirator Level > 5")] | ||
private IResult LevelGreaterThanFive() { | private IResult LevelGreaterThanFive() { | ||
LevelComponent levelComponent = scheme.Conspirator.GetComponent<LevelComponent>(); | LevelComponent levelComponent = scheme.Conspirator.GetComponent<LevelComponent>(); | ||
if (levelComponent != null) { | if (levelComponent != null) { | ||
levelComponent. | if (levelComponent.Level > 5) { | ||
return IResult. | return IResult.True; // Level greater than 5 | ||
} | |||
return IResult.False; // Level lesser or equal than 5 | |||
} | } | ||
return IResult.Null; | return IResult.Null; // LevelComponent not found. | ||
} | } | ||
} | } | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 19:30, 14 December 2023
Description
[SchemeAttribute] ile işaretlenmiş IResult türünde ki bütün methodları çalıştırır.
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() {
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.
}
}
}