Class: Goby::Event
- Inherits:
-
Object
- Object
- Goby::Event
- Defined in:
- lib/goby/event/event.rb
Overview
A Player can interact with these on the Map.
Constant Summary collapse
- DEFAULT_RUN_TEXT =
The default text for when the event doesn’t do anything.
"Nothing happens.\n\n"
Instance Attribute Summary collapse
-
#command ⇒ Object
Specify the command in the subclass.
-
#mode ⇒ Object
Specify the command in the subclass.
-
#visible ⇒ Object
Specify the command in the subclass.
Instance Method Summary collapse
- #==(rhs) ⇒ Object
-
#initialize(command: "event", mode: 0, visible: true) ⇒ Event
constructor
A new instance of Event.
-
#run(player) ⇒ Object
The function that runs when the player activates the event.
Constructor Details
#initialize(command: "event", mode: 0, visible: true) ⇒ Event
Returns a new instance of Event.
12 13 14 15 16 |
# File 'lib/goby/event/event.rb', line 12 def initialize(command: "event", mode: 0, visible: true) @command = command @mode = mode @visible = visible end |
Instance Attribute Details
#command ⇒ Object
Specify the command in the subclass.
32 33 34 |
# File 'lib/goby/event/event.rb', line 32 def command @command end |
#mode ⇒ Object
Specify the command in the subclass.
32 33 34 |
# File 'lib/goby/event/event.rb', line 32 def mode @mode end |
#visible ⇒ Object
Specify the command in the subclass.
32 33 34 |
# File 'lib/goby/event/event.rb', line 32 def visible @visible end |
Instance Method Details
#==(rhs) ⇒ Object
27 28 29 |
# File 'lib/goby/event/event.rb', line 27 def ==(rhs) @command == rhs.command end |
#run(player) ⇒ Object
The function that runs when the player activates the event. Override this function for subclasses.
22 23 24 |
# File 'lib/goby/event/event.rb', line 22 def run(player) print DEFAULT_RUN_TEXT end |