LEAP Documentation 40220
Documentation for the LEAP project
WeaponInstancePowerSword.h
Go to the documentation of this file.
1// Copyright Blue Isle Studios Inc 2018. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
8#include "WeaponInstancePowerSword.generated.h"
9
11class AProjectile;
12class UAnimMontage;
13
14DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FToggleSignature, bool, bToggle);
15
16UCLASS()
18{
19 GENERATED_UCLASS_BODY()
20
21public:
22 virtual bool CanFire(EWeaponError& ErrorMessage, uint8 Mode = 0) const override;
23 virtual bool Fire(uint8 Mode = 0, float WorldTimeOverride = -1.f) override;
24 virtual void FireReleased(uint8 Mode /* = 0 */) override;
25 virtual bool UnEquip(bool bForce = false) override;
26 virtual void BeginPlay() override;
27 virtual void FireComplete(uint8 Mode = 0) override;
28
29 /* Gets the current state being tracked on the Blueprint for animation purposes */
30 UFUNCTION(BlueprintImplementableEvent)
31 int32 GetAnimState() const;
32
33protected:
34 virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction);
35 virtual bool HandleProjectileReflection_Implementation(TSubclassOf<AProjectile> ProjectileClass, TSubclassOf<UWeaponInstanceRanged> Weapon, const FHitResult& HitResult) override;
36 virtual bool IsReflectionActive_Implementation(TSubclassOf<AProjectile> ProjectileClass, TSubclassOf<UWeaponInstanceRanged> Weapon, const FHitResult& HitResult) override;
37
38
39protected:
40
41 UPROPERTY(BlueprintReadOnly, Category = "Melee Weapon")
42 float MeleeRange = 10000.0f;
43 /* How far can the sword swing and how wide? Used for telegraphing the user's reticle */
44 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Melee Weapon")
45 FVector MeleeExtents = FVector(1750.f, 120.f, 120.f);
46 /* How far from the player's view can we be before reflection stops working? (Cone angle/halfangle) */
47 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Melee Weapon")
48 float ReflectionAngle = 90.0f;
49 /* How much stamina does it cost to enter reflective stance */
50 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Melee Weapon")
51 float ReflectionStanceStaminaCost = 10.0f;
52 /* How much stamina does it cost per second to maintain reflective stance */
53 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Melee Weapon")
54 float ReflectionStanceStaminaCostPerSecond = 2.0f;
55 /* Blocking Animation to play 1P. If montage has multiple sections, one will be chosen randomly */
56 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Melee Weapon")
57 TArray<UAnimMontage*> ReflectMontages1P;
58 /* Blocking Animation to play 3P. If montage has multiple sections, one will be chosen randomly */
59 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Melee Weapon")
60 TArray<UAnimMontage*> ReflectMontages3P;
61
62 UFUNCTION(NetMulticast, Unreliable)
63 void Multicast_BlockEffect();
64 UFUNCTION(Server, Reliable)
65 void Server_ToggleReflection(bool bToggle);
66
67 UPROPERTY(BlueprintAssignable)
68 FToggleSignature OnReflectionToggled;
69 UPROPERTY(BlueprintAssignable)
70 FToggleSignature OnTargetInSwordRange;
71
72private:
73
74 UPROPERTY(ReplicatedUsing="OnRep_ReflectionActive")
75 bool bReflectionModeActive = false;
76
77 uint8 AnimCounter = 0;
78 float ReflectionAngleCos = 0.0f;
79 FTimerHandle StaminaDrainTimerHandle;
80
81 void TickReflection();
82 bool IsWithinConeAngle(const FVector& HitLocation) const;
83
84 UFUNCTION()
85 void OnRep_ReflectionActive();
86};
EWeaponError
Definition: WeaponComponent.h:15
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FToggleSignature, bool, bToggle)
Definition: Projectile.h:18
Definition: ProjectileReflectionInterface.h:16
Definition: WeaponInstanceMelee.h:41
Definition: WeaponInstancePowerSword.h:18
Definition: WeaponInstanceRanged.h:27