1
This commit is contained in:
parent
b712fd0edc
commit
868c91ac11
@ -95,3 +95,32 @@ void Android::SetAiLevel(int ai_level)
|
||||
ai->SetAiLevel(ai_level);
|
||||
}
|
||||
}
|
||||
|
||||
void Android::RandSkin()
|
||||
{
|
||||
#if 1
|
||||
if (!robot_meta->skin_id.empty()) {
|
||||
Skin& skin = skins[0];
|
||||
skin.skin_id = 13001 + robot_meta->skin_id[rand() % robot_meta->skin_id.size()];
|
||||
skin.skin_lv = 1;
|
||||
}
|
||||
#else
|
||||
std::vector<int> ids = {1, 2, 3, 4, 5, 6};
|
||||
for (int i = 0; i < kSkinNum; ++i) {
|
||||
int rand_idx = rand() % ids.size();
|
||||
int skin_id = ids[rand_idx];
|
||||
if (i == 1) {
|
||||
skin_id = 13001 + (rand() % 6);
|
||||
} else if (i == 2) {
|
||||
skin_id = 15001 + (rand() % 6);
|
||||
}
|
||||
#if 1
|
||||
skin_id = 1;
|
||||
#endif
|
||||
Skin& skin = skins[i];
|
||||
skin.skin_id = skin_id;
|
||||
skin.skin_lv = 1;
|
||||
ids.erase(ids.begin() + rand_idx);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ protected:
|
||||
|
||||
private:
|
||||
void InternalUpdate(int delta_time);
|
||||
void RandSkin();
|
||||
|
||||
friend class EntityFactory;
|
||||
};
|
||||
|
@ -2551,27 +2551,6 @@ void Human::FreeReviveTimer()
|
||||
}
|
||||
}
|
||||
|
||||
void Human::RandSkin()
|
||||
{
|
||||
std::vector<int> ids = {1, 2, 3, 4, 5, 6};
|
||||
for (int i = 0; i < kSkinNum; ++i) {
|
||||
int rand_idx = rand() % ids.size();
|
||||
int skin_id = ids[rand_idx];
|
||||
if (i == 1) {
|
||||
skin_id = 13001 + (rand() % 6);
|
||||
} else if (i == 2) {
|
||||
skin_id = 15001 + (rand() % 6);
|
||||
}
|
||||
#if 1
|
||||
skin_id = 1;
|
||||
#endif
|
||||
Skin& skin = skins[i];
|
||||
skin.skin_id = skin_id;
|
||||
skin.skin_lv = 1;
|
||||
ids.erase(ids.begin() + rand_idx);
|
||||
}
|
||||
}
|
||||
|
||||
void Human::SetSkin(int idx, int skin_id)
|
||||
{
|
||||
if (idx < kSkinNum) {
|
||||
|
@ -222,7 +222,6 @@ class Human : public Creature
|
||||
void OnDie();
|
||||
void FreeDownedTimer();
|
||||
void FreeReviveTimer();
|
||||
void RandSkin();
|
||||
void SetSkin(int idx, int skin_id);
|
||||
Skin* GetSkinByIdx(int idx);
|
||||
int GetLevel() {return level_;};
|
||||
@ -344,6 +343,7 @@ protected:
|
||||
int seat_ = 0;
|
||||
std::set<Human*> view_objects_;
|
||||
xtimer_list* refresh_view_timer_ = nullptr;
|
||||
std::vector<Skin> skins;
|
||||
|
||||
private:
|
||||
CircleCollider* self_collider_ = nullptr;
|
||||
@ -360,7 +360,6 @@ private:
|
||||
bool sent_battlereport_ = false;
|
||||
bool sent_game_end_ = false;
|
||||
|
||||
std::vector<Skin> skins;
|
||||
|
||||
Entity* last_collision_door_ = nullptr;
|
||||
long long jump_frameno_ = 0;
|
||||
|
@ -342,7 +342,13 @@ namespace MetaData
|
||||
|
||||
void Robot::Init()
|
||||
{
|
||||
|
||||
{
|
||||
std::vector<std::string> strings;
|
||||
a8::Split(i->skin_id(), strings, '|');
|
||||
for (auto& str : strings) {
|
||||
skin_id.push_back(a8::XValue(str));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Drop::Init()
|
||||
|
@ -104,6 +104,7 @@ namespace MetaData
|
||||
const metatable::Robot* i = nullptr;
|
||||
|
||||
void Init();
|
||||
std::vector<int> skin_id;
|
||||
};
|
||||
|
||||
struct Building
|
||||
|
@ -332,7 +332,7 @@ void Room::CreateAndroid(int robot_num)
|
||||
|
||||
Android* hum = EntityFactory::Instance()->MakeAndroid(AllocUniid());
|
||||
hum->name = robot_meta->i->name();
|
||||
hum->meta = MetaMgr::Instance()->android_meta;
|
||||
hum->meta = MetaMgr::Instance()->GetPlayer(robot_meta->i->hero_id());
|
||||
hum->robot_meta = robot_meta;
|
||||
hum->born_point = AllocBornPoint(hum);
|
||||
if (!hum->born_point) {
|
||||
|
@ -171,7 +171,8 @@ message Robot
|
||||
{
|
||||
optional int32 id = 1;
|
||||
optional string name = 2;
|
||||
optional int32 skin = 3;
|
||||
optional int32 hero_id = 3;
|
||||
optional string skin_id = 10;
|
||||
optional int32 weapon_id = 4;
|
||||
optional int32 weapon_lv = 5;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user