add moveableentity
This commit is contained in:
parent
67610ac3cf
commit
51adf8e366
@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
class RoomEntity;
|
||||
class MoveableEntity;
|
||||
class AIComponent
|
||||
{
|
||||
public:
|
||||
RoomEntity* owner = nullptr;
|
||||
MoveableEntity* owner = nullptr;
|
||||
|
||||
virtual ~AIComponent();
|
||||
virtual void Update(int delta_time);
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "player.h"
|
||||
#include "app.h"
|
||||
|
||||
Bullet::Bullet():RoomEntity()
|
||||
Bullet::Bullet():MoveableEntity()
|
||||
{
|
||||
entity_type = ET_Bullet;
|
||||
++App::Instance()->perf.entity_num[ET_Bullet];
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "roomentity.h"
|
||||
#include "moveableentity.h"
|
||||
|
||||
namespace MetaData
|
||||
{
|
||||
@ -13,7 +13,7 @@ class Human;
|
||||
class Obstacle;
|
||||
class CircleCollider;
|
||||
class MovementComponent;
|
||||
class Bullet : public RoomEntity
|
||||
class Bullet : public MoveableEntity
|
||||
{
|
||||
public:
|
||||
int gun_lv = 0;
|
||||
|
@ -20,7 +20,6 @@ class Entity
|
||||
int entity_uniid = 0;
|
||||
EntityType_e entity_type = ET_None;
|
||||
EntitySubType_e entity_subtype = EST_None;
|
||||
int updated_times = 0;
|
||||
|
||||
bool is_permanent = false;
|
||||
MapService* permanent_map_service = nullptr;
|
||||
|
@ -28,7 +28,7 @@
|
||||
const int kReviveTimeAdd = 12;
|
||||
const int kSkinNum = 4;
|
||||
|
||||
Human::Human():RoomEntity()
|
||||
Human::Human():MoveableEntity()
|
||||
{
|
||||
default_weapon.weapon_idx = 0;
|
||||
default_weapon.weapon_id = 12101;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "roomentity.h"
|
||||
#include "moveableentity.h"
|
||||
#include "cs_proto.pb.h"
|
||||
#include "GGListener.h"
|
||||
|
||||
@ -26,7 +26,7 @@ class AabbCollider;
|
||||
class Obstacle;
|
||||
class Loot;
|
||||
class Buff;
|
||||
class Human : public RoomEntity
|
||||
class Human : public MoveableEntity
|
||||
{
|
||||
public:
|
||||
int socket_handle = 0;
|
||||
|
0
server/gameserver/moveableentity.cc
Normal file
0
server/gameserver/moveableentity.cc
Normal file
10
server/gameserver/moveableentity.h
Normal file
10
server/gameserver/moveableentity.h
Normal file
@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "roomentity.h"
|
||||
|
||||
class MoveableEntity : public RoomEntity
|
||||
{
|
||||
public:
|
||||
int updated_times = 0;
|
||||
|
||||
};
|
@ -1185,7 +1185,8 @@ void Room::AddObjectLater(RoomEntity* entity)
|
||||
{
|
||||
RoomEntity* entity = (RoomEntity*)param.sender.GetUserData();
|
||||
if (entity->entity_type == ET_Bullet) {
|
||||
entity->room->moveable_hash_[entity->entity_uniid] = entity;
|
||||
MoveableEntity* moveableentity = (MoveableEntity*)entity;
|
||||
entity->room->moveable_hash_[entity->entity_uniid] = moveableentity;
|
||||
}
|
||||
entity->room->uniid_hash_[entity->entity_uniid] = entity;
|
||||
entity->room->later_add_hash_.erase(entity->entity_uniid);
|
||||
|
@ -26,6 +26,7 @@ struct timer_list;
|
||||
struct xtimer_list;
|
||||
class Entity;
|
||||
class RoomEntity;
|
||||
class MoveableEntity;
|
||||
class Obstacle;
|
||||
class Bullet;
|
||||
class Human;
|
||||
@ -156,7 +157,7 @@ private:
|
||||
std::set<int> refreshed_robot_set_;
|
||||
std::map<int, std::set<Human*>> team_hash_;
|
||||
std::map<std::string, Player*> accountid_hash_;
|
||||
std::map<int, Entity*> moveable_hash_;
|
||||
std::map<int, MoveableEntity*> moveable_hash_;
|
||||
std::map<int, Entity*> uniid_hash_;
|
||||
std::map<int, Entity*> later_add_hash_;
|
||||
std::map<int, Human*> human_hash_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user