Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Fill out your copyright notice in the Description page of Project Settings.
- #pragma once
- #include "ZombieCharacter.h"
- #include "ZombieController.h"
- #include "Engine.h"
- // Sets default values
- AZombieCharacter::AZombieCharacter()
- {
- // Set this character 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 AZombieCharacter::BeginPlay()
- {
- Super::BeginPlay();
- GetWorld()->GetTimerManager().SetTimer(changeLocationTimerHandle, this, &AZombieCharacter::ChangeRandomLocation, 5.f, true, 0.f);
- }
- // Called every frame
- void AZombieCharacter::Tick(float DeltaTime)
- {
- Super::Tick(DeltaTime);
- }
- // Called to bind functionality to input
- void AZombieCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
- {
- Super::SetupPlayerInputComponent(PlayerInputComponent);
- }
- void AZombieCharacter::ChangeRandomLocation()
- {
- if (!controller)
- {
- GEngine->AddOnScreenDebugMessage(-1, 3.0f, FColor::Red, TEXT("Could not get the AI controller"));
- return;
- }
- controller->ChangeRandomLocation((APawn*)this, GetWorld());
- }
Advertisement
Add Comment
Please, Sign In to add comment