Game Development Reference
In-Depth Information
The fall command
The fall command acts similar to the fall state we've implemented previously, except that
it's implemented as an animation controller command callback:
SoldierController.lua :
local function _ExecuteFallingCommand(
self, agent, deltaTimeInMillis)
local currentState =
self.asms["soldier"]:GetCurrentStateName();
-- Since there's no falling animation, move the soldier
into
-- an idle animation.
if (currentState ~=
Soldier.SoldierStates.STAND_FALL_IDLE and
currentState ~=
Soldier.SoldierStates.STAND_FALL_DEAD) then
self.asms["soldier"]:RequestState(
Soldier.SoldierStates.STAND_FALL_IDLE);
end
-- Once the soldier is no longer falling, play a death
-- animation.
if (not Soldier_IsFalling(agent)) then
if (currentState ~=
Soldier.SoldierStates.STAND_FALL_DEAD) then
self.asms["soldier"]:RequestState(
Soldier.SoldierStates.STAND_FALL_DEAD);
-- Remove the soldier from physics once the
death
-- animation starts playing.
agent:RemovePhysics();
end
Search WWH ::




Custom Search