This commit is contained in:
2026-02-08 16:20:50 +08:00
parent 0ae47e5d6a
commit 8b88904ef7
72 changed files with 5963 additions and 2038 deletions

View File

@@ -1,5 +1,7 @@
#include "CharacterObject.h"
#include "Asset/Squirrel/SquirrelManager.h"
#include "Actor/Map/GameMap.h"
#include "Actor/Map/GameWorld.h"
CharacterObject::~CharacterObject()
{
@@ -12,9 +14,6 @@ void CharacterObject::Construction(int job)
// 创建装备管理器
_EquipmentManager = new Chr_Equipment();
_EquipmentManager->Init(this);
// // 创建阴影对象
// _Shadow = new Chr_Shadow();
// _Shadow->Init(this);
// 创建动画管理器(一定要先创建装备管理器再创建动画管理器 因为需要读取身上的装备)
_AnimationManager = new Chr_Animation();
_AnimationManager->Init(this);
@@ -51,19 +50,35 @@ void CharacterObject::ControllerMsg(CONTROLLER_MSG_TYPE msgType, void *msgData)
}
}
void CharacterObject::Update(float deltaTime)
void CharacterObject::SetPosition(VecFPos3 pos)
{
ActiveObject::Update(deltaTime);
}
void CharacterObject::SetPos(Vec2 pos)
{
BaseObject::SetPos(pos);
if(_Shadow)_Shadow->SetPos(this->GetPos());
BaseObject::SetPosition(pos);
}
void CharacterObject::SetDirection(int dir)
{
BaseObject::SetDirection(dir);
if(_Shadow)_Shadow->SetDirection(this->GetDirection());
}
void CharacterObject::OnUpdate(float deltaTime)
{
ActiveObject::OnUpdate(deltaTime);
// 判断是否要进行区域移动
if (!IsTeleportArea)
{
GameMap::MapMoveArea Info = this->_AffMap->CheckIsItMoveArea(this->GetPosition());
if (Info.town != -2 && Info.area != -2)
{
IsTeleportArea = true;
// 调用世界类移动自己
GameWorld::GetWorld()->MoveCharacter(this, Info.town, Info.area);
}
}
else
{
GameMap::MapMoveArea Info = this->_AffMap->CheckIsItMoveArea(this->GetPosition());
if (Info.town == -2 && Info.area == -2)
IsTeleportArea = false;
}
}