Advertisement
Dieton

SlashCharacter.h

Nov 13th, 2023 (edited)
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.41 KB | Gaming | 0 0
  1. // Fill out your copyright notice in the Description page of Project Settings.
  2.  
  3. #pragma once
  4.  
  5. #include "CoreMinimal.h"
  6. #include "GameFramework/Character.h"
  7.  
  8. #include "InputActionValue.h"//Struct header file
  9. #include "CharacterTypes.h"
  10.  
  11. #include "SlashCharacter.generated.h"
  12.  
  13. class UInputMappingContext;
  14. class UInputAction;
  15. class USpringArmComponent;
  16. class UCameraComponent;
  17. class UGroomComponent;
  18. class AItem;
  19. class UAnimMontage;
  20. class AWeapon;
  21.  
  22. UCLASS()
  23. class SLASH_API ASlashCharacter : public ACharacter
  24. {
  25.     GENERATED_BODY()
  26.  
  27. public:
  28.     // Sets default values for this character's properties
  29.     ASlashCharacter();
  30.  
  31.     UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input)
  32.     UInputMappingContext* SlashMappingContext;
  33.  
  34.     UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input)
  35.     UInputAction* MovementAction;
  36.  
  37.     UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input)
  38.     UInputAction* LookAction;
  39.  
  40.     UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input)
  41.     UInputAction* JumpAction;
  42.  
  43.     UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input)
  44.     UInputAction* EquipAction;
  45.  
  46.     UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input)
  47.     UInputAction* AttackAction;
  48.  
  49.     UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input)
  50.     UInputAction* DodgeAction;
  51.  
  52.     // Called every frame
  53.     virtual void Tick(float DeltaTime) override;
  54.  
  55.     // Called to bind functionality to input
  56.     virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
  57.  
  58.     UFUNCTION(BlueprintCallable)
  59.     void SetWeaponCollisionEnable(ECollisionEnabled::Type CollisionEnabled);
  60.  
  61.     //UFUNCTION(BlueprintCallable)
  62.     //void SetWeaponCollisionDisable(ECollisionEnabled::Type CollisionEnabled);
  63.  
  64. protected:
  65.     // Called when the game starts or when spawned
  66.     virtual void BeginPlay() override;
  67.  
  68.     /*
  69.     Callbacks for inputs
  70.     */
  71.     void Move(const FInputActionValue& Value);
  72.     void Look(const FInputActionValue& Value);
  73.     void Jump();
  74.     void Equip();
  75.     void Attack();
  76.     void Dodge();
  77.  
  78.     /*
  79.     Play Montage Functions
  80.     */
  81.     void PlayAttackMontage();
  82.  
  83.     UFUNCTION(BlueprintCallable)
  84.     void AttackEnd();
  85.     bool CanAttack();
  86.  
  87.     void PlayeEquipMontage(const FName& SectionName);
  88.     bool CanDisarm();
  89.     bool CanArm();
  90.  
  91.     UFUNCTION(BlueprintCallable)
  92.     void Disarm();
  93.  
  94.     UFUNCTION(BlueprintCallable)
  95.     void Arm();
  96.  
  97.     UFUNCTION(BlueprintCallable)
  98.     void FinishEquipping();
  99.  
  100. private:
  101.  
  102.     ECharacterState CharacterState = ECharacterState::ECS_Unequipped;
  103.  
  104.     UPROPERTY(BlueprintReadWrite, meta = (AllowPrivateAccess = "true"))
  105.     EActionState ActionState = EActionState::EAS_Unoccupied;
  106.  
  107.     UPROPERTY(VisibleAnywhere, Category = "Camera")
  108.     USpringArmComponent* CameraBoom;
  109.  
  110.     UPROPERTY(VisibleAnywhere, Category = "Camera")
  111.     UCameraComponent* ViewCamera;
  112.  
  113.     UPROPERTY(VisibleAnywhere, Category = Hair)
  114.     UGroomComponent* Hair;
  115.  
  116.     UPROPERTY(VisibleAnywhere, Category = Hair)
  117.     UGroomComponent* Eyebrows;
  118.  
  119.     UPROPERTY(VisibleInstanceOnly)
  120.     AItem* OverlapingItem;
  121.  
  122.     UPROPERTY(VisibleAnywhere, Category = Weapon)
  123.     AWeapon* EquippedWeapon;
  124.  
  125.     /*
  126.     Animation Montages
  127.     */
  128.     UPROPERTY(EditDefaultsOnly, Category = Montages)
  129.     UAnimMontage* AttackMontage;
  130.  
  131.     UPROPERTY(EditDefaultsOnly, Category = Montages)
  132.     UAnimMontage* EquipMontage;
  133.  
  134. public:
  135.     FORCEINLINE void SetOverlappingItem(AItem* Item) { OverlapingItem = Item; }//inline or FORCEINLINE
  136.     FORCEINLINE ECharacterState GetCharacterState() const { return CharacterState; }
  137. };
  138.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement