private void AddItem(MechaComponentInfo mci, GridPos.Orientation orientation, List <GridPos> realOccupiedGPs, out BagItem bagItem) { IntRect realSpace = GetSizeFromGridPositions(realOccupiedGPs); GridPos GridPos = new GridPos(realSpace.x, realSpace.z, orientation); bagItem = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.BagItem].AllocateGameObject <BagItem>(ItemContainer); bagItem.Initialize(mci, realSpace.width, realSpace.height, GridPos, realOccupiedGPs, false); bagItems.Add(bagItem); foreach (GridPos gp in realOccupiedGPs) { bagGridMatrix[gp.x, gp.z].State = BagGrid.States.Unavailable; } }