加入 Node节点类 还未测试新框架
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#include "BaseObject.h"
|
||||
#include "Actor/Map/GameMap.h"
|
||||
#include "Actor/Map/GameMapCamera.h"
|
||||
|
||||
BaseObject::BaseObject()
|
||||
{
|
||||
@@ -14,15 +13,13 @@ BaseObject::~BaseObject()
|
||||
|
||||
void BaseObject::Update(float deltaTime)
|
||||
{
|
||||
if (_AffCamera != nullptr)
|
||||
{
|
||||
_AffCamera->SyncPos(deltaTime);
|
||||
}
|
||||
Actor::Update(deltaTime);
|
||||
}
|
||||
|
||||
void BaseObject::SetPosition(VecPos3 pos)
|
||||
void BaseObject::SetPosition(VecFPos3 pos)
|
||||
{
|
||||
if(pos == this->Position)
|
||||
return;
|
||||
if (pos.y != this->Position.y)
|
||||
{
|
||||
SetRenderZOrder(pos.y); // 设置渲染顺序
|
||||
@@ -31,19 +28,23 @@ void BaseObject::SetPosition(VecPos3 pos)
|
||||
SetPos(Vec2{this->Position.x, this->Position.y - this->Position.z});
|
||||
}
|
||||
|
||||
VecPos3 BaseObject::GetPosition()
|
||||
VecFPos3 BaseObject::GetPosition()
|
||||
{
|
||||
return this->Position;
|
||||
}
|
||||
|
||||
void BaseObject::SetXpos(int x)
|
||||
{
|
||||
if (x == this->Position.x)
|
||||
return;
|
||||
this->Position.x = x;
|
||||
SetPos({this->Position.x, this->Position.y - this->Position.z});
|
||||
}
|
||||
|
||||
void BaseObject::SetYpos(int y)
|
||||
{
|
||||
if (y == this->Position.y)
|
||||
return;
|
||||
if (y != this->Position.y)
|
||||
{
|
||||
SetRenderZOrder(y); // 设置渲染顺序
|
||||
@@ -54,6 +55,8 @@ void BaseObject::SetYpos(int y)
|
||||
|
||||
void BaseObject::SetZpos(int z)
|
||||
{
|
||||
if (z == this->Position.z)
|
||||
return;
|
||||
this->Position.z = z;
|
||||
SetPos({this->Position.x, this->Position.y - this->Position.z});
|
||||
}
|
||||
@@ -73,10 +76,12 @@ int BaseObject::GetZpos()
|
||||
return this->Position.z;
|
||||
}
|
||||
|
||||
void BaseObject::MoveBy(VecPos3 pos)
|
||||
void BaseObject::MoveBy(VecFPos3 pos)
|
||||
{
|
||||
// 只有moveby移动时判断所在地图中是否能够这样移动
|
||||
VecPos3 RealPos = this->_AffMap->CheckIsItMovable(GetPosition(), pos);
|
||||
VecFPos3 RealPos = this->_AffMap->CheckIsItMovable(GetPosition(), pos);
|
||||
if (RealPos == this->Position)
|
||||
return;
|
||||
if (RealPos.y != this->Position.y)
|
||||
{
|
||||
SetRenderZOrder(RealPos.y); // 设置渲染顺序
|
||||
@@ -90,7 +95,9 @@ void BaseObject::MoveBy(VecPos3 pos)
|
||||
void BaseObject::MoveBy(int x, int y, int z)
|
||||
{
|
||||
// 只有moveby移动时判断所在地图中是否能够这样移动
|
||||
VecPos3 RealPos = this->_AffMap->CheckIsItMovable(GetPosition(), VecPos3({x, y, z}));
|
||||
VecFPos3 RealPos = this->_AffMap->CheckIsItMovable(GetPosition(), VecFPos3({x, y, z}));
|
||||
if (RealPos == this->Position)
|
||||
return;
|
||||
if (RealPos.y != this->Position.y)
|
||||
{
|
||||
SetRenderZOrder(RealPos.y); // 设置渲染顺序
|
||||
|
||||
Reference in New Issue
Block a user