Added custom item behaviour
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user