void AShooterWeapon::OnEquip(const AShooterWeapon* LastWeapon)
{
	AttachMeshToPawn();

	bPendingEquip = true;
	DetermineWeaponState();

	// Only play animation if last weapon is valid
	if (LastWeapon)
	{
		float Duration = PlayWeaponAnimation(EquipAnim);
		if (Duration <= 0.0f)
		{
			// failsafe
			Duration = 0.5f;
		}
		EquipStartedTime = GetWorld()->GetTimeSeconds();
		EquipDuration = Duration;

		GetWorldTimerManager().SetTimer(TimerHandle_OnEquipFinished, this, &AShooterWeapon::OnEquipFinished, Duration, false);
	}
	else
	{
		OnEquipFinished();
	}

	if (MyPawn && MyPawn->IsLocallyControlled())
	{
		PlayWeaponSound(EquipSound);
	}
}
Exemplo n.º 2
0
void AWeapon::OnEquipFinished(){
	AttachMeshToPawn();

	SetEquiped(true);
	bPendingEquip = false;

	DetermineWeaponState();
}
void AMagicBattleSoccerWeapon::OnEquip(FName InSocketName)
{
	AttachMeshToPawn(InSocketName);

	bIsEquipped = true;

	// Determine the state so that the can reload checks will work
	DetermineWeaponState();
}
Exemplo n.º 4
0
void ASWeapon::OnEquipFinished()
{
	AttachMeshToPawn();

	bIsEquipped = true;
	bPendingEquip = false;

	DetermineWeaponState();
}
Exemplo n.º 5
0
void ASWeapon::OnUnEquip()
{
	if (bPendingEquip)
	{
		StopWeaponAnimation(EquipAnim);
		bPendingEquip = false;
		GetWorldTimerManager().ClearTimer(EquipFinishedTimerHandle);
	}

	StopFire();
	AttachMeshToPawn(StorageSlot);
	bIsEquipped = false;

	DetermineWeaponState();
}
Exemplo n.º 6
0
void AAWeapon::OnEquipFinished()
{
	AttachMeshToPawn();

	bIsEquipped = true;
	bPendingEquip = false;

	DetermineWeaponState();

	if (MyPawn)
	{
		if (MyPawn->IsLocallyControlled() && CurrentAmmoInClip <= 0 && CanReload())
		{
			StartReload();
		}
	}
}
Exemplo n.º 7
0
void AWeapon::Equip(AMutagenCharacter* entity){
	AttachMeshToPawn();

	bPendingEquip = true;
	DetermineWeaponState();

	float duration = PlayWeaponAnimation(equipAnimation);
	if (duration <= 0.0f)
	{
		duration = 0.5f;
	}
	EquipStartedTime = GetWorld()->GetTimeSeconds();
	EquipDuration = duration;

	//GetWorldTimerManager().SetTimer(this, &AWeapon::OnEquipFinished, duration, false);
	GetWorldTimerManager().SetTimer(equipTimerHandle, this, &AWeapon::OnEquipFinished, duration, false);

	if (GetItemOwner() && GetItemOwner()->IsLocallyControlled())
	{
		//play weapon equip sound
	}
}
void AShooterWeapon::OnEquipFinished()
{
	AttachMeshToPawn();

	bIsEquipped = true;
	bPendingEquip = false;

	// Determine the state so that the can reload checks will work
	DetermineWeaponState(); 
	
	if (MyPawn)
	{
		// try to reload empty clip
		if (MyPawn->IsLocallyControlled() &&
			CurrentAmmoInClip <= 0 &&
			CanReload())
		{
			StartReload();
		}
	}

	
}
Exemplo n.º 9
0
void ASWeapon::OnEquip()
{
	AttachMeshToPawn();

	bPendingEquip = true;
	DetermineWeaponState();

	float Duration = PlayWeaponAnimation(EquipAnim);
	if (Duration <= 0.0f)
	{
		// Failsafe
		Duration = 0.5f;
	}
	EquipStartedTime = GetWorld()->TimeSeconds;
	EquipDuration = Duration;

	GetWorldTimerManager().SetTimer(EquipFinishedTimerHandle, this, &ASWeapon::OnEquipFinished, Duration, false);

	if (MyPawn && MyPawn->IsLocallyControlled())
	{
		PlayWeaponSound(EquipSound);
	}
}
Exemplo n.º 10
0
void ASWeapon::OnEnterInventory(ASCharacter* NewOwner)
{
	SetOwningPawn(NewOwner);
	AttachMeshToPawn(StorageSlot);
}
Exemplo n.º 11
0
/** weapon is being equipped by owner pawn */
void AWeapon::OnEquip()
{
	AttachMeshToPawn();

	DetermineWeaponState();
}