建档
This commit is contained in:
54
source_game/Actor/Map/GameMapCamera.cpp
Normal file
54
source_game/Actor/Map/GameMapCamera.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
#include "GameMapCamera.h"
|
||||
#include "Actor/Map/GameMap.h"
|
||||
#include "Actor/Object/BaseObject.h"
|
||||
#include <algorithm>
|
||||
|
||||
GameMapCamera::GameMapCamera()
|
||||
{
|
||||
}
|
||||
|
||||
GameMapCamera::~GameMapCamera()
|
||||
{
|
||||
}
|
||||
|
||||
void GameMapCamera::SetParentMap(GameMap *map)
|
||||
{
|
||||
this->_ParentMap = map;
|
||||
_ParentMap->_Camera = this;
|
||||
}
|
||||
|
||||
void GameMapCamera::SetFromActor(BaseObject *actor)
|
||||
{
|
||||
this->_FromActor = actor;
|
||||
}
|
||||
|
||||
void GameMapCamera::Update(float deltaTime)
|
||||
{
|
||||
SyncPosByFromParent(deltaTime);
|
||||
}
|
||||
|
||||
void GameMapCamera::SetPos(int x, int y, int z)
|
||||
{
|
||||
this->X = x;
|
||||
this->Y = y;
|
||||
this->Z = z;
|
||||
}
|
||||
|
||||
void GameMapCamera::AddPos(int x, int y, int z)
|
||||
{
|
||||
this->X += x;
|
||||
this->Y += y;
|
||||
this->Z += z;
|
||||
}
|
||||
|
||||
void GameMapCamera::SyncPosByFromParent(float deltaTime)
|
||||
{
|
||||
if (this->_FromActor != nullptr)
|
||||
{
|
||||
// int R_X, R_Y, R_Z;
|
||||
// R_X = std::min(std::max(this->_FromActor->X, 533), MovableAreaX - 533);
|
||||
// R_Y = std::min(std::max(this->_FromActor->Y, 300), MovableAreaY - 300);
|
||||
// R_Z = 0;
|
||||
// SetPos(R_X, R_Y, R_Z);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user