Advertisement
Guest User

TwinStickCPawn.h

a guest
Feb 27th, 2015
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.65 KB | None | 0 0
  1. // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
  2. #pragma once
  3.  
  4. #include "GameFramework/Character.h"
  5. #include "TwinStickCPawn.generated.h"
  6.  
  7.  
  8.  
  9. UCLASS(Blueprintable)
  10. class ATwinStickCPawn : public APawn
  11. {
  12.     GENERATED_BODY()
  13.  
  14.     /* The mesh component */
  15.     UPROPERTY(Category = Mesh, VisibleDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
  16.     class UStaticMeshComponent* ShipMeshComponent;
  17.  
  18.     /** The camera */
  19.     UPROPERTY(Category = Camera, VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
  20.     class UCameraComponent* CameraComponent;
  21.  
  22.     /** Camera boom positioning the camera above the character */
  23.     UPROPERTY(Category = Camera, VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
  24.     class USpringArmComponent* CameraBoom;
  25.  
  26. public:
  27.     ATwinStickCPawn(const FObjectInitializer& ObjectInitializer);
  28.  
  29.     /** Offset from the ships location to spawn projectiles */
  30.     UPROPERTY(Category = Gameplay, EditAnywhere, BlueprintReadWrite )
  31.     FVector GunOffset;
  32.    
  33.     /* How fast the weapon will fire */
  34.     UPROPERTY(Category = Gameplay, EditAnywhere, BlueprintReadWrite)
  35.     float FireRate;
  36.  
  37.     /* The speed our ship moves around the level */
  38.     UPROPERTY(Category = Gameplay, EditAnywhere, BlueprintReadWrite)
  39.     float MoveSpeed;
  40.  
  41.     /** Sound to play each time we fire */
  42.     UPROPERTY(Category = Audio, EditAnywhere, BlueprintReadWrite)
  43.     class USoundBase* FireSound;
  44.  
  45.     UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = JumpyFrogs)
  46.     TSubclassOf<class AActor> BlueprintVar;
  47.  
  48.     // Begin Actor Interface
  49.     virtual void Tick(float DeltaSeconds) override;
  50.     virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
  51.     // End Actor Interface
  52.  
  53.     /* Fire a shot in the specified direction */
  54.     void FireShot(FVector FireDirection);
  55.  
  56.     /* Handler for the fire timer expiry */
  57.     void ShotTimerExpired();
  58.  
  59.     // Static names for axis bindings
  60.     static const FName MoveForwardBinding;
  61.     static const FName MoveRightBinding;
  62.     static const FName FireForwardBinding;
  63.     static const FName FireRightBinding;
  64.  
  65. private:
  66.  
  67.     /* Flag to control firing  */
  68.     uint32 bCanFire : 1;
  69.  
  70.     /** Handle for efficient management of ShotTimerExpired timer */
  71.     FTimerHandle TimerHandle_ShotTimerExpired;
  72.  
  73. public:
  74.     /** Returns ShipMeshComponent subobject **/
  75.     FORCEINLINE class UStaticMeshComponent* GetShipMeshComponent() const { return ShipMeshComponent; }
  76.     /** Returns CameraComponent subobject **/
  77.     FORCEINLINE class UCameraComponent* GetCameraComponent() const { return CameraComponent; }
  78.     /** Returns CameraBoom subobject **/
  79.     FORCEINLINE class USpringArmComponent* GetCameraBoom() const { return CameraBoom; }
  80. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement