Exemple #1
0
 public override void keyProcess(float elapsedTime)
 {
     if (mGameInputManager.getKeyCurrentDown(KeyCode.A))
     {
         CommandCharacterUseItem cmd = newCmd(out cmd);
         cmd.mItemIndex = mPlayer.getPlayerPack().getSelectedIndex();
         pushCommand(cmd, mPlayer);
     }
     //切换道具
     if (mGameInputManager.getKeyCurrentDown(KeyCode.B))
     {
         if (mPlayer.getPlayerPack().canChangeSelection())
         {
             pushCommand <CommandCharacterSelectItem>(mPlayer);
         }
     }
     // 仅测试用
     if (mGameInputManager.getKeyCurrentDown(KeyCode.Alpha1))
     {
         CommandCharacterGetItem cmd = newCmd(out cmd);
         cmd.mItemType = PLAYER_ITEM.PI_MISSILE;
         pushCommand(cmd, mPlayer);
     }
     if (mGameInputManager.getKeyCurrentDown(KeyCode.Alpha2))
     {
         CommandCharacterGetItem cmd = newCmd(out cmd);
         cmd.mItemType = PLAYER_ITEM.PI_SHIELD;
         pushCommand(cmd, mPlayer);
     }
     if (mGameInputManager.getKeyCurrentDown(KeyCode.Alpha3))
     {
         CommandCharacterGetItem cmd = newCmd(out cmd);
         cmd.mItemType = PLAYER_ITEM.PI_TURBO;
         pushCommand(cmd, mPlayer);
     }
     if (mGameInputManager.getKeyCurrentDown(KeyCode.Alpha4))
     {
         CommandCharacterGetItem cmd = newCmd(out cmd);
         cmd.mItemType = PLAYER_ITEM.PI_LAND_MINE;
         pushCommand(cmd, mPlayer);
     }
     // 上方向键增加速度
     if (mGameInputManager.getKeyCurrentDown(KeyCode.UpArrow))
     {
         CommandCharacterHardwareSpeed cmdPassValue = newCmd(out cmdPassValue, false);
         cmdPassValue.mSpeed = mPlayer.getCharacterData().mSpeed + 1.0f;
         pushCommand(cmdPassValue, mPlayer);
     }
     // 下方向键降低速度
     if (mGameInputManager.getKeyCurrentDown(KeyCode.DownArrow))
     {
         CommandCharacterHardwareSpeed cmdPassValue = newCmd(out cmdPassValue, false);
         cmdPassValue.mSpeed = mPlayer.getCharacterData().mSpeed - 1.0f;
         pushCommand(cmdPassValue, mPlayer);
     }
     if (mGameInputManager.getKeyCurrentDown(KeyCode.Space))
     {
         pushCommand <CommandCharacterJump>(mPlayer);
     }
 }
Exemple #2
0
 public void notifyAIGetBoxItem(PlayerItemBase playerItem)
 {
     if (playerItem.getItemType() != PLAYER_ITEM.PI_MISSILE)
     {
         CommandCharacterUseItem cmd = newCmd(out cmd);
         cmd.mItemIndex = mCharacter.getPlayerPack().getSelectedIndex();
         pushCommand(cmd, mCharacter);
     }
 }