예제 #1
0
        //init item function
        public static Item initItem(GameTypes.ItemType type, Transform parent)
        {
            Item item = GameObject.Instantiate(getItem(type.ToString()), parent).GetComponent <Item>();

            item.setAmount(0);
            item.setType(type);
            return(item);
        }
예제 #2
0
        //init Resource function
        public static Resource initResource(Vector3 pos, GameTypes.ItemType type, Region reg)
        {
            Resource res = GameObject.Instantiate(getResource(type.ToString()), reg.getResourceObject().transform).GetComponent <Resource>();

            res.gameObject.transform.position = pos;
            res.mType = type;
            reg.addEntity("resources", res);
            res.mAmount = Globals.RESOURCE_DEFAULT_AMOUNT;
            return(res);
        }