国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

UE5.1.1 C++從0開始(16.作業(yè)5思路分享)

這篇具有很好參考價值的文章主要介紹了UE5.1.1 C++從0開始(16.作業(yè)5思路分享)。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報違法"按鈕提交疑問。

教程的鏈接:https://www.bilibili.com/video/BV1nU4y1X7iQ

總結(jié)一下這次的任務(wù)點(diǎn):

  1. 用PlayerState來做一個Credit系統(tǒng),需要在我們的ui內(nèi)顯示我們的分?jǐn)?shù)
  2. 更新血藥對象,每次使用血藥都會扣除相應(yīng)的分?jǐn)?shù)
  3. 新增一個金幣對象,每次和一個金幣對象交互就會增加一定的分?jǐn)?shù)
  4. 在地圖內(nèi)隨機(jī)生成金幣和血藥
  5. 金幣和血藥需要從同一個父類中繼承下來

整個分?jǐn)?shù)系統(tǒng)和我們的血量其實(shí)差不多,無非就是增加減少,檢查剩余的分?jǐn)?shù)夠不夠我們用來和血藥交互的。還是老規(guī)矩,直接上代碼

SPlayerState.h

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/PlayerState.h"
#include "Delegates/DelegateCombinations.h"
#include "SPlayerState.generated.h"

//藍(lán)圖宏
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnCreditChange, float, NewCredit);


UCLASS()
class ACTIONROGUELIKE_API ASPlayerState : public APlayerState
{
	GENERATED_BODY()

	ASPlayerState();

    //藍(lán)圖節(jié)點(diǎn)
	UPROPERTY(BlueprintAssignable)
	FOnCreditChange OnCreditChange;

private:
	float Credit;
    
private:
	float CreditMax;

public:
	UFUNCTION(BlueprintCallable,Category="Credit")
	const float GetCredit() {
		return Credit;
	}

public:
	UFUNCTION(BlueprintCallable, Category = "Credit")
	void AddCredit(float DeltaCredit);

	
};

SPlayerState.cpp

// Fill out your copyright notice in the Description page of Project Settings.


#include "SPlayerState.h"

ASPlayerState::ASPlayerState()
{
	CreditMax = 100;
	
	Credit = 0;
}

void ASPlayerState::AddCredit(float DeltaCredit)
{
    //我給分?jǐn)?shù)加了個上下限,這個功能可加可不加
	Credit = FMath::Clamp(Credit + DeltaCredit, 0, CreditMax);
	
    //每次更改都會在日志里頭打印出來
	UE_LOG(LogTemp, Warning, TEXT("Credit:%f"),Credit);
	
    //藍(lán)圖節(jié)點(diǎn)廣播
	OnCreditChange.Broadcast(Credit);
}



各位應(yīng)該看得出來,我創(chuàng)建的這個類只有得分這一項(xiàng),其實(shí)看APlayerState.h里頭你也能看到一個和分?jǐn)?shù)一樣的東西,就是Score。這個類在這里的作用單純是存儲我們的Credit用的,然后提供get set方法而已。同時我也在代碼內(nèi)寫了一個廣播,那么我在藍(lán)圖編輯器內(nèi)是這樣寫的。

UE5.1.1 C++從0開始(16.作業(yè)5思路分享),UE5.1.1_C++,ue5,c++,游戲

然后就是我們的父類設(shè)計,我這里把它命名為SBaseCreditUseActor,因?yàn)槲夷苷业降墓餐c(diǎn)就這點(diǎn)了。在這個類里面我使用了Interface,也就是說我們需要對著這些物品摁e才會觸發(fā)事件。

SBaseCreditUseActor.h

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "SGameplayInterface.h"
#include "SPlayerState.h"
#include "SBaseCreditUseActor.generated.h"

UCLASS()
class ACTIONROGUELIKE_API ASBaseCreditUseActor : public AActor , public ISGameplayInterface
{
	GENERATED_BODY()
	
    //接口實(shí)現(xiàn)
	void Interact_Implementation(APawn* InstigatorPawn) override;
	
