Hi guys, i was just trying to wrap my head around enums and was trying to use them for an equipment system and inventory system but seem to be getting this error no matter how i approach it.
Assets/Slot.cs(48,95): error CS0019: Operator ==' cannot be applied to operands of type
DragHandler.Slot’ and `Slot.mySlot’
on script Slot
public enum mySlot{
invSlot,
oneHand,
TwoHand,
offHand,
head,
shoulder,
chest,
legs,
belt,
boots
};
public mySlot itemType = mySlot.invSlot;
public void OnDrop (PointerEventData eventData)
{
if(item && DragHandler.itemBeingDragged.transform.GetComponent<DragHandler>().itemType == itemType)
{
print(transform.name);
//this one here is causing the error,
}
what i want to do is check both enums against each other to see if either one = each other without having to check each state otherwise it would be very messy is this possible without having to check each state?
i would of thought it would be something like i had done checking only the parameters i needed and everything else would return it back to its original slot in the inventory if it did not meet the state requirements
DragHandler Script
public enum Slot{
invSlot,
oneHand,
TwoHand,
offHand,
head,
shoulder,
chest,
legs,
belt,
boots
};
public Slot itemType = Slot.invSlot;
these are not the entire scripts as they would be very long to post but the required info i would believe that is needed to help sold this issue.
the 2 enums i want to check against eachother without having to check every single state. more or less
if it is a 1 Handed weapon, is it a sword dagger mace, etc, in most RPG games a mage cant wield a sword or a shield. but can store them in their inventory. what i want to do is compare the items enum against the players inventory and equipment slot enums. can this player equip this particular item etc. the way i want to do it is through enum comparing without having to go through every single possible combination rather than checkign the possible combinations only like if it is a offhand Sword you can only be put in the offhand weapon slot of a warrior or the inventory slot. but other rules will apply to other classes. that may break that condition.