Added GOAPAction Stub
This commit is contained in:
parent
d02f832733
commit
2e03f7cf19
@ -1,4 +1,5 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Azos/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=GOAP/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Iroquoid/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Probertium/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
@ -0,0 +1,32 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "GOAPAction.h"
|
||||
|
||||
bool UGOAPAction::CheckPreConditions(TMap<FString, int32> WorldState)
|
||||
{
|
||||
for (TPair<FString, int32> PreCondition : PreConditions)
|
||||
{
|
||||
if (WorldState.Contains(PreCondition.Key))
|
||||
{
|
||||
if (WorldState[PreCondition.Key] != PreCondition.Value) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
TMap<FString, int32> UGOAPAction::ApplyEffects(TMap<FString, int32> WorldState)
|
||||
{
|
||||
for (TPair<FString, int32> Effect : Effects)
|
||||
{
|
||||
if (WorldState.Contains(Effect.Key))
|
||||
{
|
||||
WorldState[Effect.Key] = Effect.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
WorldState.Add(Effect.Key, Effect.Value);
|
||||
}
|
||||
}
|
||||
return WorldState;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "UObject/Object.h"
|
||||
#include "GOAPAction.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class COMP250_1_2101327_AI_API UGOAPAction : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
virtual bool CheckPreConditions(TMap<FString, int32> WorldState);
|
||||
TMap<FString, int32> ApplyEffects(TMap<FString, int32> WorldState);
|
||||
|
||||
protected:
|
||||
TMap<FString, int32> PreConditions;
|
||||
TMap<FString, int32> Effects;
|
||||
};
|
Loading…
Reference in New Issue
Block a user