示例#1
0
        public override void Draw(RunState currentRunState)
        {
            Terminal.Color(Color.White);

            if (currentRunState != RunState.ShowTargeting)
            {
                return;
            }

            base.Draw(currentRunState);

            var mapMemory      = Game.Player.Get <MapMemory>();
            var cursorPosition = Game.Cursor.Get <Position>();
            var playerPosition = Game.Player.Get <Position>();

            var c = cursorPosition.Coordinate;
            var p = playerPosition.Coordinate;

            var remembered = mapMemory.Remembered.Contains(c);

            if (!remembered)
            {
                return;
            }

            if (!Game.Map.Terrain.TryGetValue(c, out var terrain))
            {
                return;
            }

            var distance = Coordinate.ChebyshevDistance(p, c);

            Print(0, 0, ContentAlignment.TopLeft, $"[[{distance}]] {terrain.Name}");

            if (Game.Map.TileEntities.TryGetValue(c, out var entities))
            {
                var names = entities.Select(x => x.Get <Nameable>()
                                            ?.Name)
                            .Where(x => x != null)
                            .ToList();

                var y = SpacingY;
                foreach (var name in names)
                {
                    Print(0, y, ContentAlignment.TopLeft, name);
                    y += SpacingY;
                }
            }
        }
示例#2
0
 public double EvaluationFunction(Coordinate coordinate)
 {
     return(Calc.Field.Sum(cell => cell.Point * Math.Pow(0.125, coordinate.ChebyshevDistance(cell.Coordinate))) - (Calc.Field.CellExist(coordinate) ? Calc.Field[coordinate].Point : 0));
 }