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); } }
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(); }
void ASWeapon::OnEquipFinished() { AttachMeshToPawn(); bIsEquipped = true; bPendingEquip = false; DetermineWeaponState(); }
void ASWeapon::OnUnEquip() { if (bPendingEquip) { StopWeaponAnimation(EquipAnim); bPendingEquip = false; GetWorldTimerManager().ClearTimer(EquipFinishedTimerHandle); } StopFire(); AttachMeshToPawn(StorageSlot); bIsEquipped = false; DetermineWeaponState(); }
void AAWeapon::OnEquipFinished() { AttachMeshToPawn(); bIsEquipped = true; bPendingEquip = false; DetermineWeaponState(); if (MyPawn) { if (MyPawn->IsLocallyControlled() && CurrentAmmoInClip <= 0 && CanReload()) { StartReload(); } } }
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(); } } }
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); } }
void ASWeapon::OnEnterInventory(ASCharacter* NewOwner) { SetOwningPawn(NewOwner); AttachMeshToPawn(StorageSlot); }
/** weapon is being equipped by owner pawn */ void AWeapon::OnEquip() { AttachMeshToPawn(); DetermineWeaponState(); }