コード例 #1
0
ファイル: MagicalScroll.cs プロジェクト: jclovis3/DungeonGeek
        /// <summary>
        /// Reveals any non-blocking tile in a straight line but stops at doors because the light in
        /// a lit room doesn't light up a hallway.
        /// </summary>
        /// <param name="startingPoint"></param>
        /// <param name="direction"></param>
        private void LightTilesInRow(Point startingPoint, GameConstants.Direction8 direction)
        {
            bool  blocked      = false;
            Point currentPoint = startingPoint;

            FloorTile.Surfaces currentSurface;
            while (!blocked)
            {
                currentSurface = FloorGenerator.GetTileAt(currentPoint);
                FloorGenerator.FloorRevealed[currentPoint.X, currentPoint.Y] = true;

                if (!FloorGenerator.TileIsPassible(currentSurface))
                {
                    blocked = true;
                }
                if (currentPoint == startingPoint)
                {
                    blocked = false; // Allows effect if standing in doorway to split both ways
                }
                if (blocked)
                {
                    break;
                }

                // Move to next tile
                currentPoint = FloorGenerator.PointInDirection(currentPoint, direction);
            }
        }
コード例 #2
0
ファイル: Monster.cs プロジェクト: jclovis3/DungeonGeek
        }                              // Monsters won't gain XP in this game

        internal void Roam()
        {
            // TODO: Make another Move method with path finding to get a monster moving toward a given point
            // For when an effect triggers all monsters to detect the hero or behavior should be less eratic.
            // This method should actually be used in the HeroStrikable method to move towards the hero.
            bool  monsterMoved = false;
            Point checkPoint;

            while (!monsterMoved)
            {
                GameConstants.Direction8 moveDirection = (GameConstants.Direction8)rand.Next(8);
                checkPoint = FloorGenerator.PointInDirection(location, moveDirection);
                if (FloorGenerator.TileIsPassible(FloorGenerator.GetTileAt(checkPoint)))
                {
                    location     = checkPoint;
                    monsterMoved = true;
                }
            }
            CheckVisibility();
        }