Le joueur peut enfin faire apparaître le projectile dans la scène après avoir appuyé sur la touche "Espace". Cependant le Mesh n'apparait toujours pas pour l'instant mais j'ai presque fini.
42 lines
946 B
C++
42 lines
946 B
C++
#pragma once
|
|
|
|
#include "M4_Projectile.h"
|
|
#include "CoreMinimal.h"
|
|
#include "GameFramework/Pawn.h"
|
|
#include "InputAction.h"
|
|
#include "M4_PlayerPawn.generated.h"
|
|
|
|
class UCameraComponent;
|
|
|
|
UCLASS()
|
|
class AM4_PlayerPawn : public APawn
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
AM4_PlayerPawn();
|
|
|
|
virtual void BeginPlay() override;
|
|
virtual void Tick(float DeltaTime) override;
|
|
virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override;
|
|
void Move(const FInputActionInstance& Instance);
|
|
void Shoot(const FInputActionInstance& Inst);
|
|
|
|
UPROPERTY(VisibleAnywhere)
|
|
TSubclassOf<AM4_Projectile> Proj = AM4_Projectile::StaticClass();
|
|
|
|
protected:
|
|
|
|
UPROPERTY(VisibleAnywhere)
|
|
UStaticMeshComponent* MeshComponent;
|
|
|
|
UPROPERTY()
|
|
UInputAction* MoveAction;
|
|
|
|
UPROPERTY()
|
|
UInputAction* ShootAction;
|
|
|
|
float MoveSpeed = 500.f;
|
|
FVector2D MeshScale = FVector2D(0.6f, 0.5f);
|
|
FVector2D LastMoveValue = FVector2D::ZeroVector;
|
|
}; |