ExoWest/Source/Exo/Private/Items/GunBase.cpp
Kubson96 b7263615c0 feat: add collecting HP and ammo
Player automatically collect HP and ammo when standing on crates. Ammo is collected only for owned gun.
2025-04-18 01:53:08 +02:00

42 lines
828 B
C++

// Fill out your copyright notice in the Description page of Project Settings.
#include "Items/GunBase.h"
#include "Characters/Components/ShootingComponent.h"
// Sets default values
AGunBase::AGunBase()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
}
// Called when the game starts or when spawned
void AGunBase::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AGunBase::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
void AGunBase::Interact_Implementation(AExoPlayerCharacter* playerCharacter)
{
playerCharacter->ShootingComponent->PickUpGun(this);
Destroy();
}
void AGunBase::AddAmmo(int AddValue)
{
CurrentAmmo += AddValue;
if (CurrentAmmo > MaxAmmo)
CurrentAmmo = MaxAmmo;
}