티스토리 뷰

Unity 3D/팀 프로젝트

item.cs

猫猫 2015. 3. 24. 10:26
반응형
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
49
50
51
52
53
54
using UnityEngine;
using System.Collections;
 
[System.Serializable] // Inspector에서 보기위해서 Monobehavior상속을 버리고 serializable한다.
public class Item
{
    public string     itemName;
    public int          itemId;
    public string     itemDesc;
    public Sprite    itemIcon;
    public GameObject itemModel;
    public int        itemPower;
    public int        itemSpeed;
    public int         itemValue;//for consumable item
    public ItemType    itemType;
    
    public enum ItemType
    {
        Weapon,
        Head,
        Chest,
        Shoes,
        LeftRing,
        RightRing,
        Belt,
        Shoulder,
        Necklace,
        Shield,
        Wrist,
        Hand,
        Pants,
        Consumable,
        Quest
    }
    
    public Item(string name, int id, string desc, int power, int speed,int value, ItemType type)
    {
        itemName = name;
        itemId = id;
        itemDesc = desc;
        itemPower = power;
        itemSpeed = speed;
        itemValue = value;
        itemType = type;
        itemIcon = Resources.Load <Sprite>(""+itemName); //Resources 폴더에서 아이템네임과 동일한 아이콘을 가져온다.
        itemModel = Resources.Load<GameObject>("Droppeditem");
    }
 
    public Item()
    {
        ;
    }
}
 
cs


반응형

'Unity 3D > 팀 프로젝트' 카테고리의 다른 글

이펙트 관리  (0) 2015.03.24
inventory.cs  (0) 2015.03.24
itemdatabase.cs  (0) 2015.03.24