⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 door.java

📁 龙与地下城游戏(小型)的设计与实现。主要是随机产生地牢
💻 JAVA
字号:
package dungeonsanddragons.model;/** * Class representing a door in the castle * @author Sandra Nilsson */public class Door {    private Room r1;    private Room r2;        /**     * Create a door from the room r1     * @param r1 the room that this door leads to/from     */    public Door (Room r1) {        this.r1 = r1;    }    public Room getR1() {        return r1;    }    public void setR1(Room r1) {        this.r1 = r1;    }    public Room getR2() {        return r2;    }    public void setR2(Room r2) {        this.r2 = r2;    }            /**     * Walk through this door with the given player     * @param p1 the player that walsk through this door     * @param fromRoom the room that the player comes from     */    public void walkThrough (Player p1, Room fromRoom) {        if(fromRoom == r1){            //Change the current room of the player to the other one            p1.setCurrentRoom(r2);        } else {            //Change the current room of the player to the other one            p1.setCurrentRoom(r1);        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -