Guest User

Untitled

a guest
Nov 23rd, 2020
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.05 KB | None | 0 0
  1. /**
  2.  * Class Room here.
  3.  *
  4.  */
  5.  
  6. public class Room
  7. {
  8.     public String description;
  9.     public Room northExit;
  10.     public Room southExit;
  11.     public Room eastExit;
  12.     public Room westExit;
  13.    
  14.     public Room(String description)
  15.     {
  16.         this.description = description;
  17.     }
  18.    
  19.     /**
  20.      * Deklarasikan exit dari setiap ruangan.
  21.      * @param north untuk exit north.
  22.      * @param east untuk exit east.
  23.      * @param south untuk exit south.
  24.      * @param west untuk exit west
  25.      *
  26.      */
  27.     public void setExits(Room north, Room east, Room south, Room west)
  28.     {
  29.         if(north != null)
  30.         {
  31.             northExit = north;
  32.         }
  33.         if(east != null)
  34.         {
  35.             eastExit = east;
  36.         }
  37.         if(south != null)
  38.         {
  39.             southExit = south;
  40.         }
  41.         if(west != null)
  42.         {
  43.             westExit = west;
  44.         }
  45.     }
  46.     /**
  47.      * @return Deskripsi dari room
  48.      */
  49.      public String getDescription()
  50.      {
  51.          return description;
  52.      }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment