Nav Mesh Agent Get Area Cost#
Navigation / Nav Mesh Agent / Nav Mesh Agent Get Area Cost
Description#
Compares the Get Area Cost method of Nav Mesh Agent component to another value
Parameters#
| Name | Description |
|---|---|
| Nav Mesh Agent | |
| Area Index | |
| Compare | |
| Value |
Code#
// <auto-generated>
// This script was automatically generated using the Visual Script Transpiler.
// Do not modify. Changes to this file will be lost when updating the package.
// </auto-generated>
using System;
using UnityEngine;
using VisualScript.Icons;
using UnityEngine.AI;
namespace VisualScript.Runtime
{
[Title("Nav Mesh Agent Get Area Cost")]
[Category("Navigation/Nav Mesh Agent/Get Area Cost")]
[Description("Compares the Get Area Cost method of Nav Mesh Agent component to another value")]
[Image(typeof(IconNavmeshAgent), ColorTheme.Type.Red)]
[Keywords("Navigation, NavMesh, AI, Pathfinding, Agent")]
[Parameter("Nav Mesh Agent")]
[Parameter("Area Index")]
[Parameter("Compare")]
[Parameter("Value")]
[Serializable]
public class GenConditionNumber_NavMeshAgent_CheckGetAreaCost_1 : Condition
{
[SerializeField] private GetGameObject m_NavMeshAgent = new GetGameObject(
new GenTypeGameObject_NavMeshAgent()
);
[SerializeField] private CompareNumber m_Compare = new CompareNumber();
[SerializeField] private GetNumber m_Value = new GetNumber();
[SerializeField] private GetInteger m_AreaIndex = new GetInteger();
protected override string GetTitle(GameObject source)
{
string method = TextUtils.ThemeAsKeyword("Get Area Cost");
string parameters = $"({this.m_AreaIndex})";
return $"{this.m_NavMeshAgent} {method} {this.m_Compare} {this.m_Value}";
}
protected override bool Run(Args args)
{
NavMeshAgent component = this.m_NavMeshAgent.Get<NavMeshAgent>(args);
if (component == null) return false;
float value = component.GetAreaCost(
(int) this.m_AreaIndex.Get(args)
);
return this.m_Compare.Compare(value, (float) this.m_Value.Get(args));
}
}
}