更新目标对象是物品周围的bug

This commit is contained in:
997146918 2025-09-04 16:06:02 +08:00
parent 0cb40e792b
commit c6f31bb217
7 changed files with 15 additions and 2 deletions

View File

@ -2,7 +2,7 @@
"BuildId": "37670630", "BuildId": "37670630",
"Modules": "Modules":
{ {
"ProjectFish": "UnrealEditor-ProjectFish.dll", "ProjectFish": "UnrealEditor-ProjectFish-0001.dll",
"ProjectFishEditor": "UnrealEditor-ProjectFishEditor.dll" "ProjectFishEditor": "UnrealEditor-ProjectFishEditor-0001.dll"
} }
} }

View File

@ -4,6 +4,7 @@
#include "SkillManager.h" #include "SkillManager.h"
#include "Skill.h" #include "Skill.h"
#include "ProjectFish/DataAsset/BagConfigAsset.h" #include "ProjectFish/DataAsset/BagConfigAsset.h"
#include "ProjectFish/DataAsset/BagShapeAsset.h"
void USkillManager::Tick(float DeltaTime) void USkillManager::Tick(float DeltaTime)
{ {
@ -42,6 +43,7 @@ void USkillManager::AddBagWithSkills(UBagConfigAsset* Bag, APawnWithSkill* Pawn,
TArray<FIntPoint>& BagPositions) TArray<FIntPoint>& BagPositions)
{ {
FIntPoint BagSize = *PawnInfo.Find(Pawn); FIntPoint BagSize = *PawnInfo.Find(Pawn);
TMap<FIntPoint, int32>* states = PawnBagState.Find(Pawn);
for (auto PlacedSkill: Bag->PlacedSkills) for (auto PlacedSkill: Bag->PlacedSkills)
{ {
USkill* skill = NewObject<USkill>(this); USkill* skill = NewObject<USkill>(this);
@ -49,6 +51,14 @@ void USkillManager::AddBagWithSkills(UBagConfigAsset* Bag, APawnWithSkill* Pawn,
SkillObjects.Add(skill); SkillObjects.Add(skill);
BagPositions.Add(FIntPoint(PlacedSkill.PositionX, PlacedSkill.PositionY)); BagPositions.Add(FIntPoint(PlacedSkill.PositionX, PlacedSkill.PositionY));
Skills.Add(skill); Skills.Add(skill);
//设置占用状态
for (int x = 0; x < Bag->BagShapeAsset->BagWidth; x++)
{
for (int y = 0; y < Bag->BagShapeAsset->BagHeight; y++)
{
states->Add(FIntPoint(x, y) + FIntPoint(x, y), GetSkillIndex(skill));
}
}
} }
@ -167,3 +177,5 @@ TArray<USkill*> USkillManager::GetSkillsByType(ESkillType SkillType) const
} }
return Result; return Result;
} }

View File

@ -62,6 +62,7 @@ public:
UFUNCTION(BlueprintPure) UFUNCTION(BlueprintPure)
TArray<class USkill*> GetSkillsByType(ESkillType SkillType) const; TArray<class USkill*> GetSkillsByType(ESkillType SkillType) const;
protected: protected:
UPROPERTY(BlueprintReadWrite) UPROPERTY(BlueprintReadWrite)
TArray<class USkill *> Skills; TArray<class USkill *> Skills;