	UPROPERTY(EditAnywhere,Category="Component")
	class UStaticMeshComponent* MeshComp;

public:
    //用來判斷能否執(zhí)行實(shí)現(xiàn)函數(shù)
	UFUNCTION(BlueprintCallable,Category="Credit")
	bool CanImplement(ASPlayerState* ASP);

    //實(shí)現(xiàn)函數(shù)
	UFUNCTION(BlueprintCallable,Category="Implementation")
	virtual void Implementation(ASPlayerState* ASP , APawn* InstigatorPawn);

public:
    //CreditNeed的get set方法
	UFUNCTION()
	void SetCreditNeed(float Creditneed);

	const float GetCreditNeed() {
		return CreditNeed;
	}

private:
	float CreditNeed;

public:	
	// Sets default values for this actor's properties
	ASBaseCreditUseActor();

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;


};

SBaseCreditUseActor.cpp

// Fill out your copyright notice in the Description page of Project Settings.


#include "SBaseCreditUseActor.h"

//接口實(shí)現(xiàn)函數(shù)
void ASBaseCreditUseActor::Interact_Implementation(APawn* InstigatorPawn)
{
	if (!CanImplement(InstigatorPawn->GetPlayerState<ASPlayerState>()))
	{
		return;
	}
	Implementation(InstigatorPawn->GetPlayerState<ASPlayerState>(),InstigatorPawn);
}

//判斷能否執(zhí)行實(shí)現(xiàn)函數(shù)的函數(shù)
bool ASBaseCreditUseActor::CanImplement(ASPlayerState*ASP)
{
	return ASP->GetCredit() >= CreditNeed;
}

//實(shí)現(xiàn)函數(shù),這里我沒寫是因?yàn)檫@里的函數(shù)每個子類都不相同,所以我們這里的函數(shù)都會在子類里面重寫
void ASBaseCreditUseActor::Implementation(ASPlayerState* ASP, APawn* InstigatorPawn)
{

}
//set方法
void ASBaseCreditUseActor::SetCreditNeed(float Creditneed)
{
	CreditNeed = Creditneed;
}

// Sets default values
ASBaseCreditUseActor::ASBaseCreditUseActor()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

	MeshComp = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh Component"));
	RootComponent = MeshComp;

    //CreditNeed默認(rèn)值
	CreditNeed = 25;

}

// Called when the game starts or when spawned
void ASBaseCreditUseActor::BeginPlay()
{
	Super::BeginPlay();
	
}

// Called every frame
void ASBaseCreditUseActor::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

}


這一串代碼其實(shí)就是我在之前的血瓶的代碼的基礎(chǔ)上抽象加上一點(diǎn)優(yōu)化得到的代碼,能適應(yīng)大部分的情況,不過少數(shù)的子類仍然需要重寫大量的父類函數(shù)。

首先是稍微簡單一點(diǎn)的金幣

SCoin.h

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "SBaseCreditUseActor.h"
#include "SCoin.generated.h"

/**
 * 
 */
UCLASS()
class ACTIONROGUELIKE_API ASCoin : public ASBaseCreditUseActor
{
	GENERATED_BODY()

	ASCoin();

	virtual void Implementation(ASPlayerState* ASP, APawn* InstigatorPawn);
};

SCoin.cpp

// Fill out your copyright notice in the Description page of Project Settings.


#include "SCoin.h"

ASCoin::ASCoin()
{
	SetCreditNeed(0.0f);
}

void ASCoin::Implementation(ASPlayerState* ASP, APawn* InstigatorPawn)
{
	ASP->AddCredit(10);
	GetWorld()->DestroyActor(this);
}

這個類基本上沒有做太多的改動

在之后就是改動比較大的血瓶類

SHealthPotion.h

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "SBaseCreditUseActor.h"
#include "SHealthPotion.generated.h"

/**
 * 
 */
UCLASS()
class ACTIONROGUELIKE_API ASHealthPotion : public ASBaseCreditUseActor
{
	GENERATED_BODY()

	void Interact_Implementation(APawn* InstigatorPawn) override;

	virtual void Implementation(ASPlayerState* ASP, APawn* InstigatorPawn) override;

	UPROPERTY(EditDefaultsOnly,Category="Health")
	float HealthDelta;

	ASHealthPotion();
};

