Skip to content

Commit

Permalink
#77 Added rifle animation FABRIK
Browse files Browse the repository at this point in the history
  • Loading branch information
xthebat committed Dec 18, 2023
1 parent e55a221 commit 2bd9414
Show file tree
Hide file tree
Showing 21 changed files with 51 additions and 7 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Content/Blueprints/Weapons/WeaponTableDefinitions.uasset
Binary file not shown.
Binary file modified Importing/tm_jungle_raider_variantb2.fbx
Binary file not shown.
Binary file modified Importing/tm_jungle_raider_variantb2_fire.blend
Binary file not shown.
2 changes: 2 additions & 0 deletions Source/Cloud9/Character/Components/Cloud9Inventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ bool UCloud9Inventory::ReplaceWeaponAt(EWeaponSlot Slot, ACloud9WeaponBase* Weap

ACloud9WeaponBase* UCloud9Inventory::GetSelectedWeapon() const { return GetWeaponAt(SelectedWeaponSlot); }

ACloud9WeaponBase* UCloud9Inventory::GetPendingWeapon() const { return GetWeaponAt(PendingWeaponSlot); }

bool UCloud9Inventory::IsWeaponChanging() const { return SelectedWeaponSlot != PendingWeaponSlot; }

EWeaponType UCloud9Inventory::GetSelectedWeaponType() const
Expand Down
12 changes: 9 additions & 3 deletions Source/Cloud9/Character/Components/Cloud9Inventory.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class CLOUD9_API UCloud9Inventory

UFUNCTION(BlueprintCallable)
EWeaponSlot GetPendingWeaponSlot() const;

UFUNCTION(BlueprintCallable)
ACloud9WeaponBase* GetWeaponAt(EWeaponSlot Slot) const;

Expand All @@ -77,6 +77,9 @@ class CLOUD9_API UCloud9Inventory
UFUNCTION(BlueprintCallable)
ACloud9WeaponBase* GetSelectedWeapon() const;

UFUNCTION(BlueprintCallable)
ACloud9WeaponBase* GetPendingWeapon() const;

UFUNCTION(BlueprintCallable)
bool IsWeaponChanging() const;

Expand Down Expand Up @@ -104,12 +107,15 @@ class CLOUD9_API UCloud9Inventory
UPROPERTY()
TArray<ACloud9WeaponBase*> WeaponSlots;

UPROPERTY(Category=Weapon, BlueprintReadOnly, meta=(AllowPrivateAccess))
EWeaponSlot SelectedWeaponSlot;

UPROPERTY(Category=Weapon, BlueprintReadOnly, meta=(AllowPrivateAccess))
EWeaponSlot PendingWeaponSlot;

UPROPERTY(EditDefaultsOnly, Category = Weapons, meta=(AllowPrivateAccess))
UPROPERTY(Category=Weapon, EditDefaultsOnly, meta=(AllowPrivateAccess))
EMelee DefaultKnifeName;

UPROPERTY(EditDefaultsOnly, Category = Weapons, meta=(AllowPrivateAccess))
UPROPERTY(Category=Weapon, EditDefaultsOnly, meta=(AllowPrivateAccess))
EFirearm DefaultPistolName;
};
2 changes: 1 addition & 1 deletion Source/Cloud9/Cloud9.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class TOperator
template <typename SelfType>
constexpr friend auto operator|(SelfType& Self, FunctionType&& Function)
{
return Function(Forward<SelfType>(Self));
return Function(Forward<SelfType>(Self)); // TODO: May be use Function(MoveTempIfPossible(Self)) ???
}

template <typename SelfType>
Expand Down
18 changes: 15 additions & 3 deletions Source/Cloud9/Weapon/Classes/Cloud9WeaponBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ bool ACloud9WeaponBase::ChangeActionFlag(bool Flag, bool bIsReleased)

FName ACloud9WeaponBase::GetWeaponName() const
{
log(Fatal, "[Weapon='%s'] Weapon name wasn't override", *GetName())
log(Fatal, "[Weapon='%s'] Not implmemented", *GetName())
return NAME_None;
}

Expand All @@ -478,16 +478,28 @@ EWeaponType ACloud9WeaponBase::GetWeaponType() const
return WeaponDefinition->GetWeaponInfo()->Type;
}

const UStaticMeshSocket* ACloud9WeaponBase::GetSocketByName(FName SocketName) const
{
log(Fatal, "[Weapon='%s'] Not implmemented", *GetName())
return nullptr;
}

