You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
1.7 KiB
96 lines
1.7 KiB
2 years ago
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||
|
|
||
|
#pragma once
|
||
|
|
||
|
#include "CoreMinimal.h"
|
||
|
#include "EnemyAIController.generated.h"
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
*/
|
||
|
UCLASS()
|
||
|
class TURNBASEDTUTORIAL_API AEnemyAIController : public AActor {
|
||
|
GENERATED_BODY()
|
||
|
|
||
|
public:
|
||
|
AEnemyAIController();
|
||
|
|
||
|
UFUNCTION()
|
||
|
void StartTurn();
|
||
|
|
||
|
UFUNCTION()
|
||
|
void EndTurn();
|
||
|
|
||
|
UFUNCTION()
|
||
|
void ActionDone();
|
||
|
|
||
|
UFUNCTION()
|
||
|
void InitializeTroopers(const TArray<ATrooper *> &Troopers);
|
||
|
|
||
|
virtual void BeginPlay() override;
|
||
2 years ago
|
|
||
2 years ago
|
virtual void Tick(float DeltaSeconds) override;
|
||
|
|
||
|
UPROPERTY()
|
||
|
bool bIsEnded = false;
|
||
|
|
||
|
UFUNCTION()
|
||
|
bool IsAITurn() const;
|
||
|
|
||
2 years ago
|
UFUNCTION()
|
||
|
void SpawnIfNeeded();
|
||
|
|
||
|
// UFUNCTION()
|
||
|
// void SetTrooperAssetsAndSpawn(TArray<UClass *> TrooperAssets, int TrooperCount);
|
||
|
|
||
2 years ago
|
private:
|
||
2 years ago
|
static constexpr int AI_INDEX = 1;
|
||
|
|
||
|
static constexpr int PLAYER_INDEX = 0;
|
||
|
|
||
|
static constexpr int MAX_TROOPERS_COUNT = 3;
|
||
|
|
||
|
UPROPERTY()
|
||
|
int TroopersCount = 5;
|
||
|
|
||
|
// UPROPERTY()
|
||
|
// TArray<UClass *> LoadedTrooperAssets;
|
||
|
|
||
|
UFUNCTION()
|
||
|
void RemoveDeadTroopers();
|
||
2 years ago
|
|
||
2 years ago
|
FVector GetFreeLocation() const;
|
||
2 years ago
|
|
||
2 years ago
|
UFUNCTION()
|
||
|
void MakeMove();
|
||
2 years ago
|
|
||
2 years ago
|
UPROPERTY()
|
||
|
int TroopersCursor = 0;
|
||
|
|
||
|
int GetClosestTrooper() const;
|
||
|
|
||
|
bool IsCloseEnough(int TrooperIndex) const;
|
||
|
|
||
|
bool TryAttack(int TrooperIndex);
|
||
|
|
||
|
bool MoveTo(int TrooperIndex);
|
||
2 years ago
|
|
||
|
void InitializeSpawnPoints();
|
||
2 years ago
|
|
||
2 years ago
|
UPROPERTY()
|
||
|
bool bIsAITurn = false;
|
||
|
|
||
|
UPROPERTY()
|
||
|
bool bIsActing = false;
|
||
|
|
||
|
UPROPERTY()
|
||
|
TArray<ATrooper *> PossessedTroopers;
|
||
|
|
||
|
UPROPERTY()
|
||
|
TArray<ATrooper *> PlayerTroopers;
|
||
2 years ago
|
|
||
|
TArray<FVector> SpawnPoints;
|
||
|
|
||
|
const FVector TROOPERS_DISTANCE = {0.0f, 1000.0f, 0.0f};
|
||
2 years ago
|
};
|