SHealthPotion.cpp

// Fill out your copyright notice in the Description page of Project Settings.


#include "SHealthPotion.h"
#include "SAttributeComponent.h"


void ASHealthPotion::Interact_Implementation(APawn* InstigatorPawn)
{
	USAttributeComponent* AttributeComp = USAttributeComponent::GetArrtibutes(InstigatorPawn);

    //主要改動是if的判斷,我需要除了credit的扣除檢測之外還要檢測玩家血量,不能說滿血也能扣除分?jǐn)?shù)進(jìn)行補(bǔ)血
	if (!CanImplement(InstigatorPawn->GetPlayerState<ASPlayerState>())||AttributeComp->GetHealth()==100)
	{
		return;
	}
	Implementation(InstigatorPawn->GetPlayerState<ASPlayerState>(), InstigatorPawn);
}

void ASHealthPotion::Implementation(ASPlayerState* ASP, APawn* InstigatorPawn)
{
	USAttributeComponent* AttributeComp = USAttributeComponent::GetArrtibutes(InstigatorPawn);
	AttributeComp->ApplyHealthChange(this, HealthDelta);
	ASP->AddCredit(-GetCreditNeed());
	GetWorld()->DestroyActor(this);
}

ASHealthPotion::ASHealthPotion()
{
	SetCreditNeed(25);
	HealthDelta = 20.0f;
}

寫完以上這些之后,就剩下隨機(jī)生成的問題了,還記得之前的機(jī)器人生成的那個函數(shù)嗎?我們用相同的方法來做。

SGameModeBase.h

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "EnvironmentQuery/EnvQueryTypes.h"
#include "../../../../../UE_5.1/Engine/Source/Runtime/AIModule/Classes/EnvironmentQuery/EnvQueryInstanceBlueprintWrapper.h"
#include "SGameModeBase.generated.h"

/**
 * 
 */
UCLASS()
class ACTIONROGUELIKE_API ASGameModeBase : public AGameModeBase
{
	GENERATED_BODY()

protected:

	UPROPERTY(EditDefaultsOnly,Category="AI")
	class UEnvQuery* SpawnBotQuery;

	UPROPERTY(EditDefaultsOnly, Category = "AI")
	class UEnvQuery* SpawnHealthQuery;

	UPROPERTY(EditDefaultsOnly,Category="AI")
	TSubclassOf<AActor> MinionClass;

	UPROPERTY(EditDefaultsOnly, Category = "AI")
	TSubclassOf<AActor> HealthClass;

	UPROPERTY(EditDefaultsOnly,Category="AI")
	class UCurveFloat* DifficultyCurve;

	FTimerHandle TimerHandle_SpawnBots;

	UPROPERTY(EditDefaultsOnly,Category = "AI")
	float SpawnTimerInterval;

	UFUNCTION()
	void SpawnBotTimerElapsed();

	UFUNCTION()
	void SpawnHealth();

	UFUNCTION()
	void OnQueryCompleted(class UEnvQueryInstanceBlueprintWrapper* QueryInstance, EEnvQueryStatus::Type QueryStatus);

	UFUNCTION()
	void OnQueryEnd(class UEnvQueryInstanceBlueprintWrapper* QueryInstance, EEnvQueryStatus::Type QueryStatus);

public:

	ASGameModeBase();

public:
	virtual void StartPlay() override;

	UFUNCTION(Exec)
	void KillAll();

	UFUNCTION()
	void RespawnPlayerElapsed(AController* Controller);

public:
	virtual void OnActorKilled(AActor* VictimActor, AActor* Killer);
	
};

SGameModeBase.cpp

// Fill out your copyright notice in the Description page of Project Settings.
#include "SGameModeBase.h"
#include "EnvironmentQuery/EnvQueryManager.h"
#include "EnvironmentQuery/EnvQueryTypes.h"
#include "EnvironmentQuery/EnvQueryInstanceBlueprintWrapper.h"
#include "/APP/Tpl/Home/Default/Public/AI/SAICharacter.h"
#include "/APP/Tpl/Home/Default/Public/SAttributeComponent.h"
#include "../../../../../UE_5.1/Engine/Source/Runtime/Engine/Public/EngineUtils.h"
#include "SCharacter.h"
#include "SPlayerState.h"
#include "SHealthPotion.h"

