35 lines
832 B
C#
35 lines
832 B
C#
using Godot;
|
|
using System;
|
|
|
|
[Tool]
|
|
public partial class OkToPlayMobilePhone : BTCondition
|
|
{
|
|
[Export]
|
|
public StringName target;
|
|
|
|
public override Status _Tick(double delta)
|
|
{
|
|
Student student = Agent as Student; // Cast the agent to a Student object
|
|
if (student == null) return Status.Failure;
|
|
|
|
if (student.State == Student.CharacterState.Idle) {
|
|
return Status.Success;
|
|
}
|
|
|
|
if (student.State == Student.CharacterState.Sitting && student.TargetDirection == Student.Direction.Down) {
|
|
return Status.Success;
|
|
}
|
|
|
|
return Status.Failure;
|
|
}
|
|
public override string[] _GetConfigurationWarnings()
|
|
{
|
|
return Array.Empty<string>();
|
|
}
|
|
|
|
public override string _GenerateName()
|
|
{
|
|
return "OkToPlayMobilePhone";
|
|
}
|
|
}
|