36 lines
764 B
C++
Executable File
36 lines
764 B
C++
Executable File
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
#include "EnemyPawn.h"
|
|
#include "Pickup.h"
|
|
|
|
void AEnemyPawn::BeginPlay()
|
|
{
|
|
Super::BeginPlay();
|
|
|
|
/*
|
|
* Initialize random stream.
|
|
*/
|
|
random.Initialize(FMath::Rand());
|
|
}
|
|
|
|
void AEnemyPawn::destroy_self()
|
|
{
|
|
const bool drop_pickup = random.GetFraction() > .5;
|
|
|
|
if (drop_pickup)
|
|
{
|
|
FVector location = get_location() + FVector(100, 100, 0);
|
|
FActorSpawnParameters spawnParameters;
|
|
spawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
|
APickup* pickup = GetWorld()->SpawnActor<APickup>(
|
|
pickup_class,
|
|
location,
|
|
FRotator(0,0,0),
|
|
spawnParameters
|
|
);
|
|
}
|
|
|
|
ABasePawn::destroy_self();
|
|
}
|