static TAutoConsoleVariable<bool> CVarSpawnBots(TEXT("su.SpawnBots"),true,TEXT("Enable Spawing Bots via timer."), ECVF_Cheat);

void ASGameModeBase::SpawnBotTimerElapsed()
{
    //看到下面這個函數(shù)沒,就是我們插入的函數(shù)(其實(shí)是我偷懶,懶得再寫一個timer了)
	SpawnHealth();
	if (!CVarSpawnBots.GetValueOnGameThread())
	{
		return;
	}

	int32 NrOfAliveBots = 0;
	for (TActorIterator<ASAICharacter>It(GetWorld()); It; ++It)
	{
		ASAICharacter* Bot = *It;

		USAttributeComponent* AttributeComp = USAttributeComponent::GetArrtibutes(Bot);
		if (ensure(AttributeComp) && AttributeComp->IsAlive())
		{
			NrOfAliveBots++;
		}
	}

	float MaxBotCount = 10.0f;

	if (DifficultyCurve)
	{
		MaxBotCount = DifficultyCurve->GetFloatValue(GetWorld()->TimeSeconds);
	}

	if (NrOfAliveBots >= MaxBotCount)
	{
		return;
	}

	UEnvQueryInstanceBlueprintWrapper* QuetyInstance = UEnvQueryManager::RunEQSQuery(this,SpawnBotQuery,this,EEnvQueryRunMode::RandomBest5Pct,nullptr);

	if (ensure(QuetyInstance))
	{
		FScriptDelegate QueryCompleted;
		QueryCompleted.BindUFunction(this, STATIC_FUNCTION_FNAME(TEXT("&ASGameModeBase::OnQueryCompleted")));

		QuetyInstance->GetOnQueryFinishedEvent().Add(QueryCompleted);
	}

	
}

void ASGameModeBase::SpawnHealth()
{
	int32 HealthExist = 0;
	for (TActorIterator<ASHealthPotion>It(GetWorld()); It; ++It)
	{
		HealthExist++;
	}
	float MaxHealth = 5;
	if (MaxHealth<=HealthExist)
	{
		return;
	}
	
	UEnvQueryInstanceBlueprintWrapper* QueryInstance = UEnvQueryManager::RunEQSQuery(this, SpawnHealthQuery, this, EEnvQueryRunMode::RandomBest25Pct, nullptr);

	if (ensure(QueryInstance))
		{
		FScriptDelegate QueryStop;
		QueryStop.BindUFunction(this, STATIC_FUNCTION_FNAME(TEXT("&ASGameModeBase::OnQueryEnd")));
		QueryInstance->GetOnQueryFinishedEvent().Add(QueryStop);
	}
	
	
}

void ASGameModeBase::OnQueryCompleted(UEnvQueryInstanceBlueprintWrapper* QueryInstance, EEnvQueryStatus::Type QueryStatus)
{
	if (QueryStatus != EEnvQueryStatus::Success)
	{
		UE_LOG(LogTemp,Warning,TEXT("Spawn EQS Failed!!!"))
		return;
	}


	TArray<FVector> Locations = QueryInstance->GetResultsAsLocations();

	if (Locations.IsValidIndex(0))
	{
		GetWorld()->SpawnActor<AActor>(MinionClass,Locations[0],FRotator::ZeroRotator);
	}
}

void ASGameModeBase::OnQueryEnd(class UEnvQueryInstanceBlueprintWrapper* QueryInstance, EEnvQueryStatus::Type QueryStatus)
{
	if (QueryStatus != EEnvQueryStatus::Success)
	{
		UE_LOG(LogTemp, Warning, TEXT("Spawn EQS Failed!!!"))
			return;
	}
	TArray<FVector> Locations = QueryInstance->GetResultsAsLocations();

	if (Locations.IsValidIndex(0))
	{
		GetWorld()->SpawnActor<AActor>(HealthClass, Locations[0], FRotator::ZeroRotator);
	}
}

ASGameModeBase::ASGameModeBase()
{
	SpawnTimerInterval = 2.0f;
}

