1
This commit is contained in:
parent
0cf4f7651f
commit
1931d8c707
@ -30,11 +30,11 @@ void Loot::RecalcSelfCollider()
|
|||||||
if (!self_collider_) {
|
if (!self_collider_) {
|
||||||
self_collider_ = new CircleCollider();
|
self_collider_ = new CircleCollider();
|
||||||
self_collider_->owner = this;
|
self_collider_->owner = this;
|
||||||
|
self_collider_->tag = kColliderTag_Loot;
|
||||||
AddCollider(self_collider_);
|
AddCollider(self_collider_);
|
||||||
}
|
}
|
||||||
self_collider_->pos = a8::Vec2();
|
self_collider_->pos = a8::Vec2();
|
||||||
self_collider_->rad = 64.0f / 2.0;
|
self_collider_->rad = 64.0f / 2.0;
|
||||||
ClearColliders();
|
|
||||||
room->map_service.AddCollider(self_collider_);
|
room->map_service.AddCollider(self_collider_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ namespace MetaData
|
|||||||
|
|
||||||
bool Equip::CanDrop()
|
bool Equip::CanDrop()
|
||||||
{
|
{
|
||||||
return i->equip_type() == kEquipType_Bullet && MetaMgr::Instance()->fighting_mode;
|
return i->equip_type() == kEquipType_Buff && MetaMgr::Instance()->fighting_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Equip::NeedTrace()
|
bool Equip::NeedTrace()
|
||||||
@ -189,7 +189,14 @@ namespace MetaData
|
|||||||
|
|
||||||
void AirDrop::RandItems(std::vector<std::tuple<int, int>>& drop_items)
|
void AirDrop::RandItems(std::vector<std::tuple<int, int>>& drop_items)
|
||||||
{
|
{
|
||||||
|
for (auto& tuple : drop_list) {
|
||||||
|
drop_items.push_back(
|
||||||
|
std::make_tuple(
|
||||||
|
std::get<0>(tuple),
|
||||||
|
std::get<1>(tuple)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Building::Init()
|
void Building::Init()
|
||||||
|
@ -40,7 +40,7 @@ void Room::Init()
|
|||||||
xtimer_attacher.xtimer = &xtimer;
|
xtimer_attacher.xtimer = &xtimer;
|
||||||
frame_event.room = this;
|
frame_event.room = this;
|
||||||
grid_service.Init(map_width, map_height, kMAP_CELL_WIDTH * 8);
|
grid_service.Init(map_width, map_height, kMAP_CELL_WIDTH * 8);
|
||||||
map_service.Init(map_width / kMAP_GRID_WIDTH, map_height / kMAP_GRID_WIDTH, kMAP_GRID_WIDTH);
|
map_service.Init(map_width / kMAP_GRID_WIDTH + 1, map_height / kMAP_GRID_WIDTH + 1, kMAP_GRID_WIDTH);
|
||||||
|
|
||||||
CreateThings();
|
CreateThings();
|
||||||
if (App::Instance()->HasFlag(1)) {
|
if (App::Instance()->HasFlag(1)) {
|
||||||
@ -530,10 +530,10 @@ int Room::CreateLoot(int equip_id, a8::Vec2 pos, int count, int equip_lv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
Loot* entity = new Loot();
|
Loot* entity = new Loot();
|
||||||
|
entity->pos = pos;
|
||||||
entity->room = this;
|
entity->room = this;
|
||||||
entity->meta = equip_meta;
|
entity->meta = equip_meta;
|
||||||
entity->entity_uniid = AllocUniid();
|
entity->entity_uniid = AllocUniid();
|
||||||
entity->pos = pos;
|
|
||||||
#if 1
|
#if 1
|
||||||
{
|
{
|
||||||
if (entity->pos.x >= map_width) {
|
if (entity->pos.x >= map_width) {
|
||||||
@ -1140,14 +1140,15 @@ void Room::InitAirDrop()
|
|||||||
|
|
||||||
void Room::AirDrop(MetaData::AirDrop* air_drop)
|
void Room::AirDrop(MetaData::AirDrop* air_drop)
|
||||||
{
|
{
|
||||||
|
frame_event.AddAirDrop(air_drop->i->appear_time(), 0, a8::Vec2());
|
||||||
std::vector<std::tuple<int, int>> drop_items;
|
std::vector<std::tuple<int, int>> drop_items;
|
||||||
air_drop->RandItems(drop_items);
|
air_drop->RandItems(drop_items);
|
||||||
for (auto& tuple : drop_items) {
|
for (auto& tuple : drop_items) {
|
||||||
GenDrop(std::get<1>(tuple), std::get<0>(tuple));
|
GenDrop(air_drop, std::get<1>(tuple), std::get<0>(tuple));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Room::GenDrop(int drop_id, int airdrop_point_id)
|
void Room::GenDrop(MetaData::AirDrop* air_drop, int drop_id, int airdrop_point_id)
|
||||||
{
|
{
|
||||||
if (airdrop_hash_.find(airdrop_point_id) != airdrop_hash_.end()) {
|
if (airdrop_hash_.find(airdrop_point_id) != airdrop_hash_.end()) {
|
||||||
return;
|
return;
|
||||||
@ -1178,8 +1179,8 @@ void Room::GenDrop(int drop_id, int airdrop_point_id)
|
|||||||
} else {
|
} else {
|
||||||
airdrop_hash_[airdrop_point_id] = std::set<int>({loot_id});
|
airdrop_hash_[airdrop_point_id] = std::set<int>({loot_id});
|
||||||
}
|
}
|
||||||
|
((Loot*)entity)->airdrop_point_id = airdrop_point_id;
|
||||||
}
|
}
|
||||||
((Loot*)entity)->airdrop_point_id = airdrop_point_id;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ private:
|
|||||||
int AllocBornPoint();
|
int AllocBornPoint();
|
||||||
void InitAirDrop();
|
void InitAirDrop();
|
||||||
void AirDrop(MetaData::AirDrop* air_drop);
|
void AirDrop(MetaData::AirDrop* air_drop);
|
||||||
void GenDrop(int drop_id, int airdrop_point_id);
|
void GenDrop(MetaData::AirDrop* air_drop, int drop_id, int airdrop_point_id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int elapsed_time_ = 0;
|
int elapsed_time_ = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user