Hi all,
I am currently designing different items to use in my game like sword, shields etc. I am using a built in array to store all the items in, but I can only access it from the inspector. I am not sure how to create a typed array that can be modified in script. I could use a generic array or arraylist, but I am afraid that if I add too many items, it might become too slow. This is my item code:
static var items : Item[];
public class Item
{
var name : String;
var sellValue : int;
var armorRate : int;
var armorPierce : int;
var critRate : int;
var attackSpeed : int;
var weaponRange : int;
var minWeaponRange : int;
function Item(nam : String, val : int, armor : int, armp : int, crit : int, attspd : int, rang : int, minrang :int)
{
name = nam;
armorRate = armor;
sellValue = val;
armorPierce = armp;
critRate = crit;
attackSpeed = attspd;
weaponRange = rang;
minWeaponRange = minrang;
}
}
What is the usual way of storing possible items in a game? Should I just add them all in the inspector or just use a generic array without type declared?