Implement the base core (#4)
Co-authored-by: m4xxx1m <mi4469228@gmail.com> Reviewed-on: #4feature-model
parent
7b5efddb50
commit
f2ed196c3e
@ -0,0 +1,86 @@
|
||||
[/Script/Engine.InputSettings]
|
||||
-AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
|
||||
-AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
|
||||
-AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
|
||||
-AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
|
||||
-AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
|
||||
-AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
|
||||
-AxisConfig=(AxisKeyName="Mouse2D",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Mouse2D",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MouseWheelAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_LeftTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_RightTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_Special_Left_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Gamepad_Special_Left_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Daydream_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Daydream_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Daydream_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Daydream_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Vive_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Vive_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Vive_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Vive_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Vive_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="Vive_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="MixedReality_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Left_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Right_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="OculusTouch_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Grip_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Touch",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Grip_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
|
||||
bAltEnterTogglesFullscreen=True
|
||||
bF11TogglesFullscreen=True
|
||||
bUseMouseForTouch=False
|
||||
bEnableMouseSmoothing=True
|
||||
bEnableFOVScaling=True
|
||||
bCaptureMouseOnLaunch=True
|
||||
bAlwaysShowTouchInterface=False
|
||||
bShowConsoleOnFourFingerTap=True
|
||||
bEnableGestureRecognizer=False
|
||||
bUseAutocorrect=False
|
||||
DefaultViewportMouseCaptureMode=CapturePermanently_IncludingInitialMouseDown
|
||||
DefaultViewportMouseLockMode=LockOnCapture
|
||||
FOVScale=0.011110
|
||||
DoubleClickTime=0.200000
|
||||
+ActionMappings=(ActionName="MyAction",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=LeftMouseButton)
|
||||
DefaultPlayerInputClass=/Script/Engine.PlayerInput
|
||||
DefaultInputComponentClass=/Script/Engine.InputComponent
|
||||
DefaultTouchInterface=/Engine/MobileResources/HUD/DefaultVirtualJoysticks.DefaultVirtualJoysticks
|
||||
-ConsoleKeys=Tilde
|
||||
+ConsoleKeys=Tilde
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,5 +1,45 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "MyGameMode.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "Trooper.h"
|
||||
|
||||
AMyGameMode::AMyGameMode() : Super() {
|
||||
UE_LOG(LogTemp, Warning, TEXT("GameMode Constructor"));
|
||||
PlayerControllerClass = AMyPlayerController::StaticClass();
|
||||
}
|
||||
|
||||
void AMyGameMode::BeginPlay() {
|
||||
Super::BeginPlay();
|
||||
ATrooper::InitNumberOfTroopersForId();
|
||||
UE_LOG(LogTemp, Warning, TEXT("GameMode BeginPlay"));
|
||||
if (GetWorld()->GetMapName().Contains("BattleFieldMap")) {
|
||||
UE_LOG(LogTemp, Warning, TEXT("Player Logined"));
|
||||
StartGame();
|
||||
}
|
||||
}
|
||||
|
||||
void AMyGameMode::StartGame() {
|
||||
FVector Location(2000.0f, -1000.0f, 0.0f);
|
||||
FRotator Rotation(0.0f, 180.0f, 0.0f);
|
||||
FActorSpawnParameters SpawnInfo;
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
AActor *spawned = GetWorld()->SpawnActor<ATrooper>(Location, Rotation, SpawnInfo);
|
||||
dynamic_cast<ATrooper*>(spawned)->InitTrooper(Location, true);
|
||||
Location += { 0.f, 500.f, 0.0f };
|
||||
}
|
||||
Location = { -2000.0f, -1000.0f, 0.0f };
|
||||
Rotation = { 0.0f, 0.0f, 0.0f };
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
AActor* spawned = GetWorld()->SpawnActor<ATrooper>(Location, Rotation, SpawnInfo);
|
||||
dynamic_cast<ATrooper*>(spawned)->InitTrooper(Location, false);
|
||||
Location += { 0.f, 500.f, 0.0f };
|
||||
}
|
||||
GetPlayerController()->StartTurn();
|
||||
}
|
||||
|
||||
AMyPlayerController *AMyGameMode::GetPlayerController() {
|
||||
return dynamic_cast<AMyPlayerController *>(
|
||||
UGameplayStatics::GetPlayerController(GetWorld(), 0)
|
||||
);
|
||||
}
|
||||
|
@ -0,0 +1,63 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#include "MyPlayerController.h"
|
||||
|
||||
AMyPlayerController::AMyPlayerController() : Super(), IsMyTurn(false), SelectedTrooper(nullptr) {
|
||||
UE_LOG(LogTemp, Warning, TEXT("Player controller created"));
|
||||
}
|
||||
|
||||
void AMyPlayerController::SetupInputComponent() {
|
||||
Super::SetupInputComponent();
|
||||
InputComponent->BindAction("MyAction", IE_Pressed, this,
|
||||
&AMyPlayerController::OnLeftMouseClick);
|
||||
}
|
||||
|
||||
void AMyPlayerController::StartTurn() {
|
||||
IsMyTurn = true;
|
||||
UE_LOG(LogTemp, Warning, TEXT("Your turn"));
|
||||
}
|
||||
|
||||
void AMyPlayerController::EndTurn() {
|
||||
IsMyTurn = false;
|
||||
UE_LOG(LogTemp, Warning, TEXT("Not your turn"));
|
||||
}
|
||||
|
||||
void AMyPlayerController::SetTrooperIsMoving(bool isMoving) {
|
||||
IsThereTrooperMoving = isMoving;
|
||||
}
|
||||
|
||||
void AMyPlayerController::OnLeftMouseClick() {
|
||||
if (IsThereTrooperMoving) {
|
||||
return;
|
||||
}
|
||||
UE_LOG(LogTemp, Warning, TEXT("Mouse clicked"));
|
||||
FHitResult HitResult;
|
||||
bool IsHitResult = GetHitResultUnderCursorByChannel(TraceTypeQuery1, false, HitResult);
|
||||
if (IsHitResult) {
|
||||
AActor *actor = HitResult.Actor.Get();
|
||||
if (actor->ActorHasTag(FName("Trooper"))) {
|
||||
ATrooper* trooper = dynamic_cast<ATrooper*>(actor);
|
||||
if (trooper != nullptr && trooper != SelectedTrooper) {
|
||||
if (trooper->IsOnPlayersSide()) {
|
||||
UE_LOG(LogTemp, Warning, TEXT("Hitted trooper id: %d, on our side"),
|
||||
trooper->GetId());
|
||||
SelectedTrooper = trooper;
|
||||
}
|
||||
else {
|
||||
UE_LOG(LogTemp, Warning, TEXT("Hitted trooper id: %d, enemy"),
|
||||
trooper->GetId());
|
||||
UE_LOG(LogTemp, Warning, TEXT("Trooper #%d hit enemy trooper #%d"),
|
||||
SelectedTrooper->GetId(), trooper->GetId());
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (actor->ActorHasTag(FName("Floor"))) {
|
||||
UE_LOG(LogTemp, Warning, TEXT("Hitted floor: %f, %f, %f"), HitResult.Location.X,
|
||||
HitResult.Location.Y, HitResult.Location.Z);
|
||||
if (SelectedTrooper != nullptr) {
|
||||
SelectedTrooper->MoveTrooper(HitResult.Location);
|
||||
IsThereTrooperMoving = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Trooper.h"
|
||||
#include "GameFramework/PlayerController.h"
|
||||
#include "MyPlayerController.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class TURNBASEDTUTORIAL_API AMyPlayerController : public APlayerController
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
AMyPlayerController();
|
||||
|
||||
void StartTurn();
|
||||
|
||||
void EndTurn();
|
||||
|
||||
virtual void SetupInputComponent() override;
|
||||
|
||||
void SetTrooperIsMoving(bool isMoving);
|
||||
|
||||
private:
|
||||
bool IsMyTurn;
|
||||
|
||||
bool IsThereTrooperMoving = false;
|
||||
|
||||
ATrooper* SelectedTrooper;
|
||||
|
||||
void OnLeftMouseClick();
|
||||
|
||||
};
|
@ -0,0 +1,5 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "MyPlayerState.h"
|
||||
|
@ -0,0 +1,17 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/PlayerState.h"
|
||||
#include "MyPlayerState.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class TURNBASEDTUTORIAL_API AMyPlayerState : public APlayerState
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
};
|
@ -0,0 +1,73 @@
|
||||
#include "Trooper.h"
|
||||
#include <Kismet/GameplayStatics.h>
|
||||
#include "MyPlayerController.h"
|
||||
|
||||
// Sets default values
|
||||
ATrooper::ATrooper() {
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
Tags.Add(FName("Trooper"));
|
||||
Id = NumberOfTroopersForId++;
|
||||
Position.Set(0, 0, 0);
|
||||
Mesh = CreateDefaultSubobject<UStaticMeshComponent>("Mesh");
|
||||
RootComponent = Mesh;
|
||||
static ConstructorHelpers::FObjectFinder<UStaticMesh> MeshToUse(TEXT(
|
||||
"StaticMesh'/Game/StarterContent/Props/SM_Chair.SM_Chair'"
|
||||
));
|
||||
if (MeshToUse.Object)
|
||||
{
|
||||
Mesh->SetStaticMesh(MeshToUse.Object);
|
||||
}
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
void ATrooper::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
}
|
||||
|
||||
void ATrooper::Tick(float deltaTime) {
|
||||
if (IsMoving) {
|
||||
FVector vector = (MoveToVector - Position);
|
||||
vector.Normalize();
|
||||
vector *= (Speed * deltaTime);
|
||||
if (vector.Size() >= (MoveToVector - Position).Size()) {
|
||||
Position = MoveToVector;
|
||||
IsMoving = false;
|
||||
dynamic_cast<AMyPlayerController*>(
|
||||
UGameplayStatics::GetPlayerController(GetWorld(), 0)
|
||||
)->SetTrooperIsMoving(false);
|
||||
}
|
||||
else {
|
||||
Position += vector;
|
||||
}
|
||||
SetActorLocation(Position);
|
||||
}
|
||||
}
|
||||
|
||||
void ATrooper::MoveTrooper(FVector newPos) {
|
||||
MoveToVector = newPos;
|
||||
IsMoving = true;
|
||||
}
|
||||
|
||||
int ATrooper::NumberOfTroopersForId = 0;
|
||||
|
||||
void ATrooper::InitNumberOfTroopersForId() {
|
||||
NumberOfTroopersForId = 0;
|
||||
}
|
||||
|
||||
FVector ATrooper::GetPosition() {
|
||||
return Position;
|
||||
}
|
||||
|
||||
bool ATrooper::IsOnPlayersSide() {
|
||||
return OnPlayersSide;
|
||||
}
|
||||
|
||||
int ATrooper::GetId() {
|
||||
return Id;
|
||||
}
|
||||
|
||||
void ATrooper::InitTrooper(FVector position, bool onPlayersSide) {
|
||||
Position = position;
|
||||
OnPlayersSide = onPlayersSide;
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "Components/StaticMeshComponent.h"
|
||||
#include "Trooper.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class TURNBASEDTUTORIAL_API ATrooper : public AActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Sets default values for this actor's properties
|
||||
ATrooper();
|
||||
|
||||
protected:
|
||||
static int NumberOfTroopersForId;
|
||||
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
virtual void Tick(float deltaTime) override;
|
||||
|
||||
UPROPERTY()
|
||||
FVector Position;
|
||||
|
||||
UPROPERTY()
|
||||
bool OnPlayersSide;
|
||||
|
||||
UPROPERTY()
|
||||
int Id;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
|
||||
UStaticMeshComponent* Mesh;
|
||||
|
||||
UPROPERTY()
|
||||
float Speed = 300.0f;
|
||||
|
||||
bool IsMoving = false;
|
||||
|
||||
FVector MoveToVector;
|
||||
|
||||
public:
|
||||
void MoveTrooper(FVector newPos);
|
||||
|
||||
static void InitNumberOfTroopersForId();
|
||||
|
||||
FVector GetPosition();
|
||||
|
||||
bool IsOnPlayersSide();
|
||||
|
||||
int GetId();
|
||||
|
||||
void InitTrooper(FVector position, bool onPlayersSide);
|
||||
};
|
@ -1,5 +0,0 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
|
||||
#include "TurnBasedTutorialGameModeBase.h"
|
||||
|
@ -1,17 +0,0 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/GameModeBase.h"
|
||||
#include "TurnBasedTutorialGameModeBase.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class TURNBASEDTUTORIAL_API ATurnBasedTutorialGameModeBase : public AGameModeBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
};
|
Loading…
Reference in new issue