diff --git a/Config/DefaultEditor.ini b/Config/DefaultEditor.ini index e69de29b..8b137891 100644 --- a/Config/DefaultEditor.ini +++ b/Config/DefaultEditor.ini @@ -0,0 +1 @@ + diff --git a/Config/DefaultInput.ini b/Config/DefaultInput.ini index db67efb0..dac4992d 100644 --- a/Config/DefaultInput.ini +++ b/Config/DefaultInput.ini @@ -76,6 +76,8 @@ FOVScale=0.011110 DoubleClickTime=0.200000 +ActionMappings=(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=SpaceBar) +ActionMappings=(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Gamepad_FaceButton_Bottom) ++ActionMappings=(ActionName="FireButton",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=LeftMouseButton) ++ActionMappings=(ActionName="FireButton",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Gamepad_RightTrigger) +AxisMappings=(AxisName="MoveForward",Scale=1.000000,Key=W) +AxisMappings=(AxisName="MoveForward",Scale=-1.000000,Key=S) +AxisMappings=(AxisName="MoveForward",Scale=1.000000,Key=Gamepad_LeftY) diff --git a/Content/ParagonLtBelica/Characters/Heroes/Belica/Meshes/Belica_Skeleton.uasset b/Content/ParagonLtBelica/Characters/Heroes/Belica/Meshes/Belica_Skeleton.uasset index 46af1e0c..164cfd9f 100644 --- a/Content/ParagonLtBelica/Characters/Heroes/Belica/Meshes/Belica_Skeleton.uasset +++ b/Content/ParagonLtBelica/Characters/Heroes/Belica/Meshes/Belica_Skeleton.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:78c3a87ea3aeb1a03b13b2d89e752bb72927caa96b52687933dcec08f22df030 -size 43333 +oid sha256:36a02a3e0912e26419f907ec51bcfe36ec9957de3117559959dc017378325bba +size 56978 diff --git a/Content/_Game/Assets/FX/P_BelicaMuzzle_Single_Burst.uasset b/Content/_Game/Assets/FX/P_BelicaMuzzle_Single_Burst.uasset new file mode 100644 index 00000000..09730d37 --- /dev/null +++ b/Content/_Game/Assets/FX/P_BelicaMuzzle_Single_Burst.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d37d2244dba74f404dc2d0e93ca4604758efdafd69183621cff3894220539591 +size 368842 diff --git a/Content/_Game/Assets/Sounds/Gunshots/AR15_Generic_Shot.uasset b/Content/_Game/Assets/Sounds/Gunshots/AR15_Generic_Shot.uasset new file mode 100644 index 00000000..4ecc29d3 --- /dev/null +++ b/Content/_Game/Assets/Sounds/Gunshots/AR15_Generic_Shot.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb194d78d761efb042e253f64b741d9a67dd9182fdbdc5209fd107c83fee7d3c +size 534876 diff --git a/Content/_Game/Assets/Sounds/Gunshots/AR_Shot.uasset b/Content/_Game/Assets/Sounds/Gunshots/AR_Shot.uasset new file mode 100644 index 00000000..81d39f75 --- /dev/null +++ b/Content/_Game/Assets/Sounds/Gunshots/AR_Shot.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ba456d124d5ab7324923066f6ae902485974d3c2efb6f70b2138c52fcec30219 +size 15954 diff --git a/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_1.uasset b/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_1.uasset new file mode 100644 index 00000000..56db10f7 --- /dev/null +++ b/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_1.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f813472744c7df5dc569d02cecad321a11601f3e94e7c8d2979f84cf3a9de096 +size 31945 diff --git a/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_10.uasset b/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_10.uasset new file mode 100644 index 00000000..f57fbe60 --- /dev/null +++ b/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_10.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:279b38670c6242058559c00d97273e021ffb90d2468a3a2a860b8f4eb56f95b0 +size 30955 diff --git a/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_2.uasset b/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_2.uasset new file mode 100644 index 00000000..1f561d73 --- /dev/null +++ b/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_2.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d060a110c04be2340b73c333e501fb4525e1551117439ece7762be6fab70d74d +size 30688 diff --git a/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_3.uasset b/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_3.uasset new file mode 100644 index 00000000..d921969e --- /dev/null +++ b/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_3.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:955d24f7b05548296138d88eb843d0d6626b94043e69eda245e976767a25eceb +size 32396 diff --git a/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_4.uasset b/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_4.uasset new file mode 100644 index 00000000..086fdaae --- /dev/null +++ b/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_4.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2aacb6c3d83f47acba756e471ce0efc36a866c79a218d7ed23081404d0af0ee1 +size 31747 diff --git a/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_5.uasset b/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_5.uasset new file mode 100644 index 00000000..40022525 --- /dev/null +++ b/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_5.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:16ab62bb1b137f75c7b639fa0f184dbf757dc41ae946ac6d64bc1fb68811722f +size 32198 diff --git a/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_6.uasset b/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_6.uasset new file mode 100644 index 00000000..42ba7719 --- /dev/null +++ b/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_6.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd97bfabd313acd239bb0cb7ca48415b939d45271dea5d56135a1030449cf669 +size 31002 diff --git a/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_7.uasset b/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_7.uasset new file mode 100644 index 00000000..5282b5d7 --- /dev/null +++ b/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_7.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:20a8d4a9b201c27e419868d474afe9490b75108d9adc04839f08f7c324b52d3a +size 32220 diff --git a/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_8.uasset b/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_8.uasset new file mode 100644 index 00000000..39cf0a0a --- /dev/null +++ b/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_8.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b8af6ff1b334e2a4217f0f4ae80702279622b1c1ad1978abebbf03a6a5fe819a +size 31871 diff --git a/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_9.uasset b/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_9.uasset new file mode 100644 index 00000000..14351b45 --- /dev/null +++ b/Content/_Game/Assets/Sounds/Gunshots/AR_Shot_9.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6ebc4fbe3fcfe548ab0a1564efe2a472619be098f296fa96b4c9001b0f1f4e5d +size 31012 diff --git a/Content/_Game/Character/Animations/HipFireMontage.uasset b/Content/_Game/Character/Animations/HipFireMontage.uasset new file mode 100644 index 00000000..0661ef01 --- /dev/null +++ b/Content/_Game/Character/Animations/HipFireMontage.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:14f36d1aaa7a1336d92c85b8b7f89695c692868dde8edfbddc3eaee372b93888 +size 8674 diff --git a/Content/_Game/Character/Animations/Jog_Fwd_Start_Trimmed.uasset b/Content/_Game/Character/Animations/Jog_Fwd_Start_Trimmed.uasset new file mode 100644 index 00000000..995541ab --- /dev/null +++ b/Content/_Game/Character/Animations/Jog_Fwd_Start_Trimmed.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb8c05a323eba4147ed27d8ee26366c26a418b607ae76727f0a2d91145204202 +size 226896 diff --git a/Content/_Game/Character/Animations/Jog_Fwd_Stop_Trimmed.uasset b/Content/_Game/Character/Animations/Jog_Fwd_Stop_Trimmed.uasset new file mode 100644 index 00000000..4a3b7863 --- /dev/null +++ b/Content/_Game/Character/Animations/Jog_Fwd_Stop_Trimmed.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:11395925a004819c2a71d85ec7d7fbda08b23db5146b42819f30667a46ce16a1 +size 242686 diff --git a/Content/_Game/Character/Animations/Primary_Fire_Fast_Trimmed.uasset b/Content/_Game/Character/Animations/Primary_Fire_Fast_Trimmed.uasset new file mode 100644 index 00000000..6af0836e --- /dev/null +++ b/Content/_Game/Character/Animations/Primary_Fire_Fast_Trimmed.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b61910b9ffc3f0652e6f51c3655793c3be207c9eeddbca75fabe223d82657f9e +size 112215 diff --git a/Content/_Game/Character/ShooterAnimBP.uasset b/Content/_Game/Character/ShooterAnimBP.uasset new file mode 100644 index 00000000..023c1135 --- /dev/null +++ b/Content/_Game/Character/ShooterAnimBP.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2130763040f1657ec4c4b27ad89a664bd3ffcc97ee2ffb4df56caddd23299a48 +size 238642 diff --git a/Content/_Game/Character/ShooterCharacterBP.uasset b/Content/_Game/Character/ShooterCharacterBP.uasset index fb717309..45a74fe0 100644 --- a/Content/_Game/Character/ShooterCharacterBP.uasset +++ b/Content/_Game/Character/ShooterCharacterBP.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8b1d88174ae76c446f69febd2b9fa19cbccb12a1c1234024b3f7c410c4538eae -size 32648 +oid sha256:11c151c3a1825c601da4e398b6fd19a6f418a872eb11953809575ad7902f578f +size 34247 diff --git a/Content/_Game/Maps/DefaultMap.umap b/Content/_Game/Maps/DefaultMap.umap index 1f9cc65e..2b9bd3ce 100644 --- a/Content/_Game/Maps/DefaultMap.umap +++ b/Content/_Game/Maps/DefaultMap.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9f3866a8fc91ef1ab553642567e4189d18231207dafcfb1b81a191719696cc86 +oid sha256:45d088240a9ecaa5d4859fb3d176b331a7eb3159c0a08ea4277c8a89242943a3 size 32301 diff --git a/Source/Shooter/ShooterAnimInstance.cpp b/Source/Shooter/ShooterAnimInstance.cpp new file mode 100644 index 00000000..09c16957 --- /dev/null +++ b/Source/Shooter/ShooterAnimInstance.cpp @@ -0,0 +1,34 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "ShooterAnimInstance.h" + +#include "ShooterCharacter.h" +#include "GameFramework/CharacterMovementComponent.h" + +void UShooterAnimInstance::UpdateAnimationProperties(float DeltaTime) +{ + if (ShooterCharacter) + ShooterCharacter = Cast(TryGetPawnOwner()); + + if (ShooterCharacter) + { + // Get the speed of the character from velocity + FVector Velocity{ ShooterCharacter->GetVelocity() }; + Velocity.Z = 0; + Speed = Velocity.Size(); + + // Is the character in the air + bIsInAir = ShooterCharacter->GetCharacterMovement()->IsFalling(); + + // Is the character accelerating + bIsAccelerating = ShooterCharacter->GetCharacterMovement()->GetCurrentAcceleration().Size() > 0; + } +} + +void UShooterAnimInstance::NativeInitializeAnimation() +{ + Super::NativeInitializeAnimation(); + + ShooterCharacter = Cast(TryGetPawnOwner()); +} diff --git a/Source/Shooter/ShooterAnimInstance.h b/Source/Shooter/ShooterAnimInstance.h new file mode 100644 index 00000000..54d9935b --- /dev/null +++ b/Source/Shooter/ShooterAnimInstance.h @@ -0,0 +1,41 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "Animation/AnimInstance.h" +#include "ShooterAnimInstance.generated.h" + +class AShooterCharacter; +/** + * + */ +UCLASS() +class SHOOTER_API UShooterAnimInstance : public UAnimInstance +{ + GENERATED_BODY() + +public: + + UFUNCTION(BlueprintCallable) + void UpdateAnimationProperties(float DeltaTime); + + virtual void NativeInitializeAnimation() override; + +private: + + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Movement, meta = (AllowPrivateAccess = true)) + AShooterCharacter* ShooterCharacter; + + /* The speed of the character */ + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Movement, meta = (AllowPrivateAccess = true)) + float Speed; + + /* Whether or not the character is in the air */ + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Movement, meta = (AllowPrivateAccess = true)) + bool bIsInAir; + + /* Whether or not the character is moving */ + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Movement, meta = (AllowPrivateAccess = true)) + bool bIsAccelerating; +}; diff --git a/Source/Shooter/ShooterCharacter.cpp b/Source/Shooter/ShooterCharacter.cpp index df6433ab..84fea5a2 100644 --- a/Source/Shooter/ShooterCharacter.cpp +++ b/Source/Shooter/ShooterCharacter.cpp @@ -4,7 +4,11 @@ #include "ShooterCharacter.h" #include "Camera/CameraComponent.h" +#include "Engine/SkeletalMeshSocket.h" #include "GameFramework/SpringArmComponent.h" +#include "GameFramework/CharacterMovementComponent.h" +#include "Kismet/GameplayStatics.h" +#include "Sound/SoundCue.h" // Sets default values AShooterCharacter::AShooterCharacter() : @@ -30,6 +34,16 @@ AShooterCharacter::AShooterCharacter() : // Camera does not rotate relative to arm FollowCamera->bUsePawnControlRotation = false; + + // Don't rotate when the controller does. Let the controller only affect the camera. + bUseControllerRotationPitch = false; + bUseControllerRotationYaw = false; + bUseControllerRotationRoll = false; + + GetCharacterMovement()->bOrientRotationToMovement = true; // Character moves in the direction of input.... + GetCharacterMovement()->RotationRate = FRotator(0.f, 540.f, 0.f); // ... at this rotation rate + GetCharacterMovement()->JumpZVelocity = 600.f; + GetCharacterMovement()->AirControl = 0.2f; } // Called when the game starts or when spawned @@ -76,6 +90,33 @@ void AShooterCharacter::LookUpAtRate(float Rate) AddControllerPitchInput(Rate * BaseLookUpRate * GetWorld()->GetDeltaSeconds()); // def/sec * sec/frame } +void AShooterCharacter::FireWeapon() +{ + if (FireSound) + { + UGameplayStatics::PlaySound2D(this, FireSound); + } + + const USkeletalMeshSocket* BarrelSocket = GetMesh()->GetSocketByName("BarrelSocket"); + if (BarrelSocket) + { + const FTransform SocketTransform = BarrelSocket->GetSocketTransform(GetMesh()); + + if (MuzzleFlash) + { + UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), MuzzleFlash, SocketTransform); + } + } + + UAnimInstance* AnimInstance = GetMesh()->GetAnimInstance(); + + if (AnimInstance && HipFireMontage) + { + AnimInstance->Montage_Play(HipFireMontage); + AnimInstance->Montage_JumpToSection(FName("StartFire")); + } +} + // Called every frame void AShooterCharacter::Tick(float DeltaTime) { @@ -98,5 +139,7 @@ void AShooterCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputCo PlayerInputComponent->BindAction("Jump", IE_Pressed, this, &ACharacter::Jump); PlayerInputComponent->BindAction("Jump", IE_Released, this, &ACharacter::StopJumping); + + PlayerInputComponent->BindAction("FireButton", IE_Pressed, this, &AShooterCharacter::FireWeapon); } diff --git a/Source/Shooter/ShooterCharacter.h b/Source/Shooter/ShooterCharacter.h index e3dacdbc..40340d99 100644 --- a/Source/Shooter/ShooterCharacter.h +++ b/Source/Shooter/ShooterCharacter.h @@ -8,6 +8,9 @@ class USpringArmComponent; class UCameraComponent; +class USoundCue; +class UParticleSystem; +class UAnimMontage; UCLASS() class SHOOTER_API AShooterCharacter : public ACharacter @@ -40,6 +43,10 @@ protected: */ void LookUpAtRate(float Rate); + /** + * Called when the Fire button is pressed + */ + void FireWeapon(); public: // Called every frame @@ -63,6 +70,18 @@ private: UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = true)) float BaseLookUpRate; + /* Randomized gunshot sound cue*/ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Combat, meta = (AllowPrivateAccess = true)) + USoundCue* FireSound; + + /* Flash spawned at BarrelSocket */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Combat, meta = (AllowPrivateAccess = true)) + UParticleSystem* MuzzleFlash; + + /* Montage for firing the weapon */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Combat, meta = (AllowPrivateAccess = true)) + UAnimMontage* HipFireMontage; + public: /* Returns CameraBoom SubObject */ FORCEINLINE USpringArmComponent* GetCameraBoom() const { return CameraBoom; }