修改OpenGl渲染底层之前
This commit is contained in:
44
source_game/Asset/Character/Chr_Shadow.cpp
Normal file
44
source_game/Asset/Character/Chr_Shadow.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#include "Chr_Shadow.h"
|
||||
#include "Global/Global_Game.h"
|
||||
#include "Actor/Object/CharacterObject.h"
|
||||
#include "Asset/Character/Chr_Equipment.h"
|
||||
|
||||
void Chr_Shadow::Init(CharacterObject *parent)
|
||||
{
|
||||
// 调用RenderBase类的初始化 才能挂上标签
|
||||
RenderBase::Init();
|
||||
chr_parent = parent;
|
||||
SetRenderZOrder(1000000);
|
||||
SetPos(parent->GetPos());
|
||||
}
|
||||
|
||||
void Chr_Shadow::SetAction(std::string actionName)
|
||||
{
|
||||
// 先将原动作的Ani设置为不可见
|
||||
for (auto Ani : ActionAnis[CurrentActionTag])
|
||||
{
|
||||
Ani->Reset();
|
||||
Ani->SetVisible(false);
|
||||
}
|
||||
// 再将新动作的Ani设置为可见
|
||||
for (auto Ani : ActionAnis[actionName])
|
||||
{
|
||||
Ani->SetVisible(true);
|
||||
}
|
||||
CurrentActionTag = actionName;
|
||||
}
|
||||
|
||||
void Chr_Shadow::SetDirection(int dir)
|
||||
{
|
||||
VecFPos sc = GetScale();
|
||||
// 朝右
|
||||
if (dir == 0)
|
||||
{
|
||||
SetScale(VecFPos({SDL_fabsf(sc.x), sc.y}));
|
||||
}
|
||||
// 朝左
|
||||
else if (dir == 1)
|
||||
{
|
||||
SetScale(VecFPos({-SDL_fabsf(sc.x), sc.y}));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user