Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Fill out your copyright notice in the Description page of Project Settings.
- #include "GAMEPROJECT.h"
- #include "EquipmentComponent.h"
- //TODO:
- #pragma message("EquipmentComponent: Needs more solid check for compatible appearance component")
- // Sets default values for this component's properties
- UEquipmentComponent::UEquipmentComponent()
- {
- // Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
- // off to improve performance if you don't need them.
- bWantsBeginPlay = false;
- bWantsInitializeComponent = true;
- PrimaryComponentTick.bCanEverTick = true;
- bReplicates = true;
- bAutoActivate = true;
- // ...
- //Get empty textures
- static ConstructorHelpers::FObjectFinder<UTexture2D> TorsoUpperObj(TEXT("Texture2D'/Game/Textures/Characters/Clothing/Defaults/Clothing_TU_None.Clothing_TU_None'"));
- TorsoUpperEmpty = TorsoUpperObj.Object;
- static ConstructorHelpers::FObjectFinder<UTexture2D> TorsoLowerObj(TEXT("Texture2D'/Game/Textures/Characters/Clothing/Defaults/Clothing_TL_None.Clothing_TL_None'"));
- TorsoLowerEmpty = TorsoUpperObj.Object;
- static ConstructorHelpers::FObjectFinder<UTexture2D> ArmUpperObj(TEXT("Texture2D'/Game/Textures/Characters/Clothing/Defaults/Clothing_AU_None.Clothing_AU_None'"));
- ArmUpperEmpty = TorsoUpperObj.Object;
- static ConstructorHelpers::FObjectFinder<UTexture2D> ArmLowerrObj(TEXT("Texture2D'/Game/Textures/Characters/Clothing/Defaults/Clothing_AL_None.Clothing_AL_None'"));
- ArmLowerEmpty = TorsoUpperObj.Object;
- static ConstructorHelpers::FObjectFinder<UTexture2D> LegUpperObj(TEXT("Texture2D'/Game/Textures/Characters/Clothing/Defaults/Clothing_LU_None.Clothing_LU_None'"));
- LegUpperEmpty = TorsoUpperObj.Object;
- static ConstructorHelpers::FObjectFinder<UTexture2D> LegLowerObj(TEXT("Texture2D'/Game/Textures/Characters/Clothing/Defaults/Clothing_LL_None.Clothing_LL_None'"));
- LegLowerEmpty = TorsoUpperObj.Object;
- static ConstructorHelpers::FObjectFinder<UTexture2D> HandEmptyObj(TEXT("Texture2D'/Game/Textures/Characters/Clothing/Defaults/Clothing_HA_None.Clothing_HA_None'"));
- HandEmpty = TorsoUpperObj.Object;
- static ConstructorHelpers::FObjectFinder<UTexture2D> FootEmptyObj(TEXT("Texture2D'/Game/Textures/Characters/Clothing/Defaults/Clothing_FO_None.Clothing_FO_None'"));
- FootEmpty = TorsoUpperObj.Object;
- }
- void UEquipmentComponent::InitializeComponent()
- {
- Super::InitializeComponent();
- // ...
- OwningCharacter = Cast<AGameCharacter>(GetOwner());
- ParentCustomizationComponent = Cast<UCharacterCustomizationComponent>(OwningCharacter->GetComponentByClass(UCharacterCustomizationComponent::StaticClass()));
- if (OwningCharacter && ParentCustomizationComponent)
- {
- if (EquippedHeadwear != Headwear.GetDefaultObject())
- {
- //clear the slot for the new item
- Unequip(EGameEquipmentSlot::EQT_Head);
- Equip(Headwear.GetDefaultObject());
- }
- if (EquippedNecklace != Necklace.GetDefaultObject())
- {
- //clear the slot for the new item
- Unequip(EGameEquipmentSlot::EQT_Necklace);
- Equip(Necklace.GetDefaultObject());
- }
- if (EquippedShoulders != Shoulders.GetDefaultObject())
- {
- //clear the slot for the new item
- Unequip(EGameEquipmentSlot::EQT_Shoulders);
- Equip(Shoulders.GetDefaultObject());
- }
- if (EquippedShirt != Shirt.GetDefaultObject())
- {
- //clear the slot for the new item
- Unequip(EGameEquipmentSlot::EQT_Shirt);
- Equip(Shirt.GetDefaultObject());
- }
- if (EquippedChestpiece->StaticClass() != Chestpiece)
- {
- //clear the slot for the new item
- Unequip(EGameEquipmentSlot::EQT_Chestpiece);
- Equip(Chestpiece.GetDefaultObject());
- }
- if (EquippedBelt != Belt.GetDefaultObject())
- {
- //clear the slot for the new item
- Unequip(EGameEquipmentSlot::EQT_Belt);
- Equip(Belt.GetDefaultObject());
- }
- if (EquippedBracers != Bracers.GetDefaultObject())
- {
- //clear the slot for the new item
- Unequip(EGameEquipmentSlot::EQT_Bracers);
- Equip(Bracers.GetDefaultObject());
- }
- if (EquippedHands != Hands.GetDefaultObject())
- {
- //clear the slot for the new item
- Unequip(EGameEquipmentSlot::EQT_Hands);
- Equip(Hands.GetDefaultObject());
- }
- //TODO: Implement Rings
- if (EquippedLegs != Legs.GetDefaultObject())
- {
- //clear the slot for the new item
- Unequip(EGameEquipmentSlot::EQT_Legs);
- Equip(Legs.GetDefaultObject());
- }
- if (EquippedFeet != Feet.GetDefaultObject())
- {
- //clear the slot for the new item
- Unequip(EGameEquipmentSlot::EQT_Feet);
- Equip(Feet.GetDefaultObject());
- }
- if (EquippedCape != Cape.GetDefaultObject())
- {
- //clear the slot for the new item
- Unequip(EGameEquipmentSlot::EQT_Cape);
- Equip(Cape.GetDefaultObject());
- }
- if (EquippedTabard != Tabard.GetDefaultObject())
- {
- //clear the slot for the new item
- Unequip(EGameEquipmentSlot::EQT_Tabard);
- Equip(Tabard.GetDefaultObject());
- }
- }
- }
- // Called every frame
- void UEquipmentComponent::TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction )
- {
- Super::TickComponent( DeltaTime, TickType, ThisTickFunction );
- // ...
- }
- bool UEquipmentComponent::Equip(UEquipment* Item)
- {
- if (OwningCharacter&& ParentCustomizationComponent && Item)
- {
- UArmor* Armor = Cast<UArmor>(Item);
- UWeapon* Weapon = Cast<UWeapon>(Item);
- if (Armor)
- {
- EGameEquipmentSlot Slot = Armor->EquipmentSlot;
- //render the larger mesh elements (if any)
- TArray<TEnumAsByte< EGameEquipmentDisplayType > > Types = Armor->DisplayTypes;
- //BREAKING: access violation crash here
- ParentCustomizationComponent->RenderArmorElements(Types, true);
- switch (Slot)
- {
- case EGameEquipmentSlot::EQT_Head:
- {
- //TODO: Implement meshes & socket handling
- return true;
- }
- case EGameEquipmentSlot::EQT_Necklace:
- {
- //TODO: Implement necklace texture
- UNeckArmor* Necklace = Cast<UNeckArmor>(Armor);
- SetUpperTorsoTexture(Necklace->GetUpperTorsoTexture(OwningCharacter->Gender), Slot);
- EquippedNecklace = Necklace;
- return true;
- }
- case EGameEquipmentSlot::EQT_Shoulders:
- {
- //TODO: Implement meshes & socket handling
- return true;
- }
- case EGameEquipmentSlot::EQT_Cape:
- {
- //TODO: Implement capes
- return true;
- }
- case EGameEquipmentSlot::EQT_Shirt:
- {
- UShirtArmor* Shirt = Cast<UShirtArmor>(Armor);
- SetUpperTorsoTexture(Shirt->GetUpperTorsoTexture(OwningCharacter->Gender), Slot);
- SetLowerTorsoTexture(Shirt->GetLowerTorsoTexture(OwningCharacter->Gender), Slot);
- SetUpperArmTexture(Shirt->GetUpperArmTexture(OwningCharacter->Gender), Slot);
- SetLowerArmTexture(Shirt->GetLowerArmTexture(OwningCharacter->Gender), Slot);
- EquippedShirt = Shirt;
- return true;
- }
- case EGameEquipmentSlot::EQT_Chestpiece:
- {
- UChestArmor* Chest = Cast<UChestArmor>(Armor);
- SetUpperTorsoTexture(Chest->GetUpperTorsoTexture(OwningCharacter->Gender), Slot);
- SetLowerTorsoTexture(Chest->GetLowerTorsoTexture(OwningCharacter->Gender), Slot);
- SetUpperArmTexture(Chest->GetUpperArmTexture(OwningCharacter->Gender), Slot);
- SetLowerArmTexture(Chest->GetLowerArmTexture(OwningCharacter->Gender), Slot);
- SetUpperLegTexture(Chest->GetUpperLegTexture(OwningCharacter->Gender), Slot);
- SetLowerLegTexture(Chest->GetLowerLegTexture(OwningCharacter->Gender), Slot);
- EquippedChestpiece = Chest;
- return true;
- }
- case EGameEquipmentSlot::EQT_Belt:
- {
- UBeltArmor* Belt = Cast<UBeltArmor>(Armor);
- SetUpperLegTexture(Belt->GetUpperLegTexture(OwningCharacter->Gender), Slot);
- EquippedBelt = Belt;
- return true;
- }
- case EGameEquipmentSlot::EQT_Bracers:
- {
- UBracerArmor* Bracer = Cast<UBracerArmor>(Armor);
- SetLowerArmTexture(Bracer->GetLowerArmTexture(OwningCharacter->Gender), Slot);
- EquippedBracers = Bracer;
- return true;
- }
- case EGameEquipmentSlot::EQT_Hands:
- {
- UHandsArmor* Hands = Cast<UHandsArmor>(Armor);
- SetLowerArmTexture(Hands->GetLowerArmTexture(OwningCharacter->Gender), Slot);
- SetHandTexture(Hands->GetHandTexture(OwningCharacter->Gender), Slot);
- EquippedHands = Hands;
- return true;
- }
- case EGameEquipmentSlot::EQT_Ring:
- {
- URingArmor* Ring = Cast<URingArmor>(Armor);
- //TODO: Implement meshes & socket handling
- return true;
- }
- case EGameEquipmentSlot::EQT_Legs:
- {
- ULegsArmor* Legs = Cast<ULegsArmor>(Armor);
- SetUpperLegTexture(Legs->GetUpperLegTexture(OwningCharacter->Gender), Slot);
- SetLowerLegTexture(Legs->GetLowerLegTexture(OwningCharacter->Gender), Slot);
- EquippedLegs = Legs;
- return true;
- }
- case EGameEquipmentSlot::EQT_Feet:
- {
- UFeetArmor* Feet = Cast<UFeetArmor>(Armor);
- SetLowerLegTexture(Feet->GetLowerLegTexture(OwningCharacter->Gender), Slot);
- SetFootTexture(Feet->GetFootTexture(OwningCharacter->Gender), Slot);
- EquippedFeet = Feet;
- return true;
- }
- case EGameEquipmentSlot::EQT_Tabard:
- {
- UTabardArmor* Tabard = Cast<UTabardArmor>(Armor);
- SetUpperTorsoTexture(Tabard->GetUpperTorsoTexture(OwningCharacter->Gender), Slot);
- SetLowerTorsoTexture(Tabard->GetLowerTorsoTexture(OwningCharacter->Gender), Slot);
- EquippedTabard = Tabard;
- return true;
- }
- default:
- {
- return false;
- }
- }
- }
- else if (Weapon)
- {
- //TODO: Implement weapon handling
- EGameEquipmentSlot Slot = Weapon->EquipmentSlot;
- //clear the slot for the new item
- Unequip(Slot);
- switch (Slot)
- {
- case EGameEquipmentSlot::EQT_RightHand:
- {
- return true;
- }
- case EGameEquipmentSlot::EQT_LeftHand:
- {
- return true;
- }
- case EGameEquipmentSlot::EQT_TwoHand:
- {
- return true;
- }
- case EGameEquipmentSlot::EQT_OffHand:
- {
- return true;
- }
- case EGameEquipmentSlot::EQT_Special:
- {
- return true;
- }
- default:
- {
- return false;
- }
- }
- }
- else
- {
- return false;
- }
- }
- else
- {
- return false;
- }
- }
- bool UEquipmentComponent::Unequip(EGameEquipmentSlot Slot)
- {
- if (ParentCustomizationComponent)
- {
- switch (Slot)
- {
- case EGameEquipmentSlot::EQT_Head:
- {
- //TODO: Implement headwear mesh & sockets
- return false;
- }
- case EGameEquipmentSlot::EQT_Necklace:
- {
- //TODO: Implement necklace textures
- if (EquippedNecklace)
- {
- SetUpperTorsoTexture(TorsoUpperEmpty, Slot);
- return true;
- }
- }
- case EGameEquipmentSlot::EQT_Shoulders:
- {
- //TODO: Implement shoulder meshes & sockets
- return false;
- }
- case EGameEquipmentSlot::EQT_Cape:
- {
- //TODO: Implement capes
- return false;
- }
- case EGameEquipmentSlot::EQT_Shirt:
- {
- if (EquippedShirt)
- {
- //render the larger mesh elements (if any)
- ParentCustomizationComponent->RenderArmorElements(EquippedShirt->DisplayTypes, false);
- SetUpperTorsoTexture(TorsoUpperEmpty, Slot);
- SetLowerTorsoTexture(TorsoLowerEmpty, Slot);
- SetUpperArmTexture(ArmUpperEmpty, Slot);
- SetLowerArmTexture(ArmLowerEmpty, Slot);
- }
- return true;
- }
- case EGameEquipmentSlot::EQT_Chestpiece:
- {
- if (EquippedChestpiece)
- {
- //render the larger mesh elements (if any)
- ParentCustomizationComponent->RenderArmorElements(EquippedChestpiece->DisplayTypes, false);
- SetUpperTorsoTexture(TorsoUpperEmpty, Slot);
- SetLowerTorsoTexture(TorsoLowerEmpty, Slot);
- SetUpperArmTexture(ArmUpperEmpty, Slot);
- SetLowerArmTexture(ArmLowerEmpty, Slot);
- SetUpperLegTexture(LegUpperEmpty, Slot);
- SetLowerLegTexture(LegLowerEmpty, Slot);
- }
- return true;
- }
- case EGameEquipmentSlot::EQT_Belt:
- {
- if (EquippedBelt)
- {
- ParentCustomizationComponent->RenderArmorElements(EquippedBelt->DisplayTypes, false);
- SetUpperLegTexture(LegUpperEmpty, Slot);
- }
- return true;
- }
- case EGameEquipmentSlot::EQT_Bracers:
- {
- if (EquippedBracers)
- {
- ParentCustomizationComponent->RenderArmorElements(EquippedBracers->DisplayTypes, false);
- SetLowerArmTexture(ArmLowerEmpty, Slot);
- }
- return true;
- }
- case EGameEquipmentSlot::EQT_Hands:
- {
- if (EquippedHands)
- {
- ParentCustomizationComponent->RenderArmorElements(EquippedHands->DisplayTypes, false);
- SetLowerArmTexture(ArmLowerEmpty, Slot);
- SetHandTexture(HandEmpty, Slot);
- }
- return true;
- }
- case EGameEquipmentSlot::EQT_Ring:
- {
- //TODO: Implement ring meshes & sockets
- return false;
- }
- case EGameEquipmentSlot::EQT_Legs:
- {
- if (EquippedLegs)
- {
- ParentCustomizationComponent->RenderArmorElements(EquippedLegs->DisplayTypes, false);
- SetUpperLegTexture(LegUpperEmpty, Slot);
- SetLowerLegTexture(LegLowerEmpty, Slot);
- }
- return true;
- }
- case EGameEquipmentSlot::EQT_Feet:
- {
- if (EquippedFeet)
- {
- ParentCustomizationComponent->RenderArmorElements(EquippedFeet->DisplayTypes, false);
- SetLowerLegTexture(LegLowerEmpty, Slot);
- SetFootTexture(FootEmpty, Slot);
- }
- return true;
- }
- case EGameEquipmentSlot::EQT_Tabard:
- {
- if (EquippedTabard)
- {
- ParentCustomizationComponent->RenderArmorElements(EquippedTabard->DisplayTypes, false);
- SetUpperTorsoTexture(TorsoUpperEmpty, Slot);
- SetLowerTorsoTexture(TorsoLowerEmpty, Slot);
- }
- return true;
- }
- case EGameEquipmentSlot::EQT_RightHand:
- {
- //TODO: Implement weapon handling
- return false;
- }
- case EGameEquipmentSlot::EQT_LeftHand:
- {
- //TODO: Implement weapon handling
- return false;
- }
- case EGameEquipmentSlot::EQT_TwoHand:
- {
- //TODO: Implement weapon handling
- return false;
- }
- case EGameEquipmentSlot::EQT_OffHand:
- {
- //TODO: Implement weapon handling
- return false;
- }
- case EGameEquipmentSlot::EQT_Special:
- {
- //TODO: Implement weapon handling
- return false;
- }
- default:
- {
- return false;
- }
- }
- }
- return false;
- }
- void UEquipmentComponent::SetUpperTorsoTexture(UTexture2D* Texture, EGameEquipmentSlot Slot)
- {
- switch (Slot)
- {
- case EGameEquipmentSlot::EQT_Necklace:
- {
- if (Texture)
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Neck_TU", Texture);
- }
- else
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Neck_TU", TorsoUpperEmpty);
- }
- break;
- }
- case EGameEquipmentSlot::EQT_Shirt:
- {
- if (Texture)
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Shirt_TU", Texture);
- }
- else
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Shirt_TU", TorsoUpperEmpty);
- }
- break;
- }
- case EGameEquipmentSlot::EQT_Chestpiece:
- {
- if (Texture)
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Chest_TU", Texture);
- }
- else
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Chest_TU", TorsoUpperEmpty);
- }
- break;
- }
- case EGameEquipmentSlot::EQT_Tabard:
- {
- if (Texture)
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Tabard_TU", Texture);
- }
- else
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Tabard_TU", TorsoUpperEmpty);
- }
- break;
- }
- default:
- {
- break;
- }
- }
- }
- void UEquipmentComponent::SetLowerTorsoTexture(UTexture2D* Texture, EGameEquipmentSlot Slot)
- {
- switch (Slot)
- {
- case EGameEquipmentSlot::EQT_Shirt:
- {
- if (Texture)
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Shirt_TL", Texture);
- }
- else
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Shirt_TL", TorsoLowerEmpty);
- }
- break;
- }
- case EGameEquipmentSlot::EQT_Chestpiece:
- {
- if (Texture)
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Chest_TL", Texture);
- }
- else
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Chest_TL", TorsoLowerEmpty);
- }
- break;
- }
- case EGameEquipmentSlot::EQT_Tabard:
- {
- if (Texture)
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Tabard_TL", Texture);
- }
- else
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Tabard_TL", TorsoLowerEmpty);
- }
- break;
- }
- default:
- {
- break;
- }
- }
- }
- void UEquipmentComponent::SetUpperArmTexture(UTexture2D* Texture, EGameEquipmentSlot Slot)
- {
- switch (Slot)
- {
- case EGameEquipmentSlot::EQT_Shirt:
- {
- if (Texture)
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Shirt_AU", Texture);
- }
- else
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Shirt_AU", ArmUpperEmpty);
- }
- break;
- }
- case EGameEquipmentSlot::EQT_Chestpiece:
- {
- if (Texture)
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Chest_AU", Texture);
- }
- else
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Chest_AU", ArmUpperEmpty);
- }
- break;
- }
- default:
- {
- break;
- }
- }
- }
- void UEquipmentComponent::SetLowerArmTexture(UTexture2D* Texture, EGameEquipmentSlot Slot)
- {
- switch (Slot)
- {
- case EGameEquipmentSlot::EQT_Shirt:
- {
- if (Texture)
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Shirt_AL", Texture);
- }
- else
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Shirt_AL", ArmLowerEmpty);
- }
- break;
- }
- case EGameEquipmentSlot::EQT_Chestpiece:
- {
- if (Texture)
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Chest_AL", Texture);
- }
- else
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Chest_AL", ArmLowerEmpty);
- }
- break;
- }
- case EGameEquipmentSlot::EQT_Hands:
- {
- if (Texture)
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Hands_AL", Texture);
- }
- else
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Hands_AL", ArmLowerEmpty);
- }
- break;
- }
- default:
- {
- break;
- }
- }
- }
- void UEquipmentComponent::SetUpperLegTexture(UTexture2D* Texture, EGameEquipmentSlot Slot)
- {
- switch (Slot)
- {
- case EGameEquipmentSlot::EQT_Chestpiece:
- {
- if (Texture)
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Chest_LU", Texture);
- }
- else
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Chest_LU", LegUpperEmpty);
- }
- break;
- }
- case EGameEquipmentSlot::EQT_Legs:
- {
- if (Texture)
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Legs_LU", Texture);
- }
- else
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Legs_LU", LegUpperEmpty);
- }
- break;
- }
- case EGameEquipmentSlot::EQT_Belt:
- {
- if (Texture)
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Belt_LU", Texture);
- }
- else
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Belt_LU", LegUpperEmpty);
- }
- break;
- }
- default:
- {
- break;
- }
- }
- }
- void UEquipmentComponent::SetLowerLegTexture(UTexture2D* Texture, EGameEquipmentSlot Slot)
- {
- switch (Slot)
- {
- case EGameEquipmentSlot::EQT_Chestpiece:
- {
- if (Texture)
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Chest_LL", Texture);
- }
- else
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Chest_LL", LegLowerEmpty);
- }
- break;
- }
- case EGameEquipmentSlot::EQT_Legs:
- {
- if (Texture)
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Legs_LL", Texture);
- }
- else
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Legs_LL", LegLowerEmpty);
- }
- break;
- }
- case EGameEquipmentSlot::EQT_Feet:
- {
- if (Texture)
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Feet_LL", Texture);
- }
- else
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Feet_LL", LegLowerEmpty);
- }
- break;
- }
- default:
- {
- break;
- }
- }
- }
- void UEquipmentComponent::SetHandTexture(UTexture2D* Texture, EGameEquipmentSlot Slot)
- {
- switch (Slot)
- {
- case EGameEquipmentSlot::EQT_Hands:
- {
- if (Texture)
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Hands_HA", Texture);
- }
- else
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Hands_HA", HandEmpty);
- }
- break;
- }
- case EGameEquipmentSlot::EQT_Ring:
- {
- if (Texture)
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Ring_HA", Texture);
- }
- else
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Ring_HA", HandEmpty);
- }
- break;
- }
- default:
- {
- break;
- }
- }
- }
- void UEquipmentComponent::SetFootTexture(UTexture2D* Texture, EGameEquipmentSlot Slot)
- {
- //special case: Cowmen never use the foot texture.
- //Add spacemen here as well when we get there
- if (OwningCharacter && !(OwningCharacter->CreatureRace == ECreatureRace::CR_Cowman))
- {
- switch (Slot)
- {
- case EGameEquipmentSlot::EQT_Feet:
- {
- if (Texture)
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Feet_FO", Texture);
- }
- else
- {
- ParentCustomizationComponent->GetSkinInstance()->SetTextureParameterValue("Feet_FO", FootEmpty);
- }
- break;
- }
- default:
- {
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement