1
This commit is contained in:
parent
71c0da24ac
commit
2a2620b516
@ -24,8 +24,52 @@ void Obstacle::Initialize()
|
|||||||
|
|
||||||
void Obstacle::RecalcSelfCollider()
|
void Obstacle::RecalcSelfCollider()
|
||||||
{
|
{
|
||||||
|
#if 1
|
||||||
|
if (is_door) {
|
||||||
|
//门
|
||||||
|
if (!self_collider2_) {
|
||||||
|
self_collider2_ = new AabbCollider();
|
||||||
|
self_collider2_->owner = this;
|
||||||
|
colliders.push_back(self_collider2_);
|
||||||
|
}
|
||||||
|
if (door_state == DoorStateClose) {
|
||||||
|
self_collider2_->_min = Vector2D(0.0f - door_state0->width() / 2.0f,
|
||||||
|
0.0f - door_state0->height() / 2.0f);
|
||||||
|
self_collider2_->_max = Vector2D(door_state0->width() / 2.0f, door_state0->height() / 2.0f);
|
||||||
|
} else {
|
||||||
|
self_collider2_->_min = Vector2D(0.0f - door_state1->width() / 2.0f,
|
||||||
|
0.0f - door_state1->height() / 2.0f);
|
||||||
|
self_collider2_->_max = Vector2D(door_state1->width(), door_state1->height());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch (meta->i->type()) {
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
if (!self_collider_) {
|
||||||
|
self_collider_ = new CircleCollider();
|
||||||
|
self_collider_->owner = this;
|
||||||
|
colliders.push_back(self_collider_);
|
||||||
|
}
|
||||||
|
self_collider_->pos = Vector2D();
|
||||||
|
self_collider_->rad = meta->i->height() / 2.0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
if (!self_collider2_) {
|
||||||
|
self_collider2_ = new AabbCollider();
|
||||||
|
self_collider2_->owner = this;
|
||||||
|
colliders.push_back(self_collider2_);
|
||||||
|
}
|
||||||
|
self_collider2_->_min = Vector2D(meta->i->height() / -2.0f, meta->i->width() / -2.0f);
|
||||||
|
self_collider2_->_max = Vector2D(meta->i->height() / 2.0f, meta->i->width() / 2.0f);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
switch (meta->i->thing_id()) {
|
switch (meta->i->thing_id()) {
|
||||||
case 61001:
|
case 61101:
|
||||||
{
|
{
|
||||||
if (!self_collider2_) {
|
if (!self_collider2_) {
|
||||||
self_collider2_ = new AabbCollider();
|
self_collider2_ = new AabbCollider();
|
||||||
@ -48,7 +92,7 @@ void Obstacle::RecalcSelfCollider()
|
|||||||
self_collider2_->_max = Vector2D(6.0f, 6.0f);
|
self_collider2_->_max = Vector2D(6.0f, 6.0f);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 61007:
|
case 61401:
|
||||||
{
|
{
|
||||||
if (!self_collider_) {
|
if (!self_collider_) {
|
||||||
self_collider_ = new CircleCollider();
|
self_collider_ = new CircleCollider();
|
||||||
@ -81,6 +125,7 @@ void Obstacle::RecalcSelfCollider()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Obstacle::FillMFObjectPart(cs::MFObjectPart* part_data)
|
void Obstacle::FillMFObjectPart(cs::MFObjectPart* part_data)
|
||||||
|
@ -169,8 +169,8 @@ void Room::ShuaAndroid()
|
|||||||
|
|
||||||
void Room::ShuaObstacle(Human* hum)
|
void Room::ShuaObstacle(Human* hum)
|
||||||
{
|
{
|
||||||
MetaData::MapThing* a_thing = MetaMgr::Instance()->GetMapThing(61001);
|
MetaData::MapThing* a_thing = MetaMgr::Instance()->GetMapThing(61101);
|
||||||
MetaData::MapThing* b_thing = MetaMgr::Instance()->GetMapThing(61007);
|
MetaData::MapThing* b_thing = MetaMgr::Instance()->GetMapThing(61401);
|
||||||
if (!a_thing || !b_thing) {
|
if (!a_thing || !b_thing) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ message LootObjJson
|
|||||||
|
|
||||||
message BuildingJson
|
message BuildingJson
|
||||||
{
|
{
|
||||||
optional int32 id = 1;
|
// optional int32 id = 1;
|
||||||
optional float tileheight = 2;
|
optional float tileheight = 2;
|
||||||
optional float tilewidth = 3;
|
optional float tilewidth = 3;
|
||||||
repeated DoorObjJson doorObj = 4;
|
repeated DoorObjJson doorObj = 4;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user