Add Base Telemetry Triggers
This commit is contained in:
parent
69bf3555e3
commit
1707d13fb9
BIN
EndlessVendetta/Content/BP_Telemetry.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/BP_Telemetry.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPerson/GunMechanicWorld.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/GunMechanicWorld.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/Levels/NewMiamiTemp.umap
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Levels/NewMiamiTemp.umap
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/Levels/TrainingFacility.umap
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Levels/TrainingFacility.umap
(Stored with Git LFS)
Binary file not shown.
@ -3,14 +3,13 @@
|
||||
|
||||
#include "AICharacter.h"
|
||||
|
||||
#include "AI_EnemyController.h"
|
||||
#include "Components/CapsuleComponent.h"
|
||||
#include "Engine/DamageEvents.h"
|
||||
#include "GameFramework/CharacterMovementComponent.h"
|
||||
#include "Perception/AIPerceptionStimuliSourceComponent.h"
|
||||
#include "Perception/AISense_Sight.h"
|
||||
#include "BehaviorTree/BlackboardComponent.h"
|
||||
#include "Blueprint/AIBlueprintHelperLibrary.h"
|
||||
#include "../Telemetry.h"
|
||||
|
||||
|
||||
// Sets default values
|
||||
@ -100,4 +99,5 @@ void AAICharacter::OnDeath()
|
||||
}
|
||||
|
||||
SetLifeSpan(30.0f);
|
||||
Cast<ATelemetry>(GetWorld()->GetGameState())->SendEvent("kill", "");
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "CoreMinimal.h"
|
||||
#include "WaypointActor.h"
|
||||
#include "EndlessVendetta/EndlessVendettaCharacter.h"
|
||||
#include "EndlessVendetta/Telemetry.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "CheckpointClass.generated.h"
|
||||
|
||||
@ -32,11 +33,11 @@ class ENDLESSVENDETTA_API ACheckpointClass : public AActor
|
||||
AWaypointActor* WaypointActor;
|
||||
// ----------------------------------------
|
||||
protected:
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Checkpoint")
|
||||
void BroadcastCompletion()
|
||||
{
|
||||
CompletedCheckpoint.Broadcast();
|
||||
Cast<ATelemetry>(GetWorld()->GetGameState())->SendEvent("Check", CheckpointTip);
|
||||
}
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
@ -62,22 +63,27 @@ public:
|
||||
{
|
||||
return CheckpointDescription;
|
||||
}
|
||||
|
||||
FString GetCheckpointTip()
|
||||
{
|
||||
return CheckpointTip;
|
||||
}
|
||||
|
||||
FVector GetWaypointLoc()
|
||||
{
|
||||
return WaypointLoc;
|
||||
}
|
||||
|
||||
UTexture2D* GetWaypointIcon()
|
||||
{
|
||||
return WaypointIcon;
|
||||
}
|
||||
|
||||
FTransform GetCheckpointSpawnTransform()
|
||||
{
|
||||
return CheckpointSpawnTransform;
|
||||
}
|
||||
|
||||
// ---------------------------------------
|
||||
|
||||
// Sets default values for this actor's properties
|
||||
@ -85,7 +91,4 @@ public:
|
||||
|
||||
// Called every frame
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
@ -11,7 +11,8 @@ public class EndlessVendetta : ModuleRules
|
||||
PublicDependencyModuleNames.AddRange(new string[]
|
||||
{
|
||||
"Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay", "EnhancedInput", "AIModule",
|
||||
"GameplayTasks", "NavigationSystem", "UMG", "Slate", "SlateCore", "Niagara", "NiagaraCore", "NiagaraShader"
|
||||
"GameplayTasks", "NavigationSystem", "UMG", "Slate", "SlateCore", "Niagara", "NiagaraCore", "NiagaraShader",
|
||||
"HTTP", "Json", "JsonUtilities"
|
||||
});
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@
|
||||
#include "EnhancedInputComponent.h"
|
||||
#include "EnhancedInputSubsystems.h"
|
||||
#include "InteractionInterface.h"
|
||||
#include "Telemetry.h"
|
||||
#include "AI/EnemyCharacter.h"
|
||||
#include "Engine/DamageEvents.h"
|
||||
#include "GameFramework/CharacterMovementComponent.h"
|
||||
@ -292,6 +293,7 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
||||
PrimaryWeapon = nullptr;
|
||||
bHasRifle = false;
|
||||
GLog->Log("Primary Weapon Put Away");
|
||||
Cast<ATelemetry>(GetWorld()->GetGameState())->SendEvent("DeEquip", "Pri");
|
||||
return;
|
||||
}
|
||||
if(bIsWeaponPickedUp)
|
||||
@ -318,6 +320,7 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
||||
// bIsPrimaryWeaponCreated = true;
|
||||
// }
|
||||
if (!IsValid(PrimaryWeaponActor)) return;
|
||||
Cast<ATelemetry>(GetWorld()->GetGameState())->SendEvent("Equip", "Pri");
|
||||
PrimaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
|
||||
PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
|
||||
PrimaryWeapon->SetActorHiddenInGame(false);
|
||||
|
29
EndlessVendetta/Source/EndlessVendetta/Telemetry.cpp
Normal file
29
EndlessVendetta/Source/EndlessVendetta/Telemetry.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "Telemetry.h"
|
||||
#include "Misc/Guid.h"
|
||||
|
||||
void ATelemetry::SendEvent(FString EventKey, FString EventData)
|
||||
{
|
||||
const FString EventID = FGuid::NewGuid().ToString();
|
||||
const FString EventTime = FDateTime::Now().ToString();
|
||||
const auto Request = FHttpModule::Get().CreateRequest();
|
||||
Request->SetURL(TelemetryURLEvents);
|
||||
Request->SetVerb("POST");
|
||||
Request->SetHeader("Content-Type", "application/json");
|
||||
Request->SetHeader("Accept", "application/json");
|
||||
Request->SetContentAsString( "{\"SessionID\":\"" + SessionID + "\",\"PlayerGUID\":\"" + PlayerGUID + "\",\"EventID\":\"" + EventID + "\",\"Timestamp\":\"" + EventTime + "\",\"EventKey\":\"" + EventKey + "\",\"EventData\":\"" + EventData + "\"}" );
|
||||
Request->OnProcessRequestComplete().BindLambda([](FHttpRequestPtr request, FHttpResponsePtr response, bool success)
|
||||
{
|
||||
GLog->Log("Telemetry Event Response: " + response->GetContentAsString());
|
||||
});
|
||||
Request->ProcessRequest();
|
||||
}
|
||||
|
||||
void ATelemetry::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
SessionID = FGuid::NewGuid().ToString().Left(5).ToUpper();
|
||||
SendEvent("start", "");
|
||||
}
|
33
EndlessVendetta/Source/EndlessVendetta/Telemetry.h
Normal file
33
EndlessVendetta/Source/EndlessVendetta/Telemetry.h
Normal file
@ -0,0 +1,33 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/GameState.h"
|
||||
#include "Http.h"
|
||||
#include "Telemetry.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class ENDLESSVENDETTA_API ATelemetry : public AGameState
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Telemetry")
|
||||
FString TelemetryURLEvents = "https://ev.api.philipwhite.dev/api/event";
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Telemetry")
|
||||
FString TelemetryURLUsers = "https://ev.api.philipwhite.dev/api/user";
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Telemetry")
|
||||
FString SessionID = "AAAAA";
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Telemetry")
|
||||
FString PlayerGUID = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee";
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Telemetry")
|
||||
void SendEvent(FString EventKey, FString EventData);
|
||||
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
};
|
@ -7,6 +7,7 @@
|
||||
#include "EndlessVendetta/EndlessVendettaCharacter.h"
|
||||
#include "Kismet/KismetMathLibrary.h"
|
||||
#include "Components/CapsuleComponent.h"
|
||||
#include "EndlessVendetta/Telemetry.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "Engine/DamageEvents.h"
|
||||
#include "EndlessVendetta/AI/EnemyCharacter.h"
|
||||
@ -242,6 +243,7 @@ void ABaseWeaponClass::Interact()
|
||||
{
|
||||
if(!IsValid(this)) return;
|
||||
endlessVendettaChar->WeaponSwitcher(this);
|
||||
Cast<ATelemetry>(GetWorld()->GetGameState())->SendEvent("pickup", "");
|
||||
}
|
||||
|
||||
void ABaseWeaponClass::InteractPrompt()
|
||||
|
Loading…
Reference in New Issue
Block a user