public override CommandStub GenerateCommand(GameQuery_Command commandQuery) { Entity target = commandQuery.ArenaState.Player; var targetPos = target.TryGetPosition(); if (this.lastPath == null || !this.EnemyOnPath(targetPos)) { this.lastPath = Action_MoveTowardsEnemy.GeneratePath(commandQuery, targetPos); } return(this.MoveEventForPath(commandQuery, this.lastPath)); }
private CommandStub MoveEventForPath(GameQuery_Command commandQuery, RogueSharp.Path path) { var commandPos = commandQuery.CommandEntity.TryGetPosition(); var nextCell = path.CurrentStep; if (path.CurrentStep != path.End) { path.StepForward(); } return(new CommandStub_MoveSingle(commandQuery.CommandEntity.EntityID, nextCell.X - commandPos.X, nextCell.Y - commandPos.Y)); }
public override CommandStub GenerateCommand(GameQuery_Command commandQuery) { Entity target = commandQuery.FloorState.Player; var targetPos = target.TryGetPosition(); // TODO: Lol wtf if (commandQuery.CommandEntity.TryGetPosition().Z != targetPos.Z) { return(new CommandStub_Delay(commandQuery.CommandEntity.EntityID, Config.ONE)); } if (this.lastPath == null || !this.EnemyOnPath(targetPos)) { this.lastPath = Action_MoveTowardsEnemy.GeneratePath(commandQuery, targetPos); } return(this.MoveEventForPath(commandQuery, this.lastPath)); }