• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetPassenger函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetPassenger函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPassenger函数的具体用法?C++ GetPassenger怎么用?C++ GetPassenger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetPassenger函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: InstallAccessory

void Vehicle::InstallAccessory (uint32 entry, int8 seatId, bool minion)
{
    if (Unit *passenger = GetPassenger(seatId))
    {
        // already installed
        if (passenger->GetEntry() == entry)
        {
            ASSERT(passenger->GetTypeId() == TYPEID_UNIT);
            if (me->GetTypeId() == TYPEID_UNIT && me->ToCreature()->IsInEvadeMode() && passenger->ToCreature()->IsAIEnabled)
                passenger->ToCreature()->AI()->EnterEvadeMode();
            return;
        }
        passenger->ExitVehicle();          // this should not happen
    }

    if (Creature *accessory = me->SummonCreature(entry, *me, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000))
    {
        if (minion)
            accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY);

        accessory->EnterVehicle(this, seatId);

        if (GetBase()->GetTypeId() == TYPEID_UNIT)
            sScriptMgr->OnInstallAccessory(this, accessory);
    }
}
开发者ID:55887MX,项目名称:CCORE,代码行数:26,代码来源:Vehicle.cpp


示例2: InstallAccessory

void Vehicle::InstallAccessory(uint32 entry, int8 seatId)
{
    if(Unit *passenger = GetPassenger(seatId))
    {
        // already installed
        if(passenger->GetEntry() == entry)
            return;

        passenger->ExitVehicle(); // this should not happen
    }

    const CreatureInfo *cInfo = objmgr.GetCreatureTemplate(entry);
    if(!cInfo)
        return;

    Creature *accessory;
    if(cInfo->VehicleId)
        accessory = SummonVehicle(entry, GetPositionX(), GetPositionY(), GetPositionZ());
    else
        accessory = SummonCreature(entry, GetPositionX(), GetPositionY(), GetPositionZ());
    if(!accessory)
        return;

    accessory->EnterVehicle(this, seatId);
    // This is not good, we have to send update twice
    accessory->SendMovementFlagUpdate();
}
开发者ID:MilchBuby,项目名称:riboncore,代码行数:27,代码来源:Vehicle.cpp


示例3: GetPassenger

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
bool CBaseTFVehicle::GetPassengerExitPoint( int nRole, Vector *pAbsPosition, QAngle *pAbsAngles )
{
	// FIXME: Clean this up
	CBasePlayer *pPlayer = GetPassenger(nRole);
	GetPassengerExitPoint( pPlayer, nRole, pAbsPosition, pAbsAngles );
	return true;
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:10,代码来源:basetfvehicle.cpp


示例4: InstallAccessory

void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion)
{
    if (Unit *passenger = GetPassenger(seatId))
    {
        // already installed
        if (passenger->GetEntry() == entry)
        {
            assert(passenger->GetTypeId() == TYPEID_UNIT);
            if (me->GetTypeId() == TYPEID_UNIT && me->ToCreature()->IsInEvadeMode() && passenger->ToCreature()->IsAIEnabled)
                passenger->ToCreature()->AI()->EnterEvadeMode();
            return;
        }
        passenger->ExitVehicle(); // this should not happen
    }

    //TODO: accessory should be minion
    if (Creature *accessory = me->SummonCreature(entry, *me, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000))
    {
        if (minion)
            accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY);
        accessory->EnterVehicle(this, seatId);
        // This is not good, we have to send update twice
        accessory->SendMovementFlagUpdate();
    }
}
开发者ID:LolJK,项目名称:PhantomCore,代码行数:25,代码来源:Vehicle.cpp


示例5: InstallAccessory

