Beispiel #1
0
        private void MoveCursor(int dx, int dy)
        {
            var cell      = this.Floor.FloorMap.GetCell(this.X + dx, this.Y + dy);
            var playerPos = this.Floor.Player.TryGetPosition();

            if (FloorState.DistanceBetweenPositions(playerPos.X, playerPos.Y, cell.X, cell.Y) <= this.Range &&
                cell.IsInFov && cell.IsWalkable)
            {
                this.X += dx;
                this.Y += dy;
            }
        }
Beispiel #2
0
        public void DeterminePatrolPath(FloorState state, IRandom rand)
        {
            this.PatrolStart = this.Parent.TryGetPosition();
            var  cells = state.WalkableCells();
            Cell cell  = rand.RandomElement(cells);

            while (Config.MinPatrolDistance < FloorState.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, state.Level, false);
            this.PatrolEnd = endPos;
        }