-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAgentsBehaviorManager.h
121 lines (95 loc) · 2.92 KB
/
AgentsBehaviorManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "DisharmonyGameMode.h"
#include "GameFramework/Actor.h"
#include "Data/PlanData.h"
#include "AgentsBehaviorManager.generated.h"
class AMech_Weaver;
class AMech_Cutter;
class ADisharmonyGameMode;
class UWeaverManager;
class ULimbsManager;
class UCuttersManagerAgain;
UCLASS()
class UNSATISFACTORY_API AAgentsBehaviorManager : public AActor
{
GENERATED_BODY()
UPROPERTY()
ADisharmonyGameMode* GameMode;
UPROPERTY()
UCuttersManagerAgain* CutterManager;
UPROPERTY()
ULimbsManager* LimbsManager;
UPROPERTY()
UWeaverManager* WeaverManager;
UPROPERTY(EditAnywhere)
bool WOrkIt = true;
//Mech Behaviors
UPROPERTY(VisibleAnywhere)
TMap<AActor*, FPlanStack> AgentPlans;
UPROPERTY()
TSet<AActor*> NeedPlanInitiate;
UPROPERTY(EditAnywhere)
bool DebugHelpers = false;
UPROPERTY()
TMap<AActor*, FActionLog> ActionLogs;
//BPs
UPROPERTY(EditAnywhere, Category="Blueprint References")
UClass* CutterManagerBP = nullptr;
UPROPERTY(EditAnywhere, Category="Blueprint References")
UClass* LimbsManagerBP = nullptr;
UPROPERTY(EditAnywhere, Category="Blueprint References")
UClass* WeaverManagerBP = nullptr;
public:
// Sets default values for this actor's properties
AAgentsBehaviorManager();
UPROPERTY()
TMap<AActor*, FPlanAction> GoingToLoc;
UPROPERTY()
TMap<AActor*, FPlanAction> GoingToObj;
UPROPERTY()
TArray<AActor*> AgentsPendingMovement;
TArray<AMech_Cutter*>* GetJoblessCutters();
//Setters
void SubmitAgentPlan(AActor* agent, FPlanStack ps)
{
AgentPlans[agent].PlanStack.Append(ps.PlanStack);
}
UPROPERTY(EditAnywhere)
bool WorkSuperFast = false;
UPROPERTY(EditAnywhere, Category="Blueprint References")
UClass* CutterBP = nullptr;
UPROPERTY(EditAnywhere, Category="Temp")
TArray<AActor*> StartingCutters;
UPROPERTY(EditAnywhere, Category="Data References")
UPlanData* PlanData;
UPROPERTY(EditAnywhere, Category="Starting Units")
TArray<AMech_Weaver*> StartingWeavers;
UCuttersManagerAgain* GetCutterManager() {return CutterManager;}
ULimbsManager* GetLimbsManager() {return LimbsManager;}
UWeaverManager* GetWeaverManager() {return WeaverManager;}
private:
void UpdateNeedsPlanInitiation();
TSet<AActor*> ExecuteGenericActions();
bool GoToLoc(FPlanAction action, AActor* agent);
bool GoToObj(FPlanAction action, AActor* agent);
public:
//Initialized via game mode
void InitializeSystem();
// Called every frame
virtual void Tick(float DeltaTime) override;
void RegisterGameMode(ADisharmonyGameMode* gm)
{
GameMode = gm;
}
void RegisterAgent(AActor* agent)
{
AgentPlans.Add(agent, FPlanStack());
}
void MakeAgentAct(AActor* agent);
void MarkAgentDoneMoving(AActor* agent);
void AppendMechInstructions(TArray<FPlanAction> plan, AActor* agent);
//Utility?
bool ExtendAndRotateVector(FVector& result, FVector start, FVector end, float rExtent, float rAngle);
};