3 #include "sequence_trigger.h"
6 #include "lisp/writer.h"
7 #include "object_factory.h"
9 SequenceTrigger::SequenceTrigger(const lisp::Lisp& reader)
11 reader.get("x", bbox.p1.x);
12 reader.get("y", bbox.p1.y);
14 reader.get("width", w);
15 reader.get("height", h);
17 reader.get("sequence", sequence_name);
20 SequenceTrigger::SequenceTrigger(const Vector& pos, const std::string& sequence)
23 bbox.set_size(32, 32);
24 sequence_name = sequence;
25 triggerevent = EVENT_TOUCH;
28 SequenceTrigger::~SequenceTrigger()
33 SequenceTrigger::write(lisp::Writer& writer)
35 writer.start_list("sequencetrigger");
37 writer.write_float("x", bbox.p1.x);
38 writer.write_float("y", bbox.p1.y);
39 writer.write_float("width", bbox.get_width());
40 writer.write_float("height", bbox.get_height());
41 writer.write_string("sequence", sequence_name);
43 writer.end_list("sequencetrigger");
47 SequenceTrigger::event(Player& , EventType type)
49 if(type == triggerevent) {
50 GameSession::current()->start_sequence(sequence_name);
54 IMPLEMENT_FACTORY(SequenceTrigger, "sequencetrigger")