Game Development Reference
In-Depth Information
The die command
The die command is the first command that interacts with the ASM directly. In this case,
the animation controller requests a particular ASM state based on the stance and then sets
the controller to dead, preventing any additional commands from getting executed:
SoldierController.lua :
local function _ExecuteDieCommand(self, agent,
deltaTimeInMillis)
local currentState =
self.asms["soldier"]:GetCurrentStateName();
if (Soldier_IsMoving(agent)) then
-- Slow movement at twice the rate to blend to a
death
-- pose.
Soldier_SlowMovement(agent, deltaTimeInMillis, 2);
end
-- Request the appropriate stance death and immediately
remove
-- physics to prevent other agents from colliding with
the
-- agent's physics capsule.
if (_stance == SoldierController.Stances.STAND) then
if (currentState ~=
Soldier.SoldierStates.STAND_DEAD) then
self.asms["soldier"]:RequestState(
Soldier.SoldierStates.STAND_DEAD);
agent:RemovePhysics();
end
else
if (currentState ~=
Soldier.SoldierStates.CROUCH_DEAD) then
self.asms["soldier"]:RequestState(
Soldier.SoldierStates.CROUCH_DEAD);
Search WWH ::




Custom Search