-
Notifications
You must be signed in to change notification settings - Fork 0
/
FloorSwitch.h
77 lines (53 loc) · 2.45 KB
/
FloorSwitch.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Components/BoxComponent.h"
#include "GameFramework/Actor.h"
#include "FloorSwitch.generated.h"
UCLASS()
class UNREALCPPTEST_API AFloorSwitch : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AFloorSwitch();
/* Overlap For the function to be triggered */
UPROPERTY(VisibleAnywhere,BlueprintReadWrite,Category = "Box Mesh")
UBoxComponent* TriggerBox; //Box 為 Unity 中的 BoxCollision
/*Switch for the character to step on */
UPROPERTY(VisibleAnywhere,BlueprintReadWrite,Category = "Box Mesh")
UStaticMeshComponent* FloorSwitch;
UPROPERTY(VisibleAnywhere,BlueprintReadWrite,Category = "Box Mesh")
UStaticMeshComponent* Door;
UPROPERTY(BlueprintReadWrite,Category = "Switch")
FVector InitialDoorLocation;
UPROPERTY(BlueprintReadWrite,Category = "Switch")
FVector InitialSwitchLocation;
UPROPERTY(EditAnywhere,BlueprintReadWrite,Category = "Timer")
float SwitchTime;
FTimerHandle SwitchHandleTimer;
void CloseDoor();
bool bCharacterOnSwitch;
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
UFUNCTION(BlueprintCallable)
void OnOverlapBox(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult);
UFUNCTION()
void OnOverlapBoxEnd(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);
UFUNCTION(BlueprintImplementableEvent,Category = "Floor Switch")//BlueprintImplementableEvent 是指不用在C++ 實現功能
void RaiseDoor();
UFUNCTION(BlueprintImplementableEvent,Category = "Floor Switch")//BlueprintImplementableEvent 是指不用在C++ 實現功能
void LowerDoor();
UFUNCTION(BlueprintImplementableEvent,Category = "Floor Switch")//BlueprintImplementableEvent 是指不用在C++ 實現功能
void RaisefloorSwitch();
UFUNCTION(BlueprintImplementableEvent,Category = "Floor Switch")//BlueprintImplementableEvent 是指不用在C++ 實現功能
void LowerfloorSwitch();
UFUNCTION(BlueprintCallable,Category = "Floor Switch")
void UpdateDoorLocation(float ZLocation);
UFUNCTION(BlueprintCallable,Category = "Floor Switch")
void UpdateFloorSwitchLocation(float ZLocation);
};