38 lines
1.3 KiB
C++
38 lines
1.3 KiB
C++
// 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();
|
||
}
|
||
}
|
||
}
|