add roomentity
This commit is contained in:
parent
827946bf1f
commit
adc58332e0
@ -3,7 +3,6 @@
|
||||
#include "building.h"
|
||||
#include "collider.h"
|
||||
#include "metamgr.h"
|
||||
#include "room.h"
|
||||
#include "loot.h"
|
||||
#include "app.h"
|
||||
#include "typeconvert.h"
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "player.h"
|
||||
#include "app.h"
|
||||
|
||||
Bullet::Bullet():Entity()
|
||||
Bullet::Bullet():RoomEntity()
|
||||
{
|
||||
entity_type = ET_Bullet;
|
||||
++App::Instance()->perf.entity_num[ET_Bullet];
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "entity.h"
|
||||
#include "roomentity.h"
|
||||
|
||||
namespace MetaData
|
||||
{
|
||||
@ -13,7 +13,7 @@ class Human;
|
||||
class Obstacle;
|
||||
class CircleCollider;
|
||||
class MovementComponent;
|
||||
class Bullet : public Entity
|
||||
class Bullet : public RoomEntity
|
||||
{
|
||||
public:
|
||||
int gun_lv = 0;
|
||||
|
@ -19,7 +19,9 @@ Entity::~Entity()
|
||||
|
||||
void Entity::Initialize()
|
||||
{
|
||||
#if 0
|
||||
xtimer_attacher.xtimer = &room->xtimer;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Entity::GetAabbBox(AabbCollider& aabb_box)
|
||||
|
@ -24,7 +24,6 @@ class Entity
|
||||
Room* room = nullptr;
|
||||
int updated_times = 0;
|
||||
bool deleted = false;
|
||||
a8::XTimerAttacher xtimer_attacher;
|
||||
|
||||
bool is_permanent = false;
|
||||
MapService* permanent_map_service = nullptr;
|
||||
|
@ -28,7 +28,7 @@
|
||||
const int kReviveTimeAdd = 12;
|
||||
const int kSkinNum = 4;
|
||||
|
||||
Human::Human():Entity()
|
||||
Human::Human():RoomEntity()
|
||||
{
|
||||
default_weapon.weapon_idx = 0;
|
||||
default_weapon.weapon_id = 12101;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "entity.h"
|
||||
#include "roomentity.h"
|
||||
#include "cs_proto.pb.h"
|
||||
#include "GGListener.h"
|
||||
|
||||
@ -26,7 +26,7 @@ class AabbCollider;
|
||||
class Obstacle;
|
||||
class Loot;
|
||||
class Buff;
|
||||
class Human : public Entity
|
||||
class Human : public RoomEntity
|
||||
{
|
||||
public:
|
||||
int socket_handle = 0;
|
||||
@ -45,6 +45,7 @@ class Human : public Entity
|
||||
MetaData::Dress* skin_jlf_meta = nullptr;
|
||||
MetaData::Equip* skin_tank_meta = nullptr;
|
||||
HumanAbility ability;
|
||||
a8::XTimerAttacher xtimer_attacher;
|
||||
|
||||
a8::Vec2 move_dir;
|
||||
a8::Vec2 attack_dir;
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "app.h"
|
||||
#include "typeconvert.h"
|
||||
|
||||
Loot::Loot():Entity()
|
||||
Loot::Loot():RoomEntity()
|
||||
{
|
||||
entity_type = ET_Loot;
|
||||
++App::Instance()->perf.entity_num[ET_Loot];
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "entity.h"
|
||||
#include "roomentity.h"
|
||||
|
||||
namespace MetaData
|
||||
{
|
||||
@ -10,7 +10,7 @@ namespace MetaData
|
||||
}
|
||||
|
||||
class Human;
|
||||
class Loot : public Entity
|
||||
class Loot : public RoomEntity
|
||||
{
|
||||
public:
|
||||
MetaData::Equip* meta = nullptr;
|
||||
|
@ -72,7 +72,7 @@ void Obstacle::RecalcSelfCollider()
|
||||
}
|
||||
self_collider_->pos = a8::Vec2();
|
||||
self_collider_->rad = meta->i->height() / 2.0;
|
||||
room->map_service.AddCollider(self_collider_);
|
||||
permanent_map_service->AddCollider(self_collider_);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@ -84,7 +84,7 @@ void Obstacle::RecalcSelfCollider()
|
||||
}
|
||||
self_collider2_->_min = a8::Vec2(meta->i->width() / -2.0f, meta->i->height() / -2.0f);
|
||||
self_collider2_->_max = a8::Vec2(meta->i->width() / 2.0f, meta->i->height() / 2.0f);
|
||||
room->map_service.AddCollider(self_collider2_);
|
||||
permanent_map_service->AddCollider(self_collider2_);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -445,7 +445,7 @@ void Room::CreateBullet(Human* hum, Weapon* weapon,
|
||||
}
|
||||
}
|
||||
|
||||
void Room::RemoveObjectLater(Entity* entity)
|
||||
void Room::RemoveObjectLater(RoomEntity* entity)
|
||||
{
|
||||
auto remove_func = [] (const a8::XParams& param)
|
||||
{
|
||||
@ -1180,11 +1180,11 @@ Obstacle* Room::InternalCreateObstacle(int id, float x, float y,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Room::AddObjectLater(Entity* entity)
|
||||
void Room::AddObjectLater(RoomEntity* entity)
|
||||
{
|
||||
auto add_func = [] (const a8::XParams& param)
|
||||
{
|
||||
Entity* entity = (Entity*)param.sender.GetUserData();
|
||||
RoomEntity* entity = (RoomEntity*)param.sender.GetUserData();
|
||||
if (entity->entity_type == ET_Bullet) {
|
||||
entity->room->moveable_hash_[entity->entity_uniid] = entity;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ namespace metatable
|
||||
struct timer_list;
|
||||
struct xtimer_list;
|
||||
class Entity;
|
||||
class RoomEntity;
|
||||
class Obstacle;
|
||||
class Bullet;
|
||||
class Human;
|
||||
@ -72,7 +73,7 @@ public:
|
||||
void AddPlayer(Player* hum);
|
||||
Human* FindEnemy(Human* hum);
|
||||
|
||||
void RemoveObjectLater(Entity* entity);
|
||||
void RemoveObjectLater(RoomEntity* entity);
|
||||
|
||||
void FillSMJoinedNotify(Player* self_hum, cs::SMJoinedNotify& msg);
|
||||
|
||||
@ -129,7 +130,7 @@ private:
|
||||
Obstacle* CreateObstacle(int id, float x, float y);
|
||||
Obstacle* InternalCreateObstacle(int id, float x, float y,
|
||||
std::function<void (Obstacle*)> on_precreate);
|
||||
void AddObjectLater(Entity* entity);
|
||||
void AddObjectLater(RoomEntity* entity);
|
||||
void OnGameOver();
|
||||
void RandRemoveAndroid();
|
||||
void NotifyWxVoip();
|
||||
|
0
server/gameserver/roomentity.cc
Normal file
0
server/gameserver/roomentity.cc
Normal file
10
server/gameserver/roomentity.h
Normal file
10
server/gameserver/roomentity.h
Normal file
@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "entity.h"
|
||||
|
||||
class RoomEntity : public Entity
|
||||
{
|
||||
public:
|
||||
a8::XTimerAttacher xtimer_attacher;
|
||||
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user