diff --git a/Content/Blueprints/Weapon/BP_Weapon.uasset b/Content/Blueprints/Weapon/BP_Weapon.uasset new file mode 100644 index 0000000..b060b53 Binary files /dev/null and b/Content/Blueprints/Weapon/BP_Weapon.uasset differ diff --git a/Content/Maps/BlasterMap.umap b/Content/Maps/BlasterMap.umap index 806a1a8..1e37ac2 100644 Binary files a/Content/Maps/BlasterMap.umap and b/Content/Maps/BlasterMap.umap differ diff --git a/Source/Blaster/Weapon/Weapon.cpp b/Source/Blaster/Weapon/Weapon.cpp new file mode 100644 index 0000000..35895fe --- /dev/null +++ b/Source/Blaster/Weapon/Weapon.cpp @@ -0,0 +1,39 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "Weapon.h" + +#include "Components/SphereComponent.h" + +AWeapon::AWeapon() +{ + PrimaryActorTick.bCanEverTick = false; + bReplicates = true; + + WeaponMesh = CreateDefaultSubobject(TEXT("WeaponMesh")); + WeaponMesh->SetupAttachment(RootComponent); + + SetRootComponent(WeaponMesh) ; + + WeaponMesh->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Block); + WeaponMesh->SetCollisionResponseToChannel(ECollisionChannel::ECC_Pawn, ECollisionResponse::ECR_Ignore); + WeaponMesh->SetCollisionEnabled(ECollisionEnabled::NoCollision); + + AreaSphere = CreateDefaultSubobject(TEXT("AreaSphere")); + AreaSphere->SetupAttachment(RootComponent); + AreaSphere->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Ignore); + AreaSphere->SetCollisionEnabled(ECollisionEnabled::NoCollision); +} + +void AWeapon::BeginPlay() +{ + Super::BeginPlay(); + + if (HasAuthority()) + { + AreaSphere->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics); + AreaSphere->SetCollisionResponseToChannel(ECollisionChannel::ECC_Pawn, ECollisionResponse::ECR_Overlap); + } +} + + diff --git a/Source/Blaster/Weapon/Weapon.h b/Source/Blaster/Weapon/Weapon.h new file mode 100644 index 0000000..eb75805 --- /dev/null +++ b/Source/Blaster/Weapon/Weapon.h @@ -0,0 +1,43 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "GameFramework/Actor.h" +#include "Weapon.generated.h" + +UENUM(BlueprintType) +enum class EWeaponState : uint8 +{ + EWS_Initial UMETA(DisplayName = "Initial State"), + EWS_Equipped UMETA(DisplayName = "Equipped"), + EWS_Dropped UMETA(DisplayName = "Dropped"), + EWS_MAX UMETA(DisplayName = "DefaultMAX") +}; + +UCLASS() +class BLASTER_API AWeapon : public AActor +{ + GENERATED_BODY() + +public: + AWeapon(); + +protected: + virtual void BeginPlay() override; + +private: + + UPROPERTY(VisibleAnywhere, Category="Weapon Properties") + USkeletalMeshComponent* WeaponMesh; + + UPROPERTY(VisibleAnywhere, Category="Weapon Properties") + class USphereComponent* AreaSphere; + + UPROPERTY(VisibleAnywhere) + EWeaponState WeaponState; + +public: + + +};