-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add vision height levels and line of sight, and update vision for act…
…ors that have moved onto new tiles, only.
- Loading branch information
Showing
15 changed files
with
691 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...SProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Classes/Vision/RTSVisionActor.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
|
||
#include "CoreMinimal.h" | ||
|
||
#include "RTSVisionActor.generated.h" | ||
|
||
|
||
class AActor; | ||
class URTSVisionComponent; | ||
|
||
|
||
/** Performance optimization. Caches an actor that can update team vision, along with relevant components. */ | ||
USTRUCT() | ||
struct REALTIMESTRATEGY_API FRTSVisionActor | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
FRTSVisionActor(); | ||
FRTSVisionActor(AActor* InActor); | ||
|
||
UPROPERTY() | ||
AActor* Actor; | ||
|
||
UPROPERTY() | ||
URTSVisionComponent* VisionComponent; | ||
|
||
bool IsActorValid() const; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...t/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Classes/Vision/RTSVisionInfoTileList.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#pragma once | ||
|
||
#include "CoreMinimal.h" | ||
|
||
#include "RTSVisionInfoTileList.generated.h" | ||
|
||
class ARTSVisionInfo; | ||
|
||
/** Tiles associated with a specific vision info. */ | ||
USTRUCT() | ||
struct REALTIMESTRATEGY_API FRTSVisionInfoTileList | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
UPROPERTY() | ||
ARTSVisionInfo* VisionInfo; | ||
|
||
TArray<int32> VisibleTiles; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...TSProject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Classes/Vision/RTSVisionTile.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#pragma once | ||
|
||
#include "CoreMinimal.h" | ||
|
||
#include "RTSVisionTile.generated.h" | ||
|
||
|
||
class AActor; | ||
|
||
|
||
/** Tile of the vision grid. */ | ||
USTRUCT(BlueprintType) | ||
struct REALTIMESTRATEGY_API FRTSVisionTile | ||
{ | ||
GENERATED_BODY() | ||
|
||
public: | ||
/** Adds the specified actor as having vision on this tile. */ | ||
void AddActor(AActor* Actor); | ||
|
||
/** Removes the specified actor from having vision on this tile. */ | ||
void RemoveActor(AActor* Actor); | ||
|
||
/** Checks whether any actor has vision on this tile. */ | ||
bool IsVisible() const; | ||
|
||
private: | ||
/** Number of actors seeing this tile. */ | ||
UPROPERTY() | ||
int32 NumActors = 0; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...roject/Plugins/RealTimeStrategy/Source/RealTimeStrategy/Private/Vision/RTSVisionActor.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "Vision/RTSVisionActor.h" | ||
|
||
#include "GameFramework/Actor.h" | ||
|
||
#include "Vision/RTSVisionComponent.h" | ||
|
||
|
||
FRTSVisionActor::FRTSVisionActor() | ||
: Actor(nullptr), | ||
VisionComponent(nullptr) | ||
{ | ||
} | ||
|
||
FRTSVisionActor::FRTSVisionActor(AActor* InActor) | ||
: Actor(InActor) | ||
{ | ||
VisionComponent = InActor->FindComponentByClass<URTSVisionComponent>(); | ||
} | ||
|
||
bool FRTSVisionActor::IsActorValid() const | ||
{ | ||
return IsValid(Actor) && IsValid(VisionComponent); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.