Game Development Reference
In-Depth Information
Adding external helper functions
Some additional helper functions come in handy when determining whether the ASM
already has a state or transition and what is the current state the ASM is in:
Sandbox.lua :
function AnimationStateMachine.ContainsState(self, stateName)
return self.states_[stateName] ~= nil;
end
function AnimationStateMachine.ContainsTransition(
self, fromStateName, toStateName)
return self.transitions_[fromStateName] ~= nil and
self.transitions_[fromStateName][toStateName] ~= nil;
end
function AnimationStateMachine.GetCurrentStateName(self)
if (self.currentState_) then
return self.currentState_.name_;
end
end
Search WWH ::




Custom Search