using System.Collections.Generic; using System.ComponentModel; using Godot; using Godot.Bridge; using Godot.NativeInterop; [GlobalClass] [ScriptPath("res://Scripts/Actions/WanderAround.cs")] public partial class WanderAround : IBehaviour { [Export(PropertyHint.None, "")] private float radius = 70f; [Export(PropertyHint.None, "")] private float speed = 0.8f; [Export(PropertyHint.None, "")] private float frequency = 120f; private float cd; private const int tries = 5; public override void Do() { if (!TextSystem.instance.Visible && base.parent.moving == null) { if (cd > 0f) { cd -= Main.deltaTime; return; } Vector2 target = base.parent.startPos + new Vector2(Mathf.Lerp(-1f, 1f, GD.Randf()), Mathf.Lerp(-1f, 1f, GD.Randf())) * radius; base.parent.DoAutoMove(target, speed); base.parent.moving.dontTP = true; cd = frequency; } } }