void VehicleKit::InstallAccessory(VehicleAccessory const* accessory)
{
    if (Unit *passenger = GetPassenger(accessory->uiSeat))
    {
        // already installed
        if (passenger->GetEntry() == accessory->uiAccessory)
            return;

        passenger->ExitVehicle();
    }

    if (Creature* summoned = m_pBase->SummonCreature(accessory->uiAccessory,
        m_pBase->GetPositionX() + accessory->m_offsetX, m_pBase->GetPositionY() + accessory->m_offsetY, m_pBase->GetPositionZ() + accessory->m_offsetZ, m_pBase->GetOrientation() + accessory->m_offsetX,
        TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000))
    {
        SetDestination(accessory->m_offsetX,accessory->m_offsetY,accessory->m_offsetZ,accessory->m_offsetO,0.0f,0.0f);
        summoned->SetCreatorGuid(ObjectGuid());
        summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
        summoned->EnterVehicle(m_pBase, accessory->uiSeat);
        SetDestination();
        if (summoned->GetVehicle())
            DEBUG_LOG("Vehicle::InstallAccessory %s accessory added, seat %u of %s",summoned->GetObjectGuid().GetString().c_str(), accessory->uiSeat, m_pBase->GetObjectGuid().GetString().c_str());
        else
        {
            sLog.outError("Vehicle::InstallAccessory cannot install %s to seat %u of %s",summoned->GetObjectGuid().GetString().c_str(), accessory->uiSeat, m_pBase->GetObjectGuid().GetString().c_str());
            summoned->ForcedDespawn();
        }
    }
    else
        sLog.outError("Vehicle::InstallAccessory cannot summon creature id %u (seat %u of %s)",accessory->uiAccessory, accessory->uiSeat,m_pBase->GetObjectGuid().GetString().c_str());
}
开发者ID:X-src,项目名称:VektorEmu_3.3.5a_mangos,代码行数:31,代码来源:Vehicle.cpp


示例6: GetDriver

CClientPlayer * CClientVehicle::GetOccupant(BYTE byteSeatId)
{
	if(byteSeatId == 0)
		return GetDriver();

	return GetPassenger(byteSeatId - 1);
}
开发者ID:Azon099,项目名称:networked-iv,代码行数:7,代码来源:CClientVehicle.cpp


示例7: InstallAccessory

void VehicleKit::InstallAccessory(VehicleAccessory const* accessory)
{
    if (Unit* passenger = GetPassenger(accessory->seatId))
    {
        // already installed
        if (passenger->GetEntry() == accessory->passengerEntry)
            return;
        GetBase()->RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE, passenger->GetObjectGuid());
    }

    if (Creature* summoned = GetBase()->SummonCreature(accessory->passengerEntry,
        GetBase()->GetPositionX() + accessory->m_offsetX, GetBase()->GetPositionY() + accessory->m_offsetY, GetBase()->GetPositionZ() + accessory->m_offsetZ, GetBase()->GetOrientation() + accessory->m_offsetX,
        TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000))
    {
        summoned->SetCreatorGuid(ObjectGuid());
        summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
        int32 seatId = accessory->seatId + 1;
        SetDestination(accessory->m_offsetX,accessory->m_offsetY,accessory->m_offsetZ,accessory->m_offsetO,0.0f,0.0f);
        summoned->CastCustomSpell(GetBase(), SPELL_RIDE_VEHICLE_HARDCODED, &seatId, &seatId, NULL, true);

        SetDestination();
        if (summoned->GetVehicle())
            DEBUG_LOG("Vehicle::InstallAccessory %s accessory added, seat %i (real %i) of %s",summoned->GetObjectGuid().GetString().c_str(), accessory->seatId, GetSeatId(summoned), GetBase()->GetObjectGuid().GetString().c_str());
        else
        {
            sLog.outError("Vehicle::InstallAccessory cannot install %s to seat %u of %s",summoned->GetObjectGuid().GetString().c_str(), accessory->seatId, GetBase()->GetObjectGuid().GetString().c_str());
            summoned->ForcedDespawn();
        }
    }
    else
        sLog.outError("Vehicle::InstallAccessory cannot summon creature id %u (seat %u of %s)",accessory->passengerEntry, accessory->seatId,GetBase()->GetObjectGuid().GetString().c_str());
}
开发者ID:mynew3,项目名称:mangos,代码行数:32,代码来源:Vehicle.cpp


