void KeyControlledTransitionCharacter_cl::ProcessKeyboardEvents() { if(!m_bKeyboardInputAllowed) return; bool bLeft = m_pInputMap->GetTrigger(CHARACTER_MOVE_LEFT)!=0; bool bRight = m_pInputMap->GetTrigger(CHARACTER_MOVE_RIGHT)!=0; bool bUp = m_pInputMap->GetTrigger(CHARACTER_MOVE_FORWARD)!=0; bool bDown = m_pInputMap->GetTrigger(CHARACTER_MOVE_BACKWARD)!=0; bool bShift = m_pInputMap->GetTrigger(CHARACTER_RUN)!=0; if (bUp) { // Trigger the run/walk actions when CURSOR UP is pressed. // Allow rotating the entity while walking/running if (bShift) Run(); else Walk(); if (bLeft) RotateLeft(); else if (bRight) RotateRight(); } else if (bDown) { // Trigger the walk backward action when CURSOR DOWN is pressed. // Allow rotating the entity while walking backwards WalkBackwards(); if (bLeft) RotateLeft(); else if (bRight) RotateRight(); } else { if (bLeft) RotateLeft(); else if (bRight) RotateRight(); else Stand(); } }
void KeyControlledAnimatedCharacter_cl::ProcessKeyboardEvents() { bool bLeft = m_pInputMap->GetTrigger(CHARACTER_MOVE_LEFT)!=0; bool bRight = m_pInputMap->GetTrigger(CHARACTER_MOVE_RIGHT)!=0; bool bUp = m_pInputMap->GetTrigger(CHARACTER_MOVE_FORWARD)!=0; bool bDown = m_pInputMap->GetTrigger(CHARACTER_MOVE_BACKWARD)!=0; bool bShift = m_pInputMap->GetTrigger(CHARACTER_RUN)!=0; bool bRaiseLowerWeapon = m_pInputMap->GetTrigger(CHARACTER_TOGGLE_WEAPON)!=0; bool bAttack = m_pInputMap->GetTrigger(CHARACTER_ATTACK)!=0; if (bUp) { // trigger the run/walk actions when CURSOR UP is pressed. // allow rotating the entity while walking/running if ( bShift ) Run(); else Walk(); if (bLeft) RotateLeft(); else if (bRight) RotateRight(); } else if(bDown) { // trigger the walk backward action when CURSOR DOWN is pressed. // allow rotating the entity while walking backwards WalkBackwards(); if(bLeft) RotateLeft(); else if(bRight) RotateRight(); } else { // switch to stand action if character is not rotating ??????????? if ( !IsInRotateState() && !IsInRotateArmedState() ) Stand(); // trigger rotate actions if CURSOR LEFT/RIGHT is pressed, otherwise trigger stand action if(bLeft) RotateLeft(); else if(bRight) RotateRight(); else Stand(); } // raise or lower weapon on SPACE key if(bRaiseLowerWeapon) { if(IsInUpperBodyIdleState()||IsInUpperBodyLowerWeaponState()) Arm(); else if(IsInUpperBodyIdleArmedState()||IsInUpperBodyDrawWeaponState()) DisArm(); } // attack on ENTER key if ( bAttack ) GetUpperBodyState()->Attack(); }