public void determineDrop(float dropRate, Vector3 originPostion){
int dropRoll = Random.Range(1,100);
if(dropRoll <= (int)(dropRate * 100)){
System.Type itemType = null;
Vector3 dropPosition = originPostion;
int xRoll = Random.Range(-200, 200);
int zRoll = Random.Range(-200, 200);
dropPosition.x += (xRoll / 100);
dropPosition.z += (zRoll / 100);
int itemRoll = Random.Range(1, weightSum);
Debug.Log ("item roll is: " + itemRoll);
foreach(KeyValuePair<System.Type, LootWeights> item in items)
{
itemType = item.Key;
LootWeights itemWeight = item.Value;
Debug.Log (item.Key.ToString() + ":" + itemWeight.weight + ":" + itemWeight.csum);
if (itemRoll <= itemWeight.csum){
break;
}
}
//ItemHolder itemHolder = Network.Instantiate(itemHolderPrefab, dropPosition, Quaternion.identity,8)as ItemHolder;
ItemHolder itemHolder = Instantiate(itemHolderPrefab, dropPosition, Quaternion.identity)as ItemHolder;
itemHolder.item = (Item) System.Activator.CreateInstance(itemType);
}
}