示例8: InstallAccessory

void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool isVehicle, bool minion)
{
    if(Unit *passenger = GetPassenger(seatId))
    {
        // already installed
        if(passenger->GetEntry() == entry)
        {
            assert(passenger->GetTypeId() == TYPEID_UNIT);
            return;
        }
        passenger->ExitVehicle(); // this should not happen
    }

    //TODO: accessory should be minion
    if(isVehicle)
    {
        if(Vehicle *accessory = SummonVehicle(entry, 0, 0, 0, 0))
        {
            accessory->EnterVehicle(this, seatId, true);
            // This is not good, we have to send update twice
            accessory->BuildVehicleInfo(accessory);
        }
    }else{
        if(Creature *accessory = SummonCreature(entry, 0, 0, 0, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000))
        {
            accessory->EnterVehicle(this, seatId);
            // This is not good, we have to send update twice
            WorldPacket data;
            accessory->BuildHeartBeatMsg(&data);
            accessory->SendMessageToSet(&data, false);
        }
    }
}
开发者ID:X-Core,项目名称:X-core-addons,代码行数:33,代码来源:Vehicle.cpp


示例9: GetPower

void Vehicle::RegeneratePower(Powers power)
{
    uint32 curValue = GetPower(power);
    uint32 maxValue = GetMaxPower(power);

    if (curValue >= maxValue)
        return;

    float addvalue = 0.0f;

    // hack: needs more research of power type from the dbc. 
    // It must contains some info about vehicles like Salvaged Chopper.
    if(m_vehicleInfo->m_powerType == POWER_TYPE_PYRITE)
        return;

    addvalue = 10.0f;

    ModifyPower(power, (int32)addvalue);

    for(int i =0; i != MAX_SEAT; i++)
    {
        if(Unit *pPassanger = GetPassenger(i))
        {
            if(pPassanger->GetTypeId() == TYPEID_PLAYER)
                SendCreateUpdateToPlayer((Player*)pPassanger);
        }
    }

}
开发者ID:X-Core,项目名称:X-core-addons,代码行数:29,代码来源:Vehicle.cpp


示例10: Relocate

void Vehicle::Relocate(Position pos)
{
    sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::Relocate %u", _me->GetEntry());

    std::set<Unit*> vehiclePlayers;
    for (int8 i = 0; i < 8; i++)
        vehiclePlayers.insert(GetPassenger(i));

    // passengers should be removed or they will have movement stuck
    RemoveAllPassengers();

    for (std::set<Unit*>::const_iterator itr = vehiclePlayers.begin(); itr != vehiclePlayers.end(); ++itr)
    {
        if (Unit* plr = (*itr))
        {
            // relocate/setposition doesn't work for player
            plr->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
            //plr->TeleportTo(pPlayer->GetMapId(), triggerPos.GetPositionX(), triggerPos.GetPositionY(), triggerPos.GetPositionZ(), triggerPos.GetOrientation(), TELE_TO_NOT_LEAVE_COMBAT);
        }
    }

    _me->UpdatePosition(pos, true);
    // problems, and impossible to do delayed enter
    //pPlayer->EnterVehicle(veh);
}
开发者ID:Anonymus123,项目名称:AtomicCore-3.3.5a,代码行数:25,代码来源:Vehicle.cpp


示例11: GetCreatureAddon