void ASGameModeBase::StartPlay()
{
	Super::StartPlay();

	GetWorldTimerManager().SetTimer(TimerHandle_SpawnBots, this, &ASGameModeBase::SpawnBotTimerElapsed, SpawnTimerInterval, true);
}

void ASGameModeBase::KillAll()
{
	for (TActorIterator<ASAICharacter>It(GetWorld()); It; ++It)
	{
		ASAICharacter* Bot = *It;

		USAttributeComponent* AttributeComp = USAttributeComponent::GetArrtibutes(Bot);
		if (ensure(AttributeComp) && AttributeComp->IsAlive())
		{
			AttributeComp->Kill(this);
		}
	}
}

void ASGameModeBase::RespawnPlayerElapsed(AController* Controller)
{
	if (ensure(Controller))
	{
		Controller->UnPossess();

		RestartPlayer(Controller);

		//重生會扣50點(diǎn)Credit
		ASPlayerState* ASP = Cast<ASPlayerState>(Controller->PlayerState);
		if (ASP)
		{
			ASP->AddCredit(-50.0f);
		}
	}
}

//玩家被殺后復(fù)活的邏輯
void ASGameModeBase::OnActorKilled(AActor* VictimActor, AActor* Killer)
{
	ASCharacter* Player = Cast<ASCharacter>(VictimActor);
	if (Player)
	{
		FTimerHandle TimerHandle_RespawnDelay;

		FTimerDelegate Delegate;

		Delegate.BindUFunction(this,"RespawnPlayerElapsed",Player->GetController());

		float RespawnDelay = 2.0f;
		GetWorldTimerManager().SetTimer(TimerHandle_RespawnDelay,Delegate, RespawnDelay,false);
	}
}

仿照之前寫的那個機(jī)器人生成的方法,同時我們把生成的函數(shù)直接插入到我們timer結(jié)束就會執(zhí)行的那個函數(shù)里頭(這是個偷懶的方法),有點(diǎn)投機(jī)取巧不過很方便。文章來源地址http://www.zghlxwxcb.cn/news/detail-530473.html

