feat: implemented basics of enemy rifleman
This commit is contained in:
parent
13daa093d1
commit
f1c4fe75f2
8 changed files with 155 additions and 6 deletions
|
|
@ -31,6 +31,13 @@ void MapRegion::on_child_entered_tree(Node *node) {
|
|||
}
|
||||
}
|
||||
|
||||
void MapRegion::set_hunt_phase(bool hunt) {
|
||||
if (this->hunt_phase != hunt) {
|
||||
this->hunt_phase = hunt;
|
||||
emit_signal(sig_phase_changed, hunt);
|
||||
}
|
||||
}
|
||||
|
||||
void MapRegion::enter_tree() {
|
||||
connect("child_entered_tree", callable_mp(this, &self_type::on_child_entered_tree));
|
||||
}
|
||||
|
|
@ -58,12 +65,21 @@ void MapRegion::_notification(int what) {
|
|||
void MapRegion::register_unit(NpcUnit *unit) {
|
||||
if (!this->units.has(unit)) {
|
||||
this->units.insert(unit);
|
||||
if (this->hunt_phase) {
|
||||
this->hunt_phase_units++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MapRegion::remove_unit(NpcUnit *unit) {
|
||||
if (this->units.has(unit)) {
|
||||
this->units.erase(unit);
|
||||
if (this->hunt_phase) {
|
||||
this->hunt_phase_units--;
|
||||
if (this->hunt_phase_units == 0) {
|
||||
set_hunt_phase(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -77,8 +93,7 @@ void MapRegion::raise_difficulty(double amount) {
|
|||
if (new_trunc != old_trunc) {
|
||||
print_line("Hunt Phase Started");
|
||||
emit_signal(sig_difficulty_increased);
|
||||
emit_signal(sig_phase_changed, true);
|
||||
this->hunt_phase = true;
|
||||
set_hunt_phase(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue