-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathItem.cs
48 lines (42 loc) · 1.29 KB
/
Item.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Item
{
private GameBehavior gameManager = null;
private Inventory<Item> inventory = null;
private bool collectable;
private string name = string.Empty;
private string description = string.Empty;
private string icon = string.Empty;
private Texture2D texture;
public Coordinate position;
public Item(string name)
{
this.name = name;
}
public Item(string name, string icon, bool collectable = true, string description = "")
{
gameManager = GameBehavior.Instance;
inventory = gameManager.inventory;
if (inventory == null)
Debug.LogError("Cannot find Inventory");
if (gameManager == null)
Debug.LogError("Cannot find gameManager");
this.name = name;
this.icon = icon;
texture = null;
texture = Resources.Load<Texture2D>(FilePaths.items + this.icon);
this.collectable = collectable;
this.description = description;
}
/*
public virtual void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.name == "Player")
{
inventory.Push(this);
Destroy(this.transform.parent.gameObject);
}
}*/
}