void Vehicle::InstallAllAccessories()
{
    if(!GetMap())
       return;

    CreatureDataAddon const *cainfo = GetCreatureAddon();
    if(!cainfo || !cainfo->passengers)
        return;
    for (CreatureDataAddonPassengers const* cPassanger = cainfo->passengers; cPassanger->seat_idx != -1; ++cPassanger)
    {
        // Continue if seat already taken
        if(GetPassenger(cPassanger->seat_idx))
            continue;

        uint32 guid = 0;
        bool isVehicle = false;
        // Set guid and check whatever it is
        if(cPassanger->guid != 0)
            guid = cPassanger->guid;
        else
        {
            CreatureDataAddon const* passAddon;
            passAddon = ObjectMgr::GetCreatureTemplateAddon(cPassanger->entry);
            if(passAddon && passAddon->vehicle_id != 0)
                isVehicle = true;
            else
                guid = sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT);
        }
        // Create it
        Creature *pPassenger = new Creature;
        if(!isVehicle)
        {
            uint32 entry = cPassanger->entry;
            if(entry == 0)
            {
                CreatureData const* data = sObjectMgr.GetCreatureData(guid);
                if(!data)
                    continue;
                entry = data->id;
            }     
            
            if(!pPassenger->Create(guid, GetMap(), GetPhaseMask(), entry, 0))
                continue;
            pPassenger->LoadFromDB(guid, GetMap());
            pPassenger->Relocate(GetPositionX(), GetPositionY(), GetPositionZ());
            GetMap()->Add(pPassenger);
            pPassenger->AIM_Initialize();
        }
        else
            pPassenger = (Creature*)SummonVehicle(cPassanger->entry, GetPositionX(), GetPositionY(), GetPositionZ(), 0);
        // Enter vehicle...
        pPassenger->EnterVehicle(this, cPassanger->seat_idx, true);
        // ...and send update. Without this, client wont show this new creature/vehicle...
        WorldPacket data;
        pPassenger->BuildHeartBeatMsg(&data);
        pPassenger->SendMessageToSet(&data, false);
    }
}
开发者ID:sc0rpio0o,项目名称:diamondcore,代码行数:58,代码来源:Vehicle.cpp


示例12: Assert

