Ok so... after Pharan gave me some light over the issue. We managed to solve it and use multiple weapons for multiple views with a really generic logic.
So far, it seems working fine. I'll post the CODE here to share with you guys.
You must set the weapon/item from outside, and can even temporarely desable it.
public class SpineUnity_WeaponSlotManager : MonoBehaviour
{
Skeleton skeleton;
bool initiateThis;
[Header("Itens To Null at Start")]
public string[] nullAtStart;
[Space]
[Header("View References")]
public string view00Ref;
public string view01Ref;
public string view02Ref;
Slot slotView00;
Slot slotView01;
Slot slotView02;
[Space]
[Header("Active Weapon")]
public int weapon;
[Space]
[Header("Momentarely Null Item")]
public float desarmer;
bool nullOnce;
private void Update()
{
initiate();
standardSlotConfig();
desarmerReturn();
}
void standardSlotConfig()
{
//USE DESARMER TO TEMPORARILY DISARM WEAPON
if (weapon > 0 && desarmer <= 0f)
{//IN CASE WEAPON IS GREATER THAN 0
turningChar();
if (!nullOnce)
{
nullOnce = true;
}
}
else if (weapon <= 0 || desarmer > 0f)
{//IN CASE WEAPON IS LOWER
if (nullOnce)
{
NullAllItems();
nullOnce = false;
}
}
}
//VIEW TURNING METHODS
void turningChar()
{
turnGeneric(slotView00, nullAtStart[0] + weapon);
turnGeneric(slotView01, nullAtStart[1] + weapon);
turnGeneric(slotView02, nullAtStart[2] + weapon);
}
void turnGeneric(Slot slotView, string item)
{
if (slotView != null)
{
if (slotView.Attachment != null)
{
skeleton.SetAttachment(item, item);
}
else
{
skeleton.SetAttachment(item, null);
}
}
}
//SLOT METHODS
void SlotsViewSetup()
{
SetSlotToView(ref slotView00, view00Ref);
SetSlotToView(ref slotView01, view01Ref);
SetSlotToView(ref slotView02, view02Ref);
}
void SetSlotToView(ref Slot slot, string view)
{//GENERIC SETUP METHOD FOR VIEWS x SLOTS
if (view != null)
{
slot = skeleton.FindSlot(view);
}
}
//METHODS TO STANDARD INITIATE CHARACTER
void initiate()
{
if (!initiateThis)
{
skeleton = GetComponent<SkeletonAnimator>().Skeleton;
NullAllItems();
SlotsViewSetup();
initiateThis = true;
}
}
void desarmerReturn()
{
if (desarmer > 0f)
{
desarmer -= Time.deltaTime;
}
}
void NullAllItems()
{
for (int i = 0; i < nullAtStart.Length; i++)
{//GOES BY NAME IN ARRAY
for (int f = 0; f < skeleton.Slots.Count; f++)
{//LOCATES THE PRESENCE OF ITEM
Slot slot = skeleton.FindSlot(nullAtStart[i] + f);
if (slot != null)
{
skeleton.SetAttachment(nullAtStart[i] + f, null);
}
}
}
}
}
This will work well with the standard we are following for characters here at the Studio.
All of this is still in a WIP stage.
http://www.donutcoffeeshopstudios.com/characterGuidelines.pdf