/
Azarel
/
Metro2
Обзор
Документация
Войти
/
Azarel
/
Metro2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Source/GameJam/Private/BaseEnemyAttack.cpp
40 строк
985 B
arseniy.mazurenko.03@gmail.com
Huge Enemy Update
29 сен 2024, 14:04
29 сен 2024, 14:04
17e3b3d
Код
Авторство
О чём код?
// Fill out your copyright notice in the Description page of Project Settings. #include "BaseEnemyAttack.h" #include "Components/SphereComponent.h" #include "DrawDebugHelpers.h" #include "Kismet/GameplayStatics.h" #include "TimerManager.h" DEFINE_LOG_CATEGORY_STATIC(AttackLog, All, All); ABaseEnemyAttack::ABaseEnemyAttack() { PrimaryActorTick.bCanEverTick = false; CollisionComponent = CreateDefaultSubobject<USphereComponent>("SphereComponent"); CollisionComponent->InitSphereRadius(5.0f); CollisionComponent->SetCollisionEnabled(ECollisionEnabled::QueryOnly); CollisionComponent->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Ignore); SetRootComponent(CollisionComponent); } void ABaseEnemyAttack::BeginPlay() { Super::BeginPlay(); check(CollisionComponent); OnAttackActivated(); } void ABaseEnemyAttack::OnAttackActivated() { if (!GetWorld()) return; GetWorld()->GetTimerManager().SetTimer(TimerHandle, [&]() { Destroy(); }, 2, false); }