//-----------------------------------------------------------------------------
// Purpose: Modify the player view/camera while in a vehicle
//-----------------------------------------------------------------------------
void CFourWheelServerVehicle::GetVehicleViewPosition( int nRole, Vector *pAbsOrigin, QAngle *pAbsAngles )
{
	Assert( nRole == VEHICLE_DRIVER );
	CBasePlayer *pPlayer = GetPassenger( VEHICLE_DRIVER );
	Assert( pPlayer );

	*pAbsAngles = pPlayer->EyeAngles(); // yuck. this is an in/out parameter.
	GetFourWheelVehiclePhysics()->GetVehicleViewPosition( "vehicle_driver_eyes", 1.0f, pAbsOrigin, pAbsAngles );
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:12,代码来源:vehicle_base.cpp


示例13: GetOwner

int CBaseTFVehicle::LocateEntryPoint( CBaseTFPlayer *pPlayer, float* fBest2dDistanceSqr )
{
	// Get the players origin and compare it to all the entry points on the
	// vehicle.
	Vector vecPlayerPos = pPlayer->GetAbsOrigin();
	Vector vecEntryPos;
	QAngle vecEntryAngle;

	int   iMinEntry = -1;
	float flMinDistance2 = INITIAL_MAX_DISTANCE;

	// Is the player the owner of the vehicle?
	bool bOwner = ( pPlayer == GetOwner() );

	char szPassengerEyes[32];
	for( int iEntryPoint = 0; iEntryPoint < m_nMaxPassengers; ++iEntryPoint )
	{
		// If not the owner, check to see if the entry point is available.  The
		// entry point is always available for the owner.
		bool bOccupied = ( GetPassenger( iEntryPoint ) != NULL );

		// Also check for child vehicles...

		if ( bOccupied && !bOwner )
			continue;
	
		// FIXME: Cache off the entry point
		Q_snprintf( szPassengerEyes, sizeof( szPassengerEyes ), "vehicle_feet_passenger%d", iEntryPoint );
		int nAttachmentIndex = LookupAttachment( szPassengerEyes );

		float flDistance2;
		if (nAttachmentIndex > 0)
		{
			GetAttachment( nAttachmentIndex, vecEntryPos, vecEntryAngle );
			Vector vecDelta = vecEntryPos - vecPlayerPos;
			flDistance2 = vecDelta.AsVector2D().LengthSqr();
		}
		else
		{
			// No attachment? Choose it if we must as a last resort
			flDistance2 = INITIAL_MAX_DISTANCE - 1;
		}

		if ( flDistance2 < flMinDistance2 )
		{
			flMinDistance2 = flDistance2;
			iMinEntry = iEntryPoint;
		}
	}

	if( fBest2dDistanceSqr )
	{
		*fBest2dDistanceSqr = flMinDistance2;
	}
	return iMinEntry;
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:56,代码来源:basetfvehicle.cpp


示例14: Assert

void CAPC2FourWheelServerVehicle::GetVehicleViewPosition( int nRole, Vector *pAbsOrigin, QAngle *pAbsAngles )
{
	//FixMe, wtf?
	#ifndef DEBUG
	Assert( nRole == VEHICLE_DRIVER );
	#endif
	CBaseCombatCharacter *pPlayer = GetPassenger( VEHICLE_ROLE_DRIVER );
	Assert( pPlayer );

	float flPitchFactor=1.0;
	*pAbsAngles = pPlayer->EyeAngles();
	matrix3x4_t vehicleEyePosToWorld;
	Vector vehicleEyeOrigin;
	QAngle vehicleEyeAngles;
	GetAPC()->GetAttachment( "cannon_muzzle", vehicleEyeOrigin, vehicleEyeAngles );
	Vector up,forward;
	GetAPC()->GetVectors(NULL,&forward,&up);
	vehicleEyeOrigin+=(forward*37)+(up*35);
	AngleMatrix( vehicleEyeAngles, vehicleEyePosToWorld );

//#ifdef HL2_DLL
//	// View dampening.
//	if ( r_VehicleViewDampen.GetInt() )
//	{
//		GetAPC()->DampenEyePosition( vehicleEyeOrigin, vehicleEyeAngles );
//	}
//#endif

	// Compute the relative rotation between the unperterbed eye attachment + the eye angles
	matrix3x4_t cameraToWorld;
	AngleMatrix( *pAbsAngles, cameraToWorld );

	matrix3x4_t worldToEyePos;
	MatrixInvert( vehicleEyePosToWorld, worldToEyePos );

	matrix3x4_t vehicleCameraToEyePos;
	ConcatTransforms( worldToEyePos, cameraToWorld, vehicleCameraToEyePos );

	// Now perterb the attachment point
	vehicleEyeAngles.x = RemapAngleRange( PITCH_CURVE_ZERO * flPitchFactor, PITCH_CURVE_LINEAR, vehicleEyeAngles.x );
	vehicleEyeAngles.z = RemapAngleRange( ROLL_CURVE_ZERO * flPitchFactor, ROLL_CURVE_LINEAR, vehicleEyeAngles.z );
	AngleMatrix( vehicleEyeAngles, vehicleEyeOrigin, vehicleEyePosToWorld );

	// Now treat the relative eye angles as being relative to this new, perterbed view position...
	matrix3x4_t newCameraToWorld;
	ConcatTransforms( vehicleEyePosToWorld, vehicleCameraToEyePos, newCameraToWorld );

	// output new view abs angles
	MatrixAngles( newCameraToWorld, *pAbsAngles );

	// UNDONE: *pOrigin would already be correct in single player if the HandleView() on the server ran after vphysics
	MatrixGetColumn( newCameraToWorld, 3, *pAbsOrigin );
}
开发者ID:WorldGamers,项目名称:Mobile-Forces-Source,代码行数:53,代码来源:vehicle_apc2.cpp


示例15: TeleportVehicle

void Vehicle::TeleportVehicle(float x, float y, float z, float ang)
{
    vehiclePlayers.clear();
    for (int8 i = 0; i < 8; i++)
        if (Unit* player = GetPassenger(i))
            vehiclePlayers.insert(player->GetGUID());

    RemoveAllPassengers(); // this can unlink Guns from Siege Engines
    _me->NearTeleportTo(x, y, z, ang);
    for (GuidSet::const_iterator itr = vehiclePlayers.begin(); itr != vehiclePlayers.end(); ++itr)
        if (Unit* player = sObjectAccessor->FindUnit(*itr))
                player->NearTeleportTo(x, y, z, ang);
}
开发者ID:DoGoodS,项目名称:SkyFireEMU,代码行数:13,代码来源:Vehicle.cpp


示例16: InstallAccessory

void VehicleKit::InstallAccessory(VehicleAccessory const* accessory)
{
    if (Unit* passenger = GetPassenger(accessory->seatId))
    {
        // already installed
        if (passenger->GetEntry() == accessory->passengerEntry)
            return;

        GetBase()->RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE, passenger->GetObjectGuid());
    }

    if (Creature* summoned = GetBase()->SummonCreature(accessory->passengerEntry,
        GetBase()->GetPositionX() + accessory->m_offsetX, GetBase()->GetPositionY() + accessory->m_offsetY, GetBase()->GetPositionZ() + accessory->m_offsetZ, GetBase()->GetOrientation() + accessory->m_offsetO,
        TEMPSUMMON_DEAD_DESPAWN, 0))
    {
        summoned->SetCreatorGuid(ObjectGuid());
        summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);

        bool hideAccessory = false;

        SeatMap::const_iterator seat = m_Seats.find(accessory->seatId);
        if (seat != m_Seats.end())
        {
            if (seat->second.seatInfo->m_flags & SEAT_FLAG_HIDE_PASSENGER)  // coommon case
                hideAccessory = true;
        }

        if (!hideAccessory && (accessory->m_flags & ACCESSORY_FLAG_HIDE))
            hideAccessory = true;

        if (hideAccessory)
            summoned->SetDisplayId(DEFAULT_HIDDEN_MODEL_ID); // set to empty model

        SetDestination(accessory->m_offsetX, accessory->m_offsetY, accessory->m_offsetZ, accessory->m_offsetO, 0.0f, 0.0f);
        int32 seatId = accessory->seatId + 1;
        summoned->SetPhaseMask(GetBase()->GetPhaseMask(), true);
        summoned->CastCustomSpell(GetBase(), SPELL_RIDE_VEHICLE_HARDCODED, &seatId, &seatId, NULL, true);

        SetDestination();

        if (summoned->GetVehicle())
            DEBUG_LOG("Vehicle::InstallAccessory %s accessory added, seat %i (real %i) of %s", summoned->GetGuidStr().c_str(), accessory->seatId, GetSeatId(summoned), GetBase()->GetGuidStr().c_str());
        else
        {
            sLog.outError("Vehicle::InstallAccessory cannot install %s to seat %u of %s", summoned->GetGuidStr().c_str(), accessory->seatId, GetBase()->GetGuidStr().c_str());
            summoned->ForcedDespawn();
        }
    }
    else
        sLog.outError("Vehicle::InstallAccessory cannot summon creature id %u (seat %u of %s)", accessory->passengerEntry, accessory->seatId, GetBase()->GetGuidStr().c_str());
}
开发者ID:mangosR2,项目名称:mangos3,代码行数:51,代码来源:Vehicle.cpp


