Game Development Reference
In-Depth Information
The shooting state
The shooting state will be the first state to take advantage of ASM callbacks that actually
perform shooting. The only action required by the state is to request the fire or
crouch_fire animation from the ASM.
Note
You can play with the rate of the fire and crouch_fire animations in the Soldi-
er.lua file to change how quickly the agent fires its weapon.
DirectSoldierAgent.lua :
function Agent_ShootState(agent, deltaTimeInMillis)
local currentState = _soldierAsm:GetCurrentStateName();
if (_soldierStance == _soldierStances.STAND) then
-- Slow movement to blend to a shooting pose.
if (Soldier_IsMoving(agent)) then
Soldier_SlowMovement(agent, deltaTimeInMillis);
end
-- Only request the STAND_FIRE state if not
currently
-- playing.
if (currentState ~=
Soldier.SoldierStates.STAND_FIRE) then
_soldierAsm:RequestState(
Soldier.SoldierStates.STAND_FIRE);
end
else
-- Slow movement at twice the rate to blend to a
shooting
-- pose.
if (Soldier_IsMoving(agent)) then
Soldier_SlowMovement(agent, deltaTimeInMillis,
2);
end
Search WWH ::




Custom Search