Fencing/Source/Fencing_V2/SwordMotionController.h
2017-09-19 14:02:44 -04:00

55 lines
1.5 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Runtime/HeadMountedDisplay/Public/HeadMountedDisplay.h"
#include "Runtime/HeadMountedDisplay/Public/MotionControllerComponent.h"
#include "Runtime/Engine/Classes/Sound/SoundCue.h"
#include "Runtime/Engine/Classes/Components/AudioComponent.h"
#include "SwordMotionController.generated.h"
UCLASS()
class FENCING_V2_API ASwordMotionController : public AActor
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = MotionController)
class UMotionControllerComponent* LeftMotionController;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Physic)
UStaticMeshComponent* SwordMesh;
bool IsAttacking = false;
bool CanceledAttack = false;
USoundCue* SwordAudioCue;
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Sound)
UAudioComponent* SwordAudioComponent;
int PlayerIndex = 0;
public:
// Sets default values for this actor's properties
ASwordMotionController();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
void Attack();
UFUNCTION(BlueprintCallable, Category = "SwordAttack")
void ReadyToAttack();
void CancelAttack();
void SetPlayerIndex(int value) { PlayerIndex = value; }
UFUNCTION(BlueprintCallable, Category = SwordMotion)
int GetPlayerIndex() { return PlayerIndex; }
};