2025-10-15 18:25:31 +08:00

127 lines
4.0 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "InputActionValue.h"
#include "GameFramework/Character.h"
#include "ProjectFish/Definations.h"
#include "Shipbase.generated.h"
UCLASS(PrioritizeCategories = Config)
class PROJECTFISH_API AShipbase : public ACharacter
{
GENERATED_BODY()
public:
// Sets default values for this character's properties
AShipbase();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
virtual void NotifyControllerChanged() override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
#if WITH_EDITOR
virtual void PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent) override;
#endif
UFUNCTION()
void OnOverlapWall(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp,
int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
UFUNCTION(BlueprintImplementableEvent, Category = "Fishing")
void OnFishingBegin();
UFUNCTION(BlueprintImplementableEvent, Category = "Fishing")
void OnFishingCancel();
UFUNCTION(BlueprintImplementableEvent, Category = "Fishing")
void OnFishingComplete();
protected:
/** Called for movement input */
void Move(const FInputActionValue& Value);
/** Called for looking input */
void Look(const FInputActionValue& Value);
void SprintMove();
void StopSprintMove();
void Fishing();
void FishingMouseMove(const FInputActionValue& Value);
/*** ApplyConfig ***/
void ApplyShipSize();
void ApplyMovementSettings();
void ApplyCameraSettings();
private:
FVector MoveForward;
FVector MoveRight;
protected:
UPROPERTY(EditAnywhere,BlueprintReadOnly, Category= "Config", meta = (AllowPrivateAccess = "true"))
FShipDataConfig ShipData;
UPROPERTY(VisibleAnywhere,BlueprintReadOnly, Category = Ship, meta = ( AllowPrivateAccess = "true"))
class UStaticMeshComponent* ShipMesh;
/***Camera***/
UPROPERTY(VisibleAnywhere,BlueprintReadOnly, Category = Camera, meta = ( AllowPrivateAccess = "true"))
class UShipSpringArmComponent* CameraBoom;
UPROPERTY(VisibleAnywhere,BlueprintReadOnly, Category = Camera, meta = ( AllowPrivateAccess = "true"))
class UCameraComponent* FollowCamera;
/***Input***/
/** MappingContext */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputMappingContext* MoveMappingContext;
/** Sprint Move Input Action */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputAction* SprintAction;
/** Move Input Action */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputAction* MoveAction;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputAction* FishingMoveAction;
/** Look Input Action */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputAction* LookAction;
//钓鱼相关
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputMappingContext* FishingMappingContext;
/** Sprint Move Input Action */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputAction* FishingAction;
/*** Invenroty ***/
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Inventory, meta = (AllowPrivateAccess = "true", ToolTip = "玩家背包携带的技能"))
class UBagConfigAsset* DefaultPlayerBag;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Inventory, meta = (AllowPrivateAccess = "true", ToolTip = "鱼竿装备槽形状"))
class UShapeAsset* FishingRodShape;
private:
FTimerHandle FishingTimerHandle;
bool bIsFishing = false;;
};