到了這里,關(guān)于UE5.1.1 C++從0開始(16.作業(yè)5思路分享)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請點(diǎn)擊違法舉報進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • UE5.1.1C++從0開始(4.虛幻的接口以及交互功能)

    UE5.1.1C++從0開始(4.虛幻的接口以及交互功能)

    這一個章節(jié)對于第一次接觸虛幻的人來說可以說是最繞的一個點(diǎn),因?yàn)槔蠋熗蝗唤o你塞了很多的概念,對于這一塊的學(xué)習(xí),我個人的推薦是:先把藍(lán)圖搞明白了,再對應(yīng)到C++的代碼中,不然一定會被整的暈頭轉(zhuǎn)向。還是,有不懂的點(diǎn)就來問我。 主要有幾個大點(diǎn): 接口 自定義

    2024年02月04日
    瀏覽(26)
  • UE5.1.1創(chuàng)建C++工程失敗解決辦法

    UE5.1.1創(chuàng)建C++工程失敗解決辦法

    閑來無事,更新了一下UE5.1.1,媽蛋創(chuàng)建C++項(xiàng)目居然失敗, 錯誤截圖如下: 媽蛋,后面一堆亂碼,鬼知道是啥錯誤! 咋解決?步步高打火機(jī),直接復(fù)制第一段的Running后面的代碼到cmd中執(zhí)行。 這下看的懂了, ‘dotnet’ 不是內(nèi)部或外部命令,也不是可運(yùn)行的程序 一般出現(xiàn)xxx不

    2024年02月01日
    瀏覽(24)
  • UE5學(xué)習(xí)筆記(1)——從源碼開始編譯安裝UE5

    UE5學(xué)習(xí)筆記(1)——從源碼開始編譯安裝UE5

    0.1 在windows的話,建議裝一個Git bash,同時還要有自己的github賬號,注冊github賬號這里就不再贅述了,安裝git bash后,設(shè)置自己的github賬號?;蛘咴趙indows裝一個WSL。 0.2 把自己的github賬號關(guān)聯(lián)Epic官方,必須關(guān)聯(lián)之后才能下載Unreal的源碼。關(guān)聯(lián)方式見官方教程 0.3 安裝VS 2022,這里

    2024年02月08日
    瀏覽(103)
  • 【虛幻引擎UE】UE5 模型導(dǎo)入卡死的解決思路

    【虛幻引擎UE】UE5 模型導(dǎo)入卡死的解決思路

    1.數(shù)據(jù)分類,命名規(guī)范 2.盡量不用布爾工具 3.布線拓?fù)錂z查,檢查重復(fù)面破面 4.模型坐標(biāo)偏移不可以太大(否則大概率出錯) 5.材質(zhì)共用,不用vray材質(zhì)工具 6.檢查平滑組 7.檢查模型分組 8.切三角面(盡量不要出現(xiàn)四邊形) 方法一:將max文件拆分為多個fbx文件分別導(dǎo)入,每次及

    2023年04月08日
    瀏覽(274)
  • Ue5 C++ metahuman

    參考官網(wǎng):?創(chuàng)建MetaHuman | Epic Developer Community (epicgames.com) 參考:?Quixel Bridge中的MetaHuman | Epic Developer Community (epicgames.com) 參考:導(dǎo)出到虛幻引擎5 | Epic Developer Community (epicgames.com) 參考:在Sequencer中使用MetaHuman | Epic Developer Community (epicgames.com) 待補(bǔ)充

    2024年02月10日
    瀏覽(46)
  • ue5 c++ interface 接口

    https://docs.unrealengine.com/5.2/en-US/interfaces-in-unreal-engine/ 1 純c++ 接口? 沒有ufunction 2 純c++ 有ufunction

    2024年02月10日
    瀏覽(50)
  • UE5 C++(十七)— 射線檢測

    UE5 C++(十七)— 射線檢測

    射線檢測簡單來說就是通過相機(jī)發(fā)射一條射線,用來檢測對象的一種檢測機(jī)制。 官網(wǎng)介紹:使用射線進(jìn)行命中判定 這里主要介紹4種常用的射線檢測方式。 關(guān)鍵API: LineTraceSingleByChannel 聲明變量 MyCharacter.h 在Tick中實(shí)現(xiàn)通道進(jìn)行射線檢測 MyCharacter.cpp 編譯 之后,在場景中添加

    2024年01月18日
    瀏覽(21)
  • UE5 C++ UObject實(shí)例化

    UE5 C++ UObject實(shí)例化

    一.創(chuàng)建UObject C++類? 在MyObject中聲明結(jié)構(gòu)體FMyDataTableStruct 在MyPawn里面,先將頭文件里包含 MyObject.h 在MyPawn中聲明一個UMyObject類型的指針 TSubclassOf ?是提供 UClass 類型安全性的模板類。例如您在創(chuàng)建一個投射物類,允許設(shè)計者指定傷害類型。您可只創(chuàng)建一個 UClass 類型的 UPROPER

    2024年02月21日
    瀏覽(23)
  • UE5 C++(十四)— Interface的使用

    UE5 C++(十四)— Interface的使用

    接口是一系列抽象方法的聲明,是一些方法特征的集合,這些方法都應(yīng)該是抽象的,需要由具體的類去實(shí)現(xiàn),然后第三方就可以通過這組抽象方法調(diào)用,讓具體的類執(zhí)行具體的方法。 用c++實(shí)現(xiàn)接口類時需要注意一下幾點(diǎn): 接口類中不可以聲明成員變量,靜態(tài)變量。 可以聲明

    2024年01月17日
    瀏覽(24)
  • Ue5.1創(chuàng)建C++項(xiàng)目(Rider)

    Ue5.1創(chuàng)建C++項(xiàng)目(Rider)

    1、下載地址 2、選擇左側(cè)“Visual Studio Community 2019” 3、選擇這兩個 4、單體里添加這幾個: 注意最后一個選下邊這個 5、下載完成后到這個目錄 將原來的14.29.30133文件夾重復(fù)名,改成14.29.30136,否則報錯 整整baidu、google了1天,網(wǎng)上都沒有解決辦法 Unable to find valid 14.29.30136 too

    2024年02月02日
    瀏覽(39)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包