private static RogueSharp.Path GeneratePath(GameQuery_Command commandQuery, GameQuery_Position targetPos) { // TODO: Wow this is awkward!? var commandPos = commandQuery.CommandEntity.TryGetPosition(); var commandCell = commandQuery.ArenaState.ArenaMap.GetCell(commandPos.X, commandPos.Y); var targetCell = commandQuery.ArenaState.ArenaMap.GetCell(targetPos.X, targetPos.Y); return(commandQuery.ArenaState.ShortestPath(commandCell, targetCell)); }
public void DeterminePatrolPath(ArenaState state, IRandom rand) { this.PatrolStart = this.Parent.TryGetPosition(); var cells = state.WalkableCells(); Cell cell = rand.RandomElement(cells); while (Config.MinPatrolDistance < ArenaState.DistanceBetweenPositions(this.PatrolStart.X, this.PatrolStart.Y, cell.X, cell.Y)) { cell = rand.RandomElement(cells); } var endPos = new GameQuery_Position(); endPos.RegisterPosition(cell.X, cell.Y, false); this.PatrolEnd = endPos; }
private bool EnemyOnPath(GameQuery_Position targetPos) { bool future = false; foreach (var step in this.lastPath.Steps) { if (step == this.lastPath.CurrentStep) { future = true; } if (future && step.X == targetPos.X && step.Y == targetPos.Y) { return(true); } } return(false); }
private Cell PositionToCell(GameQuery_Position pos, ArenaState arena) { return(arena.ArenaMap.GetCell(pos.X, pos.Y)); }
private void HandleQueryPosition(GameQuery_Position q) { q.RegisterPosition(this.X, this.Y, this.BlocksMovement); }
private Cell PositionToCell(GameQuery_Position pos, FloorState floor) { return(floor.FloorMap.GetCell(pos.X, pos.Y)); }