namespace Game { public partial class AIEntityBase : AIObjectBase where T : new() { protected void MoveTo() { _moveTo("向前移动", true, 0.6f, 45, 0); } protected void MoveAroundTo() { _moveTo("向前环绕", true, 1, 180, 90); } protected void MoveAround() { _moveTo("横向环绕", true, 1, 180, 120); } private void _moveTo(string name, bool toward, float randChance, float randAngle, float forbidAngle) { Do(name, () => { var target = Util.GetEntity(_entity.Target()); var dir = target.Pos() - _entity.Pos(); if (GameRandom.Roll(randChance)) { dir = GameRandom.RandomDir(dir, randAngle, forbidAngle); } Util.EntityMove(_entity.ID(), dir); return ETaskStatus.Success; }); } private void _stop() { Do($"停止移动", () => { Util.EntityStopMove(_entity.ID()); return ETaskStatus.Success; }); } } }