protected void launchMissile() { // 发射导弹 bool success = false; if (mAimTarget != null) { MissileParam param = new MissileParam(); param.mPosition = mPlayer.getPosition() + new Vector3(0.0f, 2.5f, 0.0f); param.mTarget = mAimTarget; SceneMissile missile = mItemManager.createItem <SceneMissile>(SCENE_ITEM.SI_MISSILE, param); if (mPlayer.isType(CHARACTER_TYPE.CT_MYSELF)) { GameTools.PLAY_AUDIO_OBJECT(missile, SOUND_DEFINE.SD_FIRE_MISSILE); } // 通知锁定玩家 CommandCharacterNotifyMissileLocked cmdLock = newCmd(out cmdLock); cmdLock.mLocked = true; cmdLock.mMissile = missile; pushCommand(cmdLock, mAimTarget); success = true; } // 移除瞄准状态 CommandCharacterRemoveState cmdState = newCmd(out cmdState); cmdState.mState = mType; pushCommand(cmdState, mPlayer); // 发射成功后移除角色背包中的导弹道具 if (success) { CommandCharacterRemoveItem cmdRemove = newCmd(out cmdRemove); cmdRemove.mItem = mPlayer.getPlayerPack().getCurItem(); pushCommand(cmdRemove, mPlayer); } }
public override void use(CharacterOther player) { // 添加加速状态 BOOL result = new BOOL(); CommandCharacterAddState cmdState = newCmd(out cmdState); cmdState.mState = PLAYER_STATE.PS_SPRINT; cmdState.mResult = result; pushCommand(cmdState, player); // 添加状态成功后移除背包中的道具 if (result.mValue) { CommandCharacterRemoveItem cmdRemove = newCmd(out cmdRemove); cmdRemove.mItem = this; pushCommand(cmdRemove, player); } }
public override void use(CharacterOther player) { // 在角色当前位置放置一个地雷 Vector3 curRot = player.getRotation(); Vector3 dir = MathUtility.getVectorFromAngle(curRot.y * Mathf.Deg2Rad); Vector3 pos = player.getPosition() - dir * 2.0f; LandmineParam param = new LandmineParam(); param.mPosition = pos; SceneLandMine landmine = mItemManager.createItem <SceneLandMine>(SCENE_ITEM.SI_LAND_MINE, param); if (player.isType(CHARACTER_TYPE.CT_MYSELF)) { GameTools.PLAY_AUDIO_OBJECT(landmine, SOUND_DEFINE.SD_PUT_LANDMINE); } // 使用后立即移除背包中的道具 CommandCharacterRemoveItem cmdRemove = newCmd(out cmdRemove); cmdRemove.mItem = this; pushCommand(cmdRemove, player); }