void AW01Weapon::GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(AW01Weapon, MyPawn);
DOREPLIFETIME_CONDITION(AW01Weapon, CurrentAmmo, COND_OwnerOnly);
}
void AW01Weapon::OnRep_MyPawn()
{
if (MyPawn)
{
OnEnterInventory(MyPawn);
}
}
void AW01Weapon::OnEnterInventory(AW01Character* NewOwner)
{
SetOwningPawn(NewOwner);
}
void AW01Weapon::SetOwningPawn(AW01Character* NewOwner)
{
if (MyPawn != NewOwner)
{
Instigator = NewOwner;
MyPawn = NewOwner;
SetOwner(NewOwner);
}
}
bool AW01Weapon::GetProjectile()
if (ProjectileClass)
{
return true;
}
else
{
return false;
}
}