This repository has been archived on 2026-05-18. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
rpgskeleton/Scripts/RPG/Game_CommonEvent.rb
2014-04-23 21:59:50 -07:00

43 lines
1.6 KiB
Ruby

# -*- coding: utf-8 -*-
#==============================================================================
# ** Game_CommonEvent
#------------------------------------------------------------------------------
# This class handles common events. It includes functionality for execution of
# parallel process events. It's used within the Game_Map class ($game_map).
#==============================================================================
class Game_CommonEvent
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(common_event_id)
@event = $data_common_events[common_event_id]
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if active?
@interpreter ||= Game_Interpreter.new
else
@interpreter = nil
end
end
#--------------------------------------------------------------------------
# * Determine if Active State
#--------------------------------------------------------------------------
def active?
@event.parallel? && $game_switches[@event.switch_id]
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
if @interpreter
@interpreter.setup(@event.list) unless @interpreter.running?
@interpreter.update
end
end
end