コード例 #1
0
ファイル: Brain.cs プロジェクト: exallium/DotNetHack
 /// <summary>
 /// Creates a new instance of Brain.  A brain requires a reference to the
 /// actor and the surroundings or dungeon.
 /// </summary>
 /// <param name="aSelf">The actor that this brain belongs to.</param>
 /// <param name="aDungeon">The surroundings the brain is aware of.</param>
 public Brain(Actor aSelf, Dungeon.Dungeon3 aDungeon)
     : this()
 {
     Self = aSelf;
     Dungeon = aDungeon;
     PathFinding = new DungeonPathFinding(Dungeon);
 }
コード例 #2
0
ファイル: Brain.cs プロジェクト: exallium/DotNetHack
        /// <summary>
        /// SwitchDungeon allows for changing the dungeon.
        /// </summary>
        /// <exception cref="ArgumentNullException">thrown when dungeon is null.</exception>
        public static void SwitchDungeon(this Brain b, Dungeon.Dungeon3 aDungeon)
        {
            // Make sure the passed parameter is not null.
            if (aDungeon == null)
                throw new ArgumentNullException("Cannot switch to a null dungeon.");

            // Set the dungeon.
            b.Dungeon = aDungeon;

            // Update path finding.
            b.PathFinding = new DungeonPathFinding(b.Dungeon);
        }