Minor - Implémente le système d'input - V01.05.00
Initialise la gestion des inputs avec le système Enhanced Input. Ajoute un PlayerController et un PlayerPawn de base. Définit les actions et mappings par défaut pour le mouvement.
This commit is contained in:
@@ -1,55 +1,35 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
// Include General Macros
|
||||
#include "M4_CTP_Macros.h"
|
||||
|
||||
#define MESH_DEFAULT TEXT("SM_Cube.SM_Cube")
|
||||
|
||||
// Include necessary Unreal Engine headers
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Pawn.h"
|
||||
#include "InputAction.h"
|
||||
#include "InputActionValue.h"
|
||||
#include "InputMappingContext.h"
|
||||
#include "Components/StaticMeshComponent.h"
|
||||
#include "EnhancedInputComponent.h"
|
||||
#include "EnhancedInputSubsystems.h"
|
||||
#include "Camera/CameraComponent.h"
|
||||
#include "M4_PlayerPawn.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class UCameraComponent;
|
||||
|
||||
UCLASS()
|
||||
class M4_CPP_API AM4_PlayerPawn : public APawn
|
||||
class AM4_PlayerPawn : public APawn
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public :
|
||||
public:
|
||||
AM4_PlayerPawn();
|
||||
|
||||
virtual void BeginPlay() override;
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
|
||||
UStaticMeshComponent* GetMeshComponent() const { return MeshComponent; }
|
||||
|
||||
virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override;
|
||||
void Move(const FInputActionInstance& Instance);
|
||||
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
private:
|
||||
|
||||
UPROPERTY(EditAnywhere,Category = "Centipede")
|
||||
TObjectPtr<UStaticMeshComponent> MeshComponent;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Centipede")
|
||||
TSoftObjectPtr<UStaticMesh> DefaultMesh = \
|
||||
TSoftObjectPtr<UStaticMesh>(FSoftObjectPath(FString(C_MESH_FOLDER) + MESH_DEFAULT));
|
||||
|
||||
UStaticMesh* LoadedMesh;
|
||||
UPROPERTY(VisibleAnywhere)
|
||||
UStaticMeshComponent* MeshComponent;
|
||||
|
||||
UPROPERTY(VisibleAnywhere)
|
||||
UCameraComponent* CameraComponent;
|
||||
|
||||
};
|
||||
|
||||
UPROPERTY()
|
||||
UInputAction* MoveAction;
|
||||
|
||||
float MoveSpeed = 500.f;
|
||||
float LastMoveValue = 0; // Pour stockage du mouvement
|
||||
};
|
||||
Reference in New Issue
Block a user