Scriptum/Assets/Scripts/REFACTORING/Models/Panel/Slot/EquipmentSlot.cs

23 lines
776 B
C#
Raw Permalink Normal View History

2022-06-05 16:51:08 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
2022-11-24 03:03:30 +01:00
[System.Serializable]
2022-06-05 16:51:08 +02:00
public class EquipmentSlot : ItemSlot
{
2022-11-24 03:03:30 +01:00
[SerializeField] public EquipmentPanelSlotsTypeEnum type;
2022-11-06 21:34:17 +01:00
public EquipmentTypeEnum EquipmentType;
2022-06-05 16:51:08 +02:00
public override bool CanReceiveItem(Item item)
{
if(item == null) // if dropped item is null alway accept :D
return true;
EquippableItem equippableItem = item as EquippableItem; // jeśli item pierwotnie nie był typu EquippableItem to casting zwróci NULL
2022-11-24 03:03:30 +01:00
return equippableItem != null && equippableItem.EquipmentType != EquipmentTypeEnum.None && equippableItem.EquipmentType == EquipmentType; // the second condition is to put items on fields with matched type
2022-06-05 16:51:08 +02:00
}
}