diff --git a/README.md b/README.md index c9462a7..ee58bbc 100644 --- a/README.md +++ b/README.md @@ -196,8 +196,8 @@ The Cog repository has the following structure: Cog has multiple plugins to ease the integration for projects that do not use the `Ability System Component` or `Enhanced Input`. For the next steps, it is assumed all the plugins are used. -1. Setup up module dependencies: +- Setup up module dependencies: ```c# // CogSample.Build.cs using UnrealBuildTool; @@ -238,8 +238,8 @@ public class CogSample : ModuleRules } ``` -2. In the class of your choice (in the sample we use the GameState class) add a reference to the CogWindowManager: +- In the class of your choice (in the sample we use the GameState class) add a reference to the CogWindowManager: ```cpp // ACogSampleGameState.h #pragma once @@ -267,8 +267,9 @@ class ACogSampleGameState : public AGameStateBase #endif //ENABLE_COG }; ``` -3. Instantiate the CogWindowManager and add some windows: + +- Instantiate the CogWindowManager and add some windows: ```cpp // ACogSampleGameState.cpp void ACogSampleGameState::BeginPlay() @@ -279,24 +280,33 @@ void ACogSampleGameState::BeginPlay() CogWindowManager = NewObject(this); CogWindowManagerRef = CogWindowManager; - // Add some windows + // Add windows CogWindowManager->CreateWindow("Engine.Debug Settings"); CogWindowManager->CreateWindow("Engine.ImGui"); + + // Add windows that uses a data asset. The data asset must be created inside Unreal Editor. + const UCogAbilityDataAsset* AbilitiesAsset = GetFirstAssetByClass(); + + UCogAbilityWindow_Abilities* AbilitiesWindow = CogWindowManager->CreateWindow("Gameplay.Abilities"); + AbilitiesWindow->Asset = AbilitiesAsset; + + UCogAbilityWindow_Attributes* AttributesWindow = CogWindowManager->CreateWindow("Gameplay.Attributes"); + AttributesWindow->Asset = AbilitiesAsset; + [...] #endif //ENABLE_COG } - ``` -3. Define which key will toggle the input from the game to Imgui: +- Define which key will toggle the input from the game to Imgui: ```cpp // ACogSampleGameState.cpp FCogImguiModule::Get().SetToggleInputKey(FCogImGuiKeyInfo(EKeys::Insert)); ``` -4. Tick the CogWindowManager: +- Tick the CogWindowManager: ```cpp // ACogSampleGameState.cpp void ACogSampleGameState::Tick(float DeltaSeconds) @@ -308,3 +318,27 @@ void ACogSampleGameState::Tick(float DeltaSeconds) #endif //ENABLE_COG } ``` + + +- Implement Cog Interfaces on your desired actor classes: +```cpp +// CogSampleCharacter.h +UCLASS(config=Game) +class ACogSampleCharacter : public ACharacter + , public IAbilitySystemInterface + , public ICogCommonDebugFilteredActorInterface + , public ICogCommonAllegianceActorInterface + , public ICogSampleTeamInterface + , public ICogSampleTargetableInterface +``` + +```cpp +// CogSamplePlayerController.h +UCLASS(config=Game) +class ACogSamplePlayerController + : public APlayerController + , public ICogCommonPossessorInterface +``` + +__ +- In Unreal Editor create and configure the Data Assets