This commit is contained in:
aozhiwei 2024-01-29 14:34:20 +08:00
parent d315401599
commit 857b27d76c
4 changed files with 54 additions and 0 deletions

View File

@ -47,6 +47,7 @@
#include "custom_team.h"
#include "custom_member.h"
#include "room_agent.h"
#include "roomob.h"
#include "mt/Param.h"
#include "mt/Hero.h"
@ -165,6 +166,8 @@ void Room::Init()
},
&xtimer_attacher_);
}
ob_ = std::make_shared<RoomOb>(this);
ob_->Init();
}
void Room::UnInit()
@ -198,6 +201,8 @@ void Room::UnInit()
team_hash_.clear();
frame_event_data = nullptr;
PerfMonitor::Instance()->alive_count -= alive_count_;
ob_->UnInit();
ob_ = nullptr;
}
void Room::Update(int delta_time)
@ -3702,3 +3707,8 @@ Team* Room::GetMobaEnemyTeam(Team* self_team)
return GetMobaTeamA();
}
}
std::shared_ptr<RoomOb> Room::GetRoomOb()
{
return ob_;
}

View File

@ -44,6 +44,7 @@ class BatchSync;
class CustomBattle;
class MobaBattle;
class RoomAgent;
class RoomOb;
struct Plane
{
@ -287,6 +288,7 @@ public:
std::shared_ptr<MobaBattle> p);
void CreateAndroid(int android_num, std::shared_ptr<Team> team = nullptr);
int GetFullLevelIdx() { return ++curr_full_level_idx_;}
std::shared_ptr<RoomOb> GetRoomOb();
private:
void ShuaAndroid();
@ -439,6 +441,8 @@ private:
Team* moba_team_a_ = nullptr;
Team* moba_team_b_ = nullptr;
std::shared_ptr<RoomOb> ob_;
RoomAgent* room_agent_;
friend class Incubator;

View File

@ -0,0 +1,24 @@
#include "precompile.h"
#include "roomob.h"
#include "room.h"
RoomOb::RoomOb(Room* room)
{
room_ = room;
}
RoomOb::~RoomOb()
{
}
void RoomOb::Init()
{
}
void RoomOb::UnInit()
{
}

View File

@ -0,0 +1,16 @@
#pragma once
class Room;
class RoomOb : public std::enable_shared_from_this<RoomOb>
{
public:
RoomOb(Room* room);
~RoomOb();
void Init();
void UnInit();
private:
Room* room_ = nullptr;
};