Advertisement
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 "CoreMinimal.h"
- #include "Engine.h"
- #include "Engine/World.h"
- #include <vector>
- #include "BaseSystem.generated.h"
- UENUM()
- enum class EDAI_AttackType : uint8
- {
- AT_Projectile,
- AT_Slam
- };
- USTRUCT()
- struct FDAIInfo /*Struct to contain all necessary information for an individual attack*/
- {
- GENERATED_BODY()
- public:
- UPROPERTY()
- int iIndex;
- UPROPERTY()
- float fLearningValue = 0.0f;
- UPROPERTY()
- EDAI_AttackType m_AttackType;
- // Default Constructor ~ SHOULD NOT BE USED
- FDAIInfo()
- {
- }
- // Constructor
- FDAIInfo(int _index, float _learningValue, EDAI_AttackType _type)
- {
- iIndex = _index;
- fLearningValue = _learningValue;
- m_AttackType = _type;
- }
- // Functions
- /*Increment struct learning variable by an amount*/
- void IncrementLearningValue(float _amount)
- {
- fLearningValue = FMath::Clamp(fLearningValue + _amount, 0.0f, 1.0f);
- }
- /*Calculates and returns a predicted best projectile attack location
- Assumed constant projectile speed.*/
- FVector CalculateProjectileAttack(
- FVector _projectileOrigin, // The origin of the projectile to be spawned
- FVector _targetLocation, // Target's current location
- float _projectileSpeed, // The speed of the projectile
- FVector _targetVelocity,
- float _deltaTime) // Target's current directional force
- {
- float fDistance = FVector::Dist(_projectileOrigin, _targetLocation);
- float fTime = fDistance / _projectileSpeed;
- FVector PredictedLocation = _targetLocation + ((_targetVelocity * fLearningValue) * fTime);
- return PredictedLocation;
- }
- /*Calculates and returns a predicted best slam attack location*/
- FVector CalculateSlamAttack(
- float _fWindup, // ??
- FVector _projectileOrigin, // The origin of the projectile to be spawned
- FVector _targetLocation) // Target's current location
- {
- }
- };
- /**
- *
- */
- class DYNAMICAIPLUGIN_API DynamicAI
- {
- public:
- DynamicAI(); // Constructor
- ~DynamicAI(); // Destructor
- //// Public Variables
- //// Public Functions
- /*Create a new instance of DAIInfo and add it to the array, return the index of the struct.*/
- int CreateDAIStruct(float _learningValue, EDAI_AttackType _type);
- /*Create a new instance of DAIInfo and add it to the array, return the index of the struct.*/
- int CreateDAIStruct(EDAI_AttackType _type);
- UPROPERTY()
- TArray<FDAIInfo> m_Attacks; // Array of Dynamic AI Information structs
- private:
- //// Private Variables
- //// Private Functions
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement