-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHollowKnight.h
98 lines (81 loc) · 2.19 KB
/
HollowKnight.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "MotionStates.h"
#include "HollowKnight.generated.h"
UCLASS()
class PLASMOID_API AHollowKnight : public APawn
{
GENERATED_BODY()
public:
// Sets default values for this pawn's properties
AHollowKnight();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
UPROPERTY(EditAnywhere)
class USphereComponent* capsule;
UPROPERTY(EditAnywhere)
class UFloatingPawnMovement* pawnMovement;
UPROPERTY(EditAnywhere)
class UCameraComponent* camera;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
//Dash
float dashTimer;
float dashDuration;
float dashAcceleration;
float dashMaxSpeed;
FVector dashDirection;
int dashCounter;
void StartDash();
void Dashing(float deltaSeconds);
void StopDash();
//Jump
float jumpSpeedCap;
float jumpAcceleration;
float jumpTimer;
float jumpMaxDuration;
bool doubleJump;
void StartJump();
void Jumping(float deltaSeconds);
void StopJump(bool sharp);
void Jump();
void InterruptJump();
bool IsInAir();
void Grounded();
UFUNCTION()
void Ungrounded();
FVector lookDirection;
//Movement
FVector addedVelocity;
FVector velocity;
float maxWalkSpeed;
EMotionStates::Type motionState;
void AddVelocity(FVector direction, float scale);
void ResolveMovement(float deltaSeconds);
bool ChangeMovement(EMotionStates::Type newMotionState);
void MoveHorizontal(float amount);
//Wall Movement
float wallFallSpeed;
FVector wallNormal;
bool landedOnWall;
bool touchingWall;
bool wallJumpInitial;
FVector wallDirection;
void OnWall(FVector hitNormal);
void CheckWallCollision();
UFUNCTION()
void CompleteWallLanding();
//Gravity
float gravityAcceleration;
float risingGravityAcceleration;
float maxFallSpeed;
void AddGravity();
UFUNCTION()
void OnHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComponent, FVector NormalImpulse, const FHitResult& Hit);
};