Exemple #1
0
// Player Entered The Pickup Area
void AItemPickup::OnBeginOverlap(UPrimitiveComponent* OverlappedComponent,AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult)
{
	if ((OtherActor != nullptr) && (OtherActor != this) && Cast<ARadePlayer>(OtherActor) != nullptr && Cast<ARadePlayer>(OtherActor)->TheInventory != nullptr)
	{
		// BP Event that player entered
		BP_PlayerEntered(Cast<ARadePlayer>(OtherActor));

		// Auto give player the item
		if (bAutoPickup)
		{
			if (Role >= ROLE_Authority)
				PickedUp(Cast<ARadePlayer>(OtherActor));
		}

		// Wait player Input
		else
		{
			// Set player ref of item pickup
			//Cast<ARadePlayer>(OtherActor)->currentPickup = this;
			if (Cast<ARadePlayer>(OtherActor)->IsLocallyControlled())
			{
				if (SkeletalMesh != nullptr)SkeletalMesh->SetRenderCustomDepth(true);
				if (Mesh != nullptr)Mesh->SetRenderCustomDepth(true);
			}
			if (Role >= ROLE_Authority)
				Cast<ARadePlayer>(OtherActor)->currentPickup = this;

		}
	}
}
Exemple #2
0
void AmmoBox::Leftovers(ILTMessage_Read *pMsg)
{
    uint8 numAmmoTypes = pMsg->Readuint8();

    int i;
    for (i = 0; i < numAmmoTypes; i++)
	{
        m_nAmmoId[i]    = pMsg->Readuint8();
        m_nAmmoCount[i] = (int) pMsg->Readint32();

		if (m_nAmmoCount[i] <= 0)
			m_nAmmoId[i] = WMGR_INVALID_ID;

	}

	for (i=numAmmoTypes; i < AB_MAX_TYPES; i++)
	{
		m_nAmmoId[i] = WMGR_INVALID_ID;
		m_nAmmoCount[i] = 0;
	}

	PlayPickedupSound();
	
	// If in a deathmatch game we should act like the ammobox was empty and pick it up
	// if anything from the box was taken.
	
	if( !IsCoopMultiplayerGameType() )
	{
		PickedUp( LTNULL );
	}
}
void CPickupRecvPackets::Parse( Packet* p )
{
	if ( p )
	{
		unsigned char ucPacket1 = 0, ucPacket2 = 0;

		m_pPacket = p;

		bs = RakNet::BitStream( (char*)p->data, p->bitSize, false );

		bs.Read( ucPacket1 );
		bs.ReadCompressed( ucPacket2 );

		switch ( ucPacket2 )
		{
		case ID_PICKUP_CREATEPICKUP:
			NewPickup();
			break;

		case ID_PICKUP_PICKEDUP:
			PickedUp();
			break;

		case ID_PICKUP_DELETEPICKUP:
			DelPickup();
			break;
		}
	}
}
Exemple #4
0
void AItemPickup::OnBeginOverlap(AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult)
{
	if ((OtherActor != NULL) && (OtherActor != this) && (OtherComp != NULL) && Cast<ARadeCharacter>(OtherActor) != NULL && Cast<ARadeCharacter>(OtherActor)->TheInventory!=NULL)
	{
	
		if (bAutoPickup)
		{
			PickedUp(OtherActor);
		}
		else
		{
			Cast<ARadeCharacter>(OtherActor)->currentPickup = this;
			if (SkeletalMesh)SkeletalMesh->SetRenderCustomDepth(true);
			if (Mesh)Mesh->SetRenderCustomDepth(true);
		}
	}
}
Exemple #5
0
uint32 PickupItem::ObjectMessageFn(HOBJECT hSender, ILTMessage_Read *pMsg)
{
	pMsg->SeekTo(0);
	uint32 messageID = pMsg->Readuint32();

	switch(messageID)
	{
		case MID_PICKEDUP:
		{
			PickedUp(pMsg);
		}
		break;

		default: break;
	}

	return GameBase::ObjectMessageFn(hSender, pMsg);
}
Exemple #6
0
DDWORD PickupObject::ObjectMessageFn(HOBJECT hSender, DDWORD messageID, HMESSAGEREAD hRead)
{
	if( g_pServerDE )
	{
		switch(messageID)
		{
			case MID_PICKEDUP:
			{
				PickedUp (hRead);
				break;
			}
/*
			case MID_TRIGGER:
			{
				HandleTrigger(hSender, hRead);
				break;
			}
*/
			default: break;
		}
	}

	return B2BaseClass::ObjectMessageFn (hSender, messageID, hRead);
}