优化syncframedata
This commit is contained in:
parent
7dd91deffb
commit
5451528b08
3
.gitignore
vendored
3
.gitignore
vendored
@ -21,4 +21,5 @@ __pycache__
|
||||
.user
|
||||
game.py
|
||||
*.cxx
|
||||
compile_commands.json
|
||||
compile_commands.json
|
||||
t
|
||||
|
@ -66,7 +66,8 @@ void AndroidAI::Update(int delta_time)
|
||||
break;
|
||||
case AS_attack:
|
||||
{
|
||||
if (state_elapsed_time < 1000) {
|
||||
if ((state_elapsed_time < 3000 && last_target_) ||
|
||||
(state_elapsed_time < 1100)) {
|
||||
DoAttack();
|
||||
} else {
|
||||
int rnd = rand();
|
||||
@ -151,6 +152,7 @@ void AndroidAI::DoAttack()
|
||||
sender->Shot(shot_dir);
|
||||
}
|
||||
}
|
||||
last_target_ = enemy;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,4 +28,6 @@ private:
|
||||
void DoMove();
|
||||
void DoAttack();
|
||||
|
||||
private:
|
||||
Human* last_target_ = nullptr;
|
||||
};
|
||||
|
@ -117,10 +117,7 @@ void Room::Update(int delta_time)
|
||||
pair.second->Update(50);
|
||||
}
|
||||
if (GetFrameNo() % 2 == 0) {
|
||||
for (auto& pair : human_hash_) {
|
||||
pair.second->SendUpdateMsg();
|
||||
}
|
||||
frame_event.Clear();
|
||||
SyncFrameData();
|
||||
}
|
||||
++frameno_;
|
||||
elapsed_time_ -= 50;
|
||||
@ -2535,3 +2532,11 @@ bool Room::CanAddToScene(Human* hum)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Room::SyncFrameData()
|
||||
{
|
||||
for (auto& pair : human_hash_) {
|
||||
pair.second->SendUpdateMsg();
|
||||
}
|
||||
frame_event.Clear();
|
||||
}
|
||||
|
@ -189,6 +189,7 @@ private:
|
||||
void NewBieRoomStart();
|
||||
void CreateLevel0RoomSpecThings();
|
||||
bool CanAddToScene(Human* hum);
|
||||
void SyncFrameData();
|
||||
|
||||
#ifdef DEBUG
|
||||
void InitDebugInfo();
|
||||
|
Loading…
x
Reference in New Issue
Block a user