En passant par une méthode similaire à la génération de la caméra, j'ai pu faire spawner les projectiles, maintenant à partir de leur classe, je vais ajouter leur déplacement et physique dès leur initiation.
46 lines
987 B
C++
46 lines
987 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);
|
|
|
|
protected:
|
|
|
|
UPROPERTY(VisibleAnywhere)
|
|
UStaticMeshComponent* MeshComponent;
|
|
|
|
UPROPERTY()
|
|
UInputAction* MoveAction;
|
|
|
|
UPROPERTY()
|
|
UInputAction* ShootAction;
|
|
|
|
UPROPERTY(VisibleAnywhere)
|
|
AM4_Projectile* Proj;
|
|
|
|
UPROPERTY(VisibleAnywhere)
|
|
TObjectPtr<AM4_Projectile> Projection;
|
|
|
|
//bool HasShot = false;
|
|
float MoveSpeed = 500.f;
|
|
FVector2D MeshScale = FVector2D(0.6f, 0.5f);
|
|
FVector2D LastMoveValue = FVector2D::ZeroVector;
|
|
}; |