Compare commits
3 Commits
ab8be82328
...
cf03a0b098
Author | SHA1 | Date | |
---|---|---|---|
cf03a0b098 | |||
323846b4dd | |||
e581fbd67c |
BIN
Content/Legumix/Player/BP_Play.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Player/BP_Play.uasset
(Stored with Git LFS)
Binary file not shown.
@ -32,8 +32,8 @@ void ULMItemDropComponent::TryDropItems()
|
|||||||
const float Percentage = static_cast<float>(Test.AmmoCount) / static_cast<float>(Test.MaxAmmo);
|
const float Percentage = static_cast<float>(Test.AmmoCount) / static_cast<float>(Test.MaxAmmo);
|
||||||
const float DropChance = DropChanceAtRemainingAmmo->GetFloatValue(Percentage);
|
const float DropChance = DropChanceAtRemainingAmmo->GetFloatValue(Percentage);
|
||||||
|
|
||||||
FString Random = FString::Printf(TEXT("Drop Chance of %f for ammo (%i / %i) %f with random at %f"), DropChance, Test.AmmoCount, Test.MaxAmmo, Percentage, Result);
|
// FString Random = FString::Printf(TEXT("Drop Chance of %f for ammo (%i / %i) %f with random at %f"), DropChance, Test.AmmoCount, Test.MaxAmmo, Percentage, Result);
|
||||||
GEngine->AddOnScreenDebugMessage(INDEX_NONE, 5.f, FColor::Green, Random);
|
// GEngine->AddOnScreenDebugMessage(INDEX_NONE, 5.f, FColor::Green, Random);
|
||||||
if (DropChance >= Result)
|
if (DropChance >= Result)
|
||||||
{
|
{
|
||||||
SpawnAmmo();
|
SpawnAmmo();
|
||||||
|
@ -43,8 +43,8 @@ void ALMItemDrop::DoMovingTowardsTarget()
|
|||||||
|
|
||||||
const float Duration = MoveTime / MoveDuration;
|
const float Duration = MoveTime / MoveDuration;
|
||||||
|
|
||||||
FString text = FString::Printf(TEXT("Time : %f / %f = %f"), MoveTime, MoveDuration, Duration);
|
// FString text = FString::Printf(TEXT("Time : %f / %f = %f"), MoveTime, MoveDuration, Duration);
|
||||||
GEngine->AddOnScreenDebugMessage(-15, 1.f, FColor::Red, text);
|
// GEngine->AddOnScreenDebugMessage(-15, 1.f, FColor::Red, text);
|
||||||
const float CurvePosition = PositionAtTime->GetFloatValue(Duration);
|
const float CurvePosition = PositionAtTime->GetFloatValue(Duration);
|
||||||
const FVector NewPosition = UKismetMathLibrary::VLerp(SpawnLocation, Position, CurvePosition);
|
const FVector NewPosition = UKismetMathLibrary::VLerp(SpawnLocation, Position, CurvePosition);
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@ void ULMGrabRange::TickComponent(float DeltaTime, enum ELevelTick TickType, FAct
|
|||||||
const FVector Position = GetComponentLocation();
|
const FVector Position = GetComponentLocation();
|
||||||
|
|
||||||
const float DistanceLeft = FVector::Dist(ItemPosition, Position);
|
const float DistanceLeft = FVector::Dist(ItemPosition, Position);
|
||||||
FString text = FString::Printf(TEXT("Item %s at distance %f"), *Item->GetName(), DistanceLeft);
|
// FString text = FString::Printf(TEXT("Item %s at distance %f"), *Item->GetName(), DistanceLeft);
|
||||||
GEngine->AddOnScreenDebugMessage(i, 1.f, FColor::Cyan, text);
|
// GEngine->AddOnScreenDebugMessage(i, 1.f, FColor::Cyan, text);
|
||||||
|
|
||||||
if (DistanceLeft <= RangeToGrab)
|
if (DistanceLeft <= RangeToGrab)
|
||||||
{
|
{
|
||||||
|
@ -37,13 +37,13 @@ float ULMHitBox::CalculateDamage_Implementation(const float Damage, const float
|
|||||||
{
|
{
|
||||||
const float Absorption = Damage - FlatDamageAbsorption;
|
const float Absorption = Damage - FlatDamageAbsorption;
|
||||||
const float FalloffModifier = Falloff->GetFloatValue(Distance / MaxDistance);
|
const float FalloffModifier = Falloff->GetFloatValue(Distance / MaxDistance);
|
||||||
UE_LOG(LogTemp, Display, TEXT("Falloff : %f"), FalloffModifier);
|
// UE_LOG(LogTemp, Display, TEXT("Falloff : %f"), FalloffModifier);
|
||||||
|
|
||||||
const float FalloffDamage = Absorption * FalloffModifier;
|
const float FalloffDamage = Absorption * FalloffModifier;
|
||||||
UE_LOG(LogTemp, Display, TEXT("Damage With Fallof: %f"), FalloffDamage)
|
// UE_LOG(LogTemp, Display, TEXT("Damage With Fallof: %f"), FalloffDamage)
|
||||||
|
|
||||||
const float FinalDamage = FalloffDamage * DamageModifier;
|
const float FinalDamage = FalloffDamage * DamageModifier;
|
||||||
UE_LOG(LogTemp, Display, TEXT("Final Damages: %f"), FinalDamage)
|
// UE_LOG(LogTemp, Display, TEXT("Final Damages: %f"), FinalDamage)
|
||||||
|
|
||||||
return FinalDamage;
|
return FinalDamage;
|
||||||
}
|
}
|
||||||
|
@ -89,8 +89,8 @@ bool ALMPlayer::PickUpAmmo(ALMAmmo* Ammo)
|
|||||||
{
|
{
|
||||||
if (GEngine)
|
if (GEngine)
|
||||||
{
|
{
|
||||||
const FString AmmoAmount = FString::Printf(TEXT("Quantité de munition : %i"), Ammo->GetAmmoAmount());
|
// const FString AmmoAmount = FString::Printf(TEXT("Quantité de munition : %i"), Ammo->GetAmmoAmount());
|
||||||
GEngine->AddOnScreenDebugMessage(INDEX_NONE, 30.f, FColor::Red, AmmoAmount);
|
// GEngine->AddOnScreenDebugMessage(INDEX_NONE, 30.f, FColor::Red, AmmoAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WeaponManager->AddAmmoType(Ammo->GetAmmoType(), Ammo->GetAmmoAmount()))
|
if (WeaponManager->AddAmmoType(Ammo->GetAmmoType(), Ammo->GetAmmoAmount()))
|
||||||
@ -283,11 +283,29 @@ void ALMPlayer::DoLedgeGrabCheck()
|
|||||||
FVector Dir = LedgeGrabOrigin->GetUpVector() * FVector(0, 0, -LedgeGrabTraceLength);
|
FVector Dir = LedgeGrabOrigin->GetUpVector() * FVector(0, 0, -LedgeGrabTraceLength);
|
||||||
FVector Ray = Origin + Dir;
|
FVector Ray = Origin + Dir;
|
||||||
|
|
||||||
|
EDrawDebugTrace::Type DrawDebug = bShowLedgeDebug ? EDrawDebugTrace::ForDuration : EDrawDebugTrace::None;
|
||||||
|
|
||||||
FHitResult Hit;
|
FHitResult Hit;
|
||||||
const bool Results = UKismetSystemLibrary::LineTraceSingleByProfile(GetWorld(), Origin, Ray, TEXT("BlockAll"), false
|
const bool Results = UKismetSystemLibrary::LineTraceSingleByProfile(GetWorld(), Origin, Ray, TEXT("BlockAll"), false
|
||||||
, {}, EDrawDebugTrace::None, Hit, true, FLinearColor::Red, FLinearColor::Green, 0.2f);
|
, {}, DrawDebug, Hit, true, FLinearColor::Red, FLinearColor::Green, 10.f);
|
||||||
if (Results)
|
if (Results)
|
||||||
{
|
{
|
||||||
|
FHitResult CapsuleCheck;
|
||||||
|
float HalfHeight = LegumixMovementComponent->bWantsToCrouch ? LegumixMovementComponent->CrouchedHalfHeight : GetCapsuleComponent()->GetScaledCapsuleHalfHeight();
|
||||||
|
const FVector Offset = Hit.ImpactPoint + FVector(0, 0, HalfHeight + GetCapsuleComponent()->GetScaledCapsuleRadius());
|
||||||
|
|
||||||
|
const bool IsObstructed = UKismetSystemLibrary::CapsuleTraceSingleByProfile(GetWorld(), Offset, Offset,
|
||||||
|
GetCapsuleComponent()->GetScaledCapsuleRadius(),
|
||||||
|
GetCapsuleComponent()->GetScaledCapsuleHalfHeight(), TEXT("BlockAll"), false,
|
||||||
|
{}, DrawDebug, CapsuleCheck, true, FLinearColor::Green, FLinearColor::Red, 10.f);
|
||||||
|
|
||||||
|
if (IsObstructed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
// if (CapsuleCheck.ImpactPoint.Z > CapsuleCheck.Location.Z - HalfHeight)
|
||||||
|
// return;
|
||||||
|
}
|
||||||
|
|
||||||
FVector TeleportLocation = FVector(Hit.Location.X, Hit.Location.Y, Hit.Location.Z + GetCapsuleComponent()->GetScaledCapsuleHalfHeight());
|
FVector TeleportLocation = FVector(Hit.Location.X, Hit.Location.Y, Hit.Location.Z + GetCapsuleComponent()->GetScaledCapsuleHalfHeight());
|
||||||
SetActorLocation(TeleportLocation, false, nullptr, ETeleportType::ResetPhysics);
|
SetActorLocation(TeleportLocation, false, nullptr, ETeleportType::ResetPhysics);
|
||||||
}
|
}
|
||||||
|
@ -56,17 +56,17 @@ int ULMWeaponManager::RemoveAmmo(const EAmmoType Ammo, const int Count)
|
|||||||
FLMAmmoData &Data = AmmoData[Ammo];
|
FLMAmmoData &Data = AmmoData[Ammo];
|
||||||
|
|
||||||
int Difference = Data.AmmoCount - Count;
|
int Difference = Data.AmmoCount - Count;
|
||||||
UE_LOG(LogTemp, Display, TEXT("Difference: %i | Removing: %i | Storage: %i"), Difference, Count, Data.AmmoCount)
|
// UE_LOG(LogTemp, Display, TEXT("Difference: %i | Removing: %i | Storage: %i"), Difference, Count, Data.AmmoCount)
|
||||||
if (Difference < 0)
|
if (Difference < 0)
|
||||||
{
|
{
|
||||||
UE_LOG(LogTemp, Error, TEXT("%i - %i = %i"), Data.AmmoCount, Count, Data.AmmoCount - Count);
|
// UE_LOG(LogTemp, Error, TEXT("%i - %i = %i"), Data.AmmoCount, Count, Data.AmmoCount - Count);
|
||||||
Data.AmmoCount = FMath::Clamp(Data.AmmoCount - Count, InfiniteAmmo == 1 ? 1 : 0, Data.MaxAmmo);
|
Data.AmmoCount = FMath::Clamp(Data.AmmoCount - Count, InfiniteAmmo == 1 ? 1 : 0, Data.MaxAmmo);
|
||||||
UE_LOG(LogTemp, Warning, TEXT("Difference < 0 | Munition to add: %i | Removed: %i | New Munition: %i"), Count + Difference, Count, Data.AmmoCount)
|
// UE_LOG(LogTemp, Warning, TEXT("Difference < 0 | Munition to add: %i | Removed: %i | New Munition: %i"), Count + Difference, Count, Data.AmmoCount)
|
||||||
return Count + Difference;
|
return Count + Difference;
|
||||||
}
|
}
|
||||||
|
|
||||||
Data.AmmoCount -= Count;
|
Data.AmmoCount -= Count;
|
||||||
UE_LOG(LogTemp, Warning, TEXT("New munition: %i | Removed: %i"), Data.AmmoCount, Count)
|
// UE_LOG(LogTemp, Warning, TEXT("New munition: %i | Removed: %i"), Data.AmmoCount, Count)
|
||||||
return Count;
|
return Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,8 +110,8 @@ void ULMWeaponManager::Initialize(USkeletalMeshComponent* Mesh)
|
|||||||
|
|
||||||
bool ULMWeaponManager::AddAmmoType(EAmmoType AmmoType, int AmmoCount)
|
bool ULMWeaponManager::AddAmmoType(EAmmoType AmmoType, int AmmoCount)
|
||||||
{
|
{
|
||||||
FString Debug = FString::Printf(TEXT("Adding %i ammo of type %i"), AmmoCount, AmmoType);
|
// FString Debug = FString::Printf(TEXT("Adding %i ammo of type %i"), AmmoCount, AmmoType);
|
||||||
GEngine->AddOnScreenDebugMessage(1, 1.f, FColor::Cyan, Debug);
|
// GEngine->AddOnScreenDebugMessage(1, 1.f, FColor::Cyan, Debug);
|
||||||
|
|
||||||
if (AmmoData.Contains(AmmoType))
|
if (AmmoData.Contains(AmmoType))
|
||||||
{
|
{
|
||||||
|
@ -217,6 +217,9 @@ private:
|
|||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Legumix, meta = (AllowPrivateAccess = true, ClampMin = 0.01f))
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Legumix, meta = (AllowPrivateAccess = true, ClampMin = 0.01f))
|
||||||
float CoyoteTimeLength = 0.5f;
|
float CoyoteTimeLength = 0.5f;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Legumix|LedgeGrab", meta = (AllowPrivateAccess = true, ClampMin = 0.f))
|
||||||
|
bool bShowLedgeDebug = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actualize all parameters needed to calculate PlayerViewOcclusionPercent
|
* Actualize all parameters needed to calculate PlayerViewOcclusionPercent
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user