53 lines
1.5 KiB
C++
53 lines
1.5 KiB
C++
#include "precompile.h"
|
|
|
|
#include "mt/SafeAreaPos.h"
|
|
|
|
IMPL_TABLE(mt::SafeAreaPos)
|
|
std::map<int, std::vector<mt::SafeAreaPos*>> mt::SafeAreaPos::area_hash_;
|
|
|
|
namespace mt
|
|
{
|
|
|
|
void SafeAreaPos::Init1()
|
|
{
|
|
std::vector<glm::vec3> tmp_list;
|
|
{
|
|
tmp_list.push_back(glm::vec3(x1(), 0.0f, y1()));
|
|
tmp_list.push_back(glm::vec3(x2(), 0.0f, y2()));
|
|
tmp_list.push_back(glm::vec3(x3(), 0.0f, y3()));
|
|
tmp_list.push_back(glm::vec3(x4(), 0.0f, y4()));
|
|
tmp_list.push_back(glm::vec3(x5(), 0.0f, y5()));
|
|
tmp_list.push_back(glm::vec3(x6(), 0.0f, y6()));
|
|
tmp_list.push_back(glm::vec3(x7(), 0.0f, y7()));
|
|
tmp_list.push_back(glm::vec3(x8(), 0.0f, y8()));
|
|
tmp_list.push_back(glm::vec3(x9(), 0.0f, y9()));
|
|
tmp_list.push_back(glm::vec3(x10(), 0.0f, y10()));
|
|
}
|
|
for (auto& pos : tmp_list) {
|
|
if (pos.x < 1.0f || pos.y < 1.0f) {
|
|
break;
|
|
}
|
|
_poses.push_back(pos);
|
|
}
|
|
|
|
}
|
|
|
|
void SafeAreaPos::Init2()
|
|
{
|
|
|
|
}
|
|
|
|
const SafeAreaPos* SafeAreaPos::RandSafeAreaPos(int area_id)
|
|
{
|
|
auto pos_list = GetSafeAreaPosList(area_id);
|
|
return pos_list && !pos_list->empty() ? pos_list->at(rand() % pos_list->size()) : nullptr;
|
|
}
|
|
|
|
std::vector<mt::SafeAreaPos*>* SafeAreaPos::GetSafeAreaPosList(int area_id)
|
|
{
|
|
auto itr = area_hash_.find(area_id);
|
|
return itr != area_hash_.end() ? &itr->second : nullptr;
|
|
}
|
|
|
|
}
|