Added custom item behaviour

This commit is contained in:
2026-04-18 14:03:28 +01:00
parent 529a83dafc
commit 88cf5b7ba9
6 changed files with 64 additions and 13 deletions

View File

@@ -3,6 +3,13 @@ using System;
namespace Fruitomation.Game.Items
{
[Serializable] public enum CustomBehaviourType
{
None,
FruitBehaviour,
}
[Serializable] public enum ItemType
{
Apple,
@@ -57,10 +64,24 @@ namespace Fruitomation.Game.Items
[Serializable] public class ItemInfo
{
public ItemType Type;
[SerializeField] private CustomBehaviourType CustomBehaviour;
public GameObject Prefab;
public float MinMoney;
public float MaxMoney;
public CustomItemBehaviour GetCustomBehaviour()
{
return CustomBehaviour switch
{
CustomBehaviourType.None => null,
CustomBehaviourType.FruitBehaviour => new FruitBehaviour(),
var _ => throw new ArgumentOutOfRangeException()
};
}
}
[CreateAssetMenu] public class SerializedItemInfoRegistry : ScriptableObject