I simply want to be able to loot an enemy and have the looted item go to a default position in the inventory.
If the default position is taken, then I want the item to go to the position next to the default one.
And so on.
So far, I have an inventory system. In this script I have assigned a spot for each item:
var items : List.;
var spaces : List.;
var itemCount : int;
function Awake () {
spaces.Add(Rect(279, 225, 66, 63));
spaces.Add(Rect(344, 225, 66, 63));
spaces.Add(Rect(409, 225, 66, 63));
spaces.Add(Rect(279, 160, 66, 63));
spaces.Add(Rect(344, 160, 66, 63));
spaces.Add(Rect(409, 160, 66, 63));
spaces.Add(Rect(279, 96, 66, 63));
spaces.Add(Rect(344, 96, 66, 63));
spaces.Add(Rect(409, 96, 66, 63));
spaces.Add(Rect(279, 32, 66, 63));
spaces.Add(Rect(344, 32, 66, 63));
spaces.Add(Rect(409, 32, 66, 63));
}
function Update () {
itemCount = items.Count;
for (var item in items) {
(item as GameObject).transform.position = Vector3(0, 0, 1);
for (var i = 0; i < itemCount; i++) {
item = items*;*
_(item as GameObject).guiTexture.pixelInset = spaces*;*_
_*}*_
_*}*_
_*}*_
_**_
But because I have set the position of the item I can’t move it to another spot, any Ideas on how to correct this?
Or:
Anyone know how to drag and drop an item to another location?
Thank you for your time!