Scriptum/Assets/Scripts/Item/Item.cs
kabix09 602c94726a Add scene manager for items
Start rebuild Save & Load game system
2022-06-19 01:25:49 +02:00

89 lines
1.9 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
[System.Serializable]
[CreateAssetMenu(fileName = "New Item", menuName = "Inventory/Items")]
public class Item : ScriptableObject
{
public int id;
public int Id
{
get { return id; }
set { id = value; }
}
public string name;
public string Name
{
get { return name; }
set { name = value; }
}
public string description;
public string Description
{
get { return description; }
set { description = value; }
}
public int level;
public int Level
{
get { return level; }
set { level = value; }
}
public Sprite image;
public Sprite Image
{
get { return image; }
set { image = value; }
}
// to handle object created on scene for example after removing from inventory
public GameObject itemModel;
public GameObject ItemModel
{
get { return itemModel; }
set { itemModel = value; }
}
public Item() {}
public Item(Item _item)
{
this.Name = _item.Name;
this.Description = _item.Description;
this.Level = _item.Level;
this.ItemModel = _item.ItemModel;
this.Image = _item.Image;
}
public Item(string _name, string _description, int _level, GameObject _itemModel, Sprite _image)
{
this.Name = _name;
this.Description = _description;
this.Level = _level;
this.ItemModel = _itemModel;
this.Image = _image;
}
// public void SaveItem()
// {
// SaveItemSystem.SaveItem(this);
// }
// public void LoadItem()
// {
// ItemData data = SaveItemSystem.LoadIten();
// id = data.id;
// name = data.name;
// description = data.description;
// level = data.level;
// }
}