LEAP Documentation 40220
Documentation for the LEAP project
SpottableInterface.h
Go to the documentation of this file.
1// Copyright Blue Isle Studios Inc 2018. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "ProjectX.h"
7#include "UObject/Interface.h"
8#include "SpottableInterface.generated.h"
9
10UINTERFACE(BlueprintType, meta = (CannotImplementInterfaceInBlueprint))
11class USpottableInterface : public UInterface
12{
13 GENERATED_UINTERFACE_BODY()
14};
15
16UENUM(BlueprintType)
17enum class ESpotType : uint8
18{
19 HUD = 0,
20 Radar = 1,
21 All = 2,
22 None = 255
23};
24
25UENUM(BlueprintType)
26enum class ESpotReply : uint8
27{
28 Valid = 0,
29 Invalid = 1,
30 Invisible = 2,
31 None = 255
32};
33
35DECLARE_DYNAMIC_DELEGATE(FBPSpottedSignature);
36
39class PROJECTX_API ISpottableInterface
40{
41 GENERATED_IINTERFACE_BODY()
42
43 FSpottedSignature InterfaceOnSpottedStartEvent;
44 FSpottedSignature InterfaceOnSpottedEndEvent;
45
46public:
47 /* Returns true if this actor can be spotted by the SpotInstigator */
48 UFUNCTION(BlueprintCallable, Category = SpottableInterface)
49 virtual ESpotReply CanBeSpotted(const AActor* SpotInstigator, ESpotType SpotType) const { return ESpotReply::Valid; }
50
51 UFUNCTION(BlueprintCallable, Category = SpottableInterface)
52 virtual FVector GetSpottingTraceOffset() const { return FVector::ZeroVector; }
53
54 UFUNCTION(Category = "SpottableInterface Events")
55 virtual FSpottedSignature& GetSpottedStartEvent() { return InterfaceOnSpottedStartEvent; }
56 UFUNCTION(Category = "SpottableInterface Events")
57 virtual FSpottedSignature& GetSpottedStopEvent() { return InterfaceOnSpottedEndEvent; }
58
59 UFUNCTION(BlueprintCallable, Category = "SpottableInterface Events")
60 virtual void BroadcastSpottedEvent() { InterfaceOnSpottedStartEvent.Broadcast(); }
61 UFUNCTION(BlueprintCallable, Category = "SpottableInterface Events")
62 virtual void BroadcastSpottedEndEvent() { InterfaceOnSpottedEndEvent.Broadcast(); }
63
64 UFUNCTION(BlueprintCallable, Category = "SpottableInterface Events")
65 virtual void BindToSpottedEvent(const FBPSpottedSignature& Event) { InterfaceOnSpottedStartEvent.Add(Event); }
66 UFUNCTION(BlueprintCallable, Category = "SpottableInterface Events")
67 virtual void BindToSpottedEndEvent(const FBPSpottedSignature& Event) { InterfaceOnSpottedEndEvent.Add(Event); }
68
69 UFUNCTION(BlueprintCallable, Category = "SpottableInterface Events")
70 virtual void UnBindToSpottedEvent(const FBPSpottedSignature& Event) { InterfaceOnSpottedStartEvent.Remove(Event); }
71 UFUNCTION(BlueprintCallable, Category = "SpottableInterface Events")
72 virtual void UnBindToSpottedEndEvent(const FBPSpottedSignature& Event) { InterfaceOnSpottedEndEvent.Remove(Event); }
73
74 UFUNCTION(BlueprintCallable, Category = "SpottableInterface Events")
75 virtual void ClearAllSpottedEvents() { InterfaceOnSpottedStartEvent.Clear(); }
76 UFUNCTION(BlueprintCallable, Category = "SpottableInterface Events")
77 virtual void ClearAllSpottedEndEvents() { InterfaceOnSpottedEndEvent.Clear(); }
78
79
80};
ESpotType
Definition: SpottableInterface.h:18
ESpotReply
Definition: SpottableInterface.h:27
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FSpottedSignature)
DECLARE_DYNAMIC_DELEGATE(FBPSpottedSignature)
Definition: SpottableInterface.h:40
Definition: SpottableInterface.h:12