Files
PHY/Source/PHY/Private/Character/PHYCharacter.cpp
2026-03-05 14:44:34 +08:00

38 lines
1.3 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Fill out your copyright notice in the Description page of Project Settings.
#include "Character/PHYCharacter.h"
#include "GIS_InventorySystemComponent.h"
#include "Equipping/GIS_EquipmentSystemComponent.h"
#include "GMS_CharacterMovementSystemComponent.h"
#include "Components/RetargeterComponent.h"
// Sets default values
APHYCharacter::APHYCharacter()
{
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
InventorySystemComponent = CreateDefaultSubobject<UGIS_InventorySystemComponent>(TEXT("InventorySystem"));
EquipmentSystemComponent = CreateDefaultSubobject<UGIS_EquipmentSystemComponent>(TEXT("EquipmentSystem"));
MovementSystemComponent = CreateDefaultSubobject<UGMS_CharacterMovementSystemComponent>(TEXT("MovementSystem"));
RetargeterComponent = CreateDefaultSubobject<URetargeterComponent>(TEXT("Retargeter"));
}
// Called when the game starts or when spawned
void APHYCharacter::BeginPlay()
{
Super::BeginPlay();
// 库存初始化应由服务器执行(组件接口也标记了 BlueprintAuthorityOnly
if (HasAuthority() && InventorySystemComponent)
{
InventorySystemComponent->InitializeInventorySystem();
if (EquipmentSystemComponent)
{
EquipmentSystemComponent->InitializeEquipmentSystem();
}
}
}