animation works
This commit is contained in:
parent
ad0760dc7d
commit
186b82c06e
@ -164,7 +164,7 @@ void TMatch3Logic::FillRandomChipMatrix(std::vector<SE::TRenderPairList::iterato
|
||||
|
||||
for (size_t i = 0; i < ChipMatrix.size(); i++) {
|
||||
for (size_t j = 0; j < ChipMatrix[i].size(); j++) {
|
||||
ReplaceAnimation(Eigen::Vector2i(i, j));
|
||||
//ReplaceAnimation(Eigen::Vector2i(i, j));
|
||||
}
|
||||
}
|
||||
|
||||
@ -351,7 +351,6 @@ void TMatch3Logic::UnmatchChips(std::vector<Eigen::Vector2i> chipList)
|
||||
void TMatch3Logic::ReplaceAnimation(Eigen::Vector2i p)
|
||||
{
|
||||
|
||||
|
||||
TChip& chip = ChipMatrix[p[0]][p[1]];
|
||||
|
||||
if (SE::ResourceManager->HalibutAnimationManager.AnimationExists(chip.AnimName))
|
||||
@ -360,13 +359,11 @@ void TMatch3Logic::ReplaceAnimation(Eigen::Vector2i p)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
SE::THalibutExternalAnimObject testAnimObject(Match3FieldParams.ChipTemplateParamsArr[chip.ChipType].SelectedTemplateAnimObject);
|
||||
|
||||
testAnimObject.ReplaceAnimObject(chip.RenderPair, chip.VertexListShift / 6);
|
||||
|
||||
SE::ResourceManager->HalibutAnimationManager.AddAnimationObject(chip.AnimName, testAnimObject);
|
||||
|
||||
}
|
||||
|
||||
SE::ResourceManager->HalibutAnimationManager.StopAnimation(chip.AnimName);
|
||||
@ -385,7 +382,7 @@ void TMatch3Logic::MoveVertexListShiftBack(SE::TRenderPairList::iterator renderP
|
||||
{
|
||||
ChipMatrix[i][j].VertexListShift -= 6;
|
||||
|
||||
ReplaceAnimation(Eigen::Vector2i(i, j));
|
||||
//ReplaceAnimation(Eigen::Vector2i(i, j));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -450,7 +447,7 @@ void TMatch3Logic::AddChipToUp(size_t colNum, int chipType, Eigen::Vector2f spaw
|
||||
|
||||
InnerAddChipToUp(colNum, chipType, spawnPos, chipState);
|
||||
|
||||
ReplaceAnimation(Eigen::Vector2i(colNum, yPos));
|
||||
//ReplaceAnimation(Eigen::Vector2i(colNum, yPos));
|
||||
|
||||
|
||||
}
|
||||
@ -479,7 +476,7 @@ void TMatch3Logic::InsertEmptyChip(size_t colNum, size_t rowNum, int chipType)
|
||||
|
||||
ChipMatrix[colNum].insert(ChipMatrix[colNum].begin() + rowNum, TChip(chipType, RenderPairIteratorVector[renderPairIndex], vertexListShift, chipState));
|
||||
|
||||
ReplaceAnimation(Eigen::Vector2i(colNum, rowNum));
|
||||
//ReplaceAnimation(Eigen::Vector2i(colNum, rowNum));
|
||||
|
||||
|
||||
//triangleList.NeedRefreshBuffer = true;
|
||||
@ -774,12 +771,26 @@ void TMatch3Logic::ChangeChipType(Eigen::Vector2i p)
|
||||
|
||||
//Hack to make sure animation is replaced by new one
|
||||
SE::ResourceManager->HalibutAnimationManager.DeleteAnimationObject(chip.AnimName);
|
||||
ReplaceAnimation(Eigen::Vector2i(p[0], p[1]));
|
||||
//ReplaceAnimation(Eigen::Vector2i(p[0], p[1]));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void TMatch3Logic::innerUpdateAnimation(size_t dt) {
|
||||
for (int i = 0; i < ChipMatrix[0].size(); ++i) {
|
||||
for (int j = 0; j < ChipMatrix[i].size(); ++j) {
|
||||
if (Eigen::Vector2i(i, j) != selectedChip) {
|
||||
ReplaceAnimation(Eigen::Vector2i(i, j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SE::ResourceManager->HalibutAnimationManager.Update(dt);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void TMatch3Logic::SelectChip(Eigen::Vector2i pos)
|
||||
{
|
||||
if (!(selectedChip == Eigen::Vector2i(-1, -1)))
|
||||
@ -1199,9 +1210,9 @@ void TMatch3Field::Update(size_t dt)
|
||||
i->second.RefreshBuffer();
|
||||
}
|
||||
|
||||
innerUpdateAnimation(dt);
|
||||
|
||||
SE::ResourceManager->HalibutAnimationManager.Update(dt);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void TMatch3Field::OnTapDown(Eigen::Vector2f pos)
|
||||
|
@ -214,6 +214,8 @@ protected:
|
||||
|
||||
void ChangeChipType(Eigen::Vector2i p);
|
||||
|
||||
void innerUpdateAnimation(size_t dt);
|
||||
|
||||
public:
|
||||
|
||||
TMatch3Logic();
|
||||
|
Loading…
Reference in New Issue
Block a user