-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTMXTileAnimationTicker.h
46 lines (36 loc) · 986 Bytes
/
TMXTileAnimationTicker.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// Created by 张诚伟 on 2019/10/30.
//
#ifndef POKEMON_COCOS2DX_TMXTILEANIMATIONTICKER_H
#define POKEMON_COCOS2DX_TMXTILEANIMATIONTICKER_H
#include "TMXLayerEx.h"
namespace pm
{
class TMXLayerEx;
class TMXAnimationTask
{
public:
TMXAnimationTask(TMXLayerEx *layer, TMXAnimation *animation, Vec2 &tilePos);
void tick();
void update(float dt);
TMXLayerEx *_layer;
Vec2 _tilePos;
TMXAnimation *_animation;
uint32_t _currentFrame;
uint32_t _frameCount;
float _timeElapsed;
};
class TMXTileAnimationTicker
{
public:
float _timeElapsed; // 单位为秒
bool _started = false;
std::vector<TMXAnimationTask> _tasks;
TMXLayerEx* _layer;
TMXTileAnimationTicker(TMXLayerEx *layer);
void start(TMXLayerEx *layer);
void update(float dt);
void addTile();
};
}
#endif //POKEMON_COCOS2DX_TMXTILEANIMATIONTICKER_H