示例17: InstallAccessory

void VehicleKit::InstallAccessory( uint32 entry, int8 seatId, bool minion /*= true*/ )
{
    if (Unit *passenger = GetPassenger(seatId))
    {
        // already installed
        if (passenger->GetEntry() == entry)
            return;

        passenger->ExitVehicle();
    }

    if (Creature *accessory = m_pBase->SummonCreature(entry, m_pBase->GetPositionX(), m_pBase->GetPositionY(), m_pBase->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000))
        accessory->EnterVehicle(this, seatId);
}
开发者ID:eviljared,项目名称:diamondcore,代码行数:14,代码来源:Vehicle.cpp


示例18: ASSERT

void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 type, uint32 summonTime)
{
    if (Unit *passenger = GetPassenger(seatId))
    {
        // already installed
        if (passenger->GetEntry() == entry)
        {
            ASSERT(passenger->GetTypeId() == TYPEID_UNIT);
            if (me->GetTypeId() == TYPEID_UNIT)
            {
                if (me->ToCreature()->IsInEvadeMode() && passenger->ToCreature()->IsAIEnabled)
                {
                    passenger->ToCreature()->AI()->EnterEvadeMode();
                    return;
                }
                else if (passenger->ToTempSummon()->GetSummonType() == TEMPSUMMON_MANUAL_DESPAWN)
                {
                    passenger->ExitVehicle();
                    passenger->ToTempSummon()->DespawnOrUnsummon();
                    ASSERT(!GetPassenger(seatId))
                }
            }
        }
开发者ID:AlexTheBest,项目名称:ACore,代码行数:23,代码来源:Vehicle.cpp


示例19: Relocate

void Vehicle::Relocate(Position pos)
{
    std::set<Unit*> vehiclePlayers;
    for(int8 i = 0; i < 8; i++)
        vehiclePlayers.insert(GetPassenger(i));

    // passengers should be removed or they will have movement stuck
    RemoveAllPassengers();

    for(std::set<Unit*>::const_iterator itr = vehiclePlayers.begin(); itr != vehiclePlayers.end(); ++itr)
    {
        if(Unit* plr = (*itr))
            plr->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
    }

    _me->SetPosition(pos, true);
}
开发者ID:FreedomEmu,项目名称:FreedomEmu,代码行数:17,代码来源:Vehicle.cpp


示例20: GetPassenger

void CWalkerMiniStrider::StartFiringLargeGun()
{
	CBasePlayer *pPlayer = GetPassenger( VEHICLE_DRIVER );
	Assert( pPlayer );
	if ( !pPlayer )
		return;

	// Figure out what we're shooting at.
	Vector vSrc = GetLargeGunShootOrigin();
	
	Vector vEyePos = pPlayer->EyePosition();
	Vector vEyeForward;
	AngleVectors( pPlayer->LocalEyeAngles(), &vEyeForward );

	trace_t trace;
	UTIL_TraceLine( vEyePos, vEyePos + vEyeForward * 2000, MASK_SOLID, this, COLLISION_GROUP_NONE, &trace );
	if ( trace.fraction < 1 )
	{
		m_vLargeGunForward = trace.endpos - vSrc;
		VectorNormalize( m_vLargeGunForward );

		trace_t trace;
		UTIL_TraceLine( vSrc, vSrc + m_vLargeGunForward * 2000, MASK_SOLID, this, COLLISION_GROUP_NONE, &trace );
		if ( trace.fraction < 1 )
		{
			EnableWalkMode( false );

			m_vLargeGunTargetPos = trace.endpos;
			m_flLargeGunCountdown = LARGE_GUN_FIRE_TIME;
			m_bFiringLargeGun = true;
			
			// Show an energy beam until we actually shoot.
			m_pEnergyBeam = CBeam::BeamCreate( "sprites/physbeam.vmt", 25 );
			m_pEnergyBeam->SetColor( 255, 0, 0 ); 
			m_pEnergyBeam->SetBrightness( 100 );
			m_pEnergyBeam->SetNoise( 4 );
			m_pEnergyBeam->PointsInit( vSrc, m_vLargeGunTargetPos );
			m_pEnergyBeam->LiveForTime( LARGE_GUN_FIRE_TIME );

			// Play a charge-up sound.
			CPASAttenuationFilter filter( this, "Skirmisher.GunChargeSound" );
			EmitSound( filter, 0, "Skirmisher.GunChargeSound", &vSrc );
		}
	}
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:45,代码来源:tf_walker_ministrider.cpp



注:本文中的GetPassenger函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetPassword函数代码示例发布时间:2022-05-30
下一篇:
C++ GetParsedAttr函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap