1
This commit is contained in:
parent
a841871924
commit
c1030a59cd
@ -64,6 +64,7 @@ void Room::InitData(RoomInitInfo& init_info)
|
|||||||
map_meta_ = init_info.map_meta;
|
map_meta_ = init_info.map_meta;
|
||||||
mini_room_spawn_points_ = init_info.mini_room_spawn_points;
|
mini_room_spawn_points_ = init_info.mini_room_spawn_points;
|
||||||
normal_room_spawn_points_ = init_info.normal_room_spawn_points;
|
normal_room_spawn_points_ = init_info.normal_room_spawn_points;
|
||||||
|
room_monster_spawn_points_ = init_info.room_monster_spawn_points;
|
||||||
level0room_born_point_meta_ = init_info.level0room_born_point_meta;
|
level0room_born_point_meta_ = init_info.level0room_born_point_meta;
|
||||||
level1room_born_point_meta_ = init_info.level1room_born_point_meta;
|
level1room_born_point_meta_ = init_info.level1room_born_point_meta;
|
||||||
loots_ = init_info.loots;
|
loots_ = init_info.loots;
|
||||||
@ -2086,7 +2087,35 @@ void Room::CreateSpawnPoints()
|
|||||||
void Room::CreateMonsterSpawnPoints()
|
void Room::CreateMonsterSpawnPoints()
|
||||||
{
|
{
|
||||||
if (room_monster_spawn_points_) {
|
if (room_monster_spawn_points_) {
|
||||||
|
for (auto& thing_tpl : *room_monster_spawn_points_) {
|
||||||
|
for (int hero_id : thing_tpl->heros) {
|
||||||
|
MetaData::Player* hero_meta = MetaMgr::Instance()->GetPlayer(hero_id);
|
||||||
|
if (hero_meta) {
|
||||||
|
a8::Vec2 left_bottom;
|
||||||
|
left_bottom.x = thing_tpl->i->x() - thing_tpl->i->width() / 2;
|
||||||
|
left_bottom.y = thing_tpl->i->y() - thing_tpl->i->height() / 2;
|
||||||
|
|
||||||
|
a8::Vec2 hero_pos;
|
||||||
|
hero_pos.x = left_bottom.x + (rand() % (int)thing_tpl->i->width());
|
||||||
|
hero_pos.y = left_bottom.y + (rand() % (int)thing_tpl->i->height());
|
||||||
|
|
||||||
|
int team_id = 666;
|
||||||
|
Creature* master = nullptr;
|
||||||
|
|
||||||
|
a8::Vec2 dir = hero_pos;
|
||||||
|
dir.Normalize();
|
||||||
|
|
||||||
|
Hero* hero = CreateHero(master,
|
||||||
|
hero_meta,
|
||||||
|
hero_pos,
|
||||||
|
dir,
|
||||||
|
team_id);
|
||||||
|
if (!hero) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,3 +104,4 @@ a8::Vec2 BornPoint::RandPoint() const
|
|||||||
}
|
}
|
||||||
return born_point;
|
return born_point;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user