const UStaticMeshComponent* ACloud9WeaponBase::GetWeaponMesh() const
{
log(Fatal, "[Weapon='%s'] Not implmemented", *GetName())
return nullptr;
}

EWeaponClass ACloud9WeaponBase::GetWeaponClass() const
{
log(Fatal, "[Weapon='%s'] Weapon class wasn't override", *GetName())
log(Fatal, "[Weapon='%s'] Not implmemented", *GetName())
return EWeaponClass::NoClass;
}

bool ACloud9WeaponBase::CanBeDropped() const { return true; }

const UEnum* ACloud9WeaponBase::GetWeaponActions() const
{
log(Fatal, "[Weapon='%s'] Weapon actions wasn't override", *GetName());
log(Fatal, "[Weapon='%s'] Not implmemented", *GetName());
return nullptr;
}
6 changes: 6 additions & 0 deletions Source/Cloud9/Weapon/Classes/Cloud9WeaponBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ class CLOUD9_API ACloud9WeaponBase : public AActor
UFUNCTION(BlueprintCallable)
EWeaponType GetWeaponType() const;

UFUNCTION(BlueprintCallable)
virtual const UStaticMeshSocket* GetSocketByName(FName SocketName) const;

UFUNCTION(BlueprintCallable)
virtual const UStaticMeshComponent* GetWeaponMesh() const;

bool IsWeaponInitialized() const { return WeaponDefinition.IsSet(); }

bool AddToInventory(ACloud9Character* Character, EWeaponSlot NewSlot);
Expand Down
7 changes: 7 additions & 0 deletions Source/Cloud9/Weapon/Classes/Cloud9WeaponFirearm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ EWeaponClass ACloud9WeaponFirearm::GetWeaponClass() const { return EWeaponClass:

const UEnum* ACloud9WeaponFirearm::GetWeaponActions() const { return StaticEnum<EFirearmAction>(); }

const UStaticMeshSocket* ACloud9WeaponFirearm::GetSocketByName(FName SocketName) const
{
return WeaponMesh->GetSocketByName(SocketName);
}

const UStaticMeshComponent* ACloud9WeaponFirearm::GetWeaponMesh() const { return WeaponMesh; }

void ACloud9WeaponFirearm::OnConstruction(const FTransform& Transform)
{
using namespace ETOptional;
Expand Down
2 changes: 2 additions & 0 deletions Source/Cloud9/Weapon/Classes/Cloud9WeaponFirearm.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ class CLOUD9_API ACloud9WeaponFirearm : public ACloud9WeaponBase
virtual FName GetWeaponName() const override;
virtual EWeaponClass GetWeaponClass() const override;
virtual const UEnum* GetWeaponActions() const override;
virtual const UStaticMeshSocket* GetSocketByName(FName SocketName) const override;
virtual const UStaticMeshComponent* GetWeaponMesh() const override;

protected:
virtual void OnConstruction(const FTransform& Transform) override;
Expand Down
7 changes: 7 additions & 0 deletions Source/Cloud9/Weapon/Classes/Cloud9WeaponMelee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ const UEnum* ACloud9WeaponMelee::GetWeaponActions() const { return StaticEnum<EM

bool ACloud9WeaponMelee::CanBeDropped() const { return false; }

const UStaticMeshSocket* ACloud9WeaponMelee::GetSocketByName(FName SocketName) const
{
return WeaponMesh->GetSocketByName(SocketName);
}

const UStaticMeshComponent* ACloud9WeaponMelee::GetWeaponMesh() const { return WeaponMesh; }

void ACloud9WeaponMelee::OnConstruction(const FTransform& Transform)
{
using namespace ETOptional;
Expand Down
2 changes: 2 additions & 0 deletions Source/Cloud9/Weapon/Classes/Cloud9WeaponMelee.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class CLOUD9_API ACloud9WeaponMelee : public ACloud9WeaponBase
virtual EWeaponClass GetWeaponClass() const override;
virtual const UEnum* GetWeaponActions() const override;
virtual bool CanBeDropped() const override;
virtual const UStaticMeshSocket* GetSocketByName(FName SocketName) const override;
virtual const UStaticMeshComponent* GetWeaponMesh() const override;

protected:
virtual void OnConstruction(const FTransform& Transform) override;
Expand Down

0 comments on commit 2bd9414

Please sign in to comment.