44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
![]() |
using BehaviorDesigner.Runtime;
|
||
|
using BehaviorDesigner.Runtime.Tasks;
|
||
|
using Sirenix.OdinInspector;
|
||
|
|
||
|
// ReSharper disable once CheckNamespace
|
||
|
namespace BlueWaterProject
|
||
|
{
|
||
|
[TaskCategory("Custom/Action")]
|
||
|
public class InitVariable : Action
|
||
|
{
|
||
|
[Title("Common variable")]
|
||
|
[RequiredField] public SharedAiStat aiStat;
|
||
|
[RequiredField] public SharedNavMeshAgent agent;
|
||
|
|
||
|
[Title("Offense variable")]
|
||
|
public SharedIslandInfo islandInfo;
|
||
|
public SharedBool isCommanded;
|
||
|
|
||
|
[Title("Defense variable")]
|
||
|
public SharedVector3 defensePos;
|
||
|
|
||
|
private AiController aiController;
|
||
|
|
||
|
public override void OnStart()
|
||
|
{
|
||
|
aiController = GetComponent<AiController>();
|
||
|
|
||
|
aiStat.Value = aiController.AiStat;
|
||
|
agent.Value = aiController.GetNavMeshAgent();
|
||
|
|
||
|
if (aiStat.Value.AttackerType == EAttackerType.OFFENSE)
|
||
|
{
|
||
|
islandInfo.Value = aiController.GetIslandInfo();
|
||
|
isCommanded.Value = aiController.IsCommanded;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public override TaskStatus OnUpdate()
|
||
|
{
|
||
|
return TaskStatus.Success;
|
||
|
}
|
||
|
}
|
||
|
}
|