8 int mapH,
float tileSize,
float duration)
9 : _visual(visual), _duration(duration)
15 int dx = abs(toX - fromX);
16 int dy = abs(toY - fromY);
17 _wraps = (dx > 1 || dy > 1);
20 float halfW = mapW * tileSize / 2.0f;
21 float halfH = mapH * tileSize / 2.0f;
29 float dir = (toX < fromX) ? 1.0f : -1.0f;
34 float dir = (toY < fromY) ? 1.0f : -1.0f;
43 float total = d1 + d2;
44 _splitT = (total > 0.0f) ? (d1 / total) : 0.5f;
54 if (t > 1.0f) t = 1.0f;
MoveBehavior(VisualState &visual, int fromX, int fromY, int toX, int toY, int mapW, int mapH, float tileSize, float duration)
bool isDone() const override
Returns true when the behavior has completed and can be removed.
static float _smoothstep(float t)
void update(float dt) override
static Vector3 tileToWorld(int tileX, int tileY, int worldWidth, int worldHeight, float tileSize)
Converts tile coordinates to world coordinates (centered on tile).
Visual-only state for an entity, driven by behaviors each frame. Logical state (x,...