edited August 2024 in ORK Scripting
namespace GamingIsLove.ORKFramework.AI.Nodes {
using GamingIsLove.Makinom;
using GamingIsLove.ORKFramework;
using GamingIsLove.ORKFramework.AI;
using UnityEngine;

[EditorHelp("Check Contain", "A value (e.g. result of a formula) will be checked with a defined value.\n" +
"If the check is valid, 'Success' will be executed next, otherwise 'Failed'.", "")]
[NodeInfo("Base", "Variable", "Check")]
public class CheckContainNode : BaseAICheckNode
{
[EditorHelp("Value", "The value that will be checked.", "")]
public FloatValue<BattleAIObjectSelection> value = new FloatValue<BattleAIObjectSelection>();

[EditorHelp("Check Type", "Checks if the value is equal, not equal, less or greater than a defined value.\n" +
"Range inclusive checks if the value is between two defined values, including the values.\n" +
"Range exclusive checks if the value is between two defined values, excluding the values.\n" +
"Approximately checks if the value is similar to the defined value.", "")]
[EditorSeparator]
public ValueCheck<BattleAIObjectSelection> check = new ValueCheck<BattleAIObjectSelection>();

public CheckContainNode()
{

}

public override BaseAction Execute(ref int currentNode, BattleAICall call)
{
if(this.check.Check(this.value.GetValue(call), call))
{
currentNode = this.next;
}
else
{
currentNode = this.nextFail;
}
return null;
}


/*
============================================================================
Node name functions
============================================================================
*/
public override string GetNodeDetails()
{
return this.value.ToString() + " " + this.check.ToString();
}

public override Color EditorColor
{
get { return Maki.EditorSettings.valueNodeColor; }
}
}


}
Post edited by joywayer on
  • This code is for a battle AI node.

    Schematic nodes are in the GamingIsLove.ORKFramework.Schematics.Nodes namespace and derive from either the BaseSchematicNode or BaseSchematicCheckNode classes.
    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.