Added more scripts
This commit is contained in:
1 parent
63c9d7b35b
commit
403b93e7f5
5 files changed
+47
-13
No files matched your search
+8
-1
@@ -17,8 +17,10 @@ void Character::setTexture(std::shared_ptr<Texture> tex) {
|
||||
texture = tex;
|
||||
}
|
||||
|
||||
void Character::setTarget(const Eigen::Vector3f& target) {
|
||||
void Character::setTarget(const Eigen::Vector3f& target,
|
||||
std::function<void()> onArrived) {
|
||||
walkTarget = target;
|
||||
onArrivedCallback = std::move(onArrived);
|
||||
}
|
||||
|
||||
AnimationState Character::resolveActiveState() const {
|
||||
@@ -45,6 +47,11 @@ void Character::update(int64_t deltaMs) {
|
||||
currentState = AnimationState::WALK;
|
||||
} else {
|
||||
currentState = AnimationState::IDLE;
|
||||
if (onArrivedCallback) {
|
||||
auto cb = std::move(onArrivedCallback);
|
||||
onArrivedCallback = nullptr;
|
||||
cb();
|
||||
}
|
||||
}
|
||||
|
||||
// Rotate toward target facing angle at constant angular speed
|
||||
|
||||
Reference in new issue
Block a user