OnTriggerEnter / Inventory question?!

I have an inventory array script written, and i would like to know if i can either add into that an “OnTriggerEnter” function or if not, how to write a script, so that whenever i enter a trigger that has the script attached to it, it will remove whatever amount of items happens to be in the inventory, and adds that same amount to its own counter, with a max of say 300, which then triggers a new scene. Is this possible? My inventory script is below:

enum InventoryItem{
DEBUG_ITEM,
SCREW,
NUT,
BOSS_TRAY,
BOSS_PLOWBLADE,
BOSS_WINDBLADE,
ENERGYPACK,
REPAIRKIT,
COUNT_NUM_ITEMS
}

var PlayerInventory: int ;

var playerStatus: Player_Status;
playerStatus = GetComponent(Player_Status) ;

//Item Properties----------------------------------------------

private var repairKitHealAmt = 5.0;
private var energyPackHealAmt = 5.0;

//Initilaize Player’s starting Inventory-------------------

function Start(){

PlayerInventory = new int[InventoryItem.COUNT_NUM_ITEMS];

for (var item in PlayerInventory){
	PlayerInventory[item] = 0;
}

//Give Player some starting items
PlayerInventory[InventoryItem.ENERGYPACK] = 1;
PlayerInventory[InventoryItem.REPAIRKIT] = 2;

}

//Inventory Management Functions----------------------------------

function GetItem(item: InventoryItem, amount: int){
PlayerInventory[item] += amount;
}

function UseItem(item: InventoryItem, amount: int){

if(PlayerInventory[item] <= 0) return;

PlayerInventory[item] -= amount;

switch(item){
	case InventoryItem.ENERGYPACK:
		playerStatus.AddEnergy(energyPackHealAmt);
		break;
	case InventoryItem.REPAIRKIT:
		playerStatus.AddHealth(repairKitHealAmt);
		break;
}

}

function CompareItemCount(compItem: InventoryItem, compNumber: int){

return PlayerInventory[compItem] >= compNumber;

}

function GetItemCount(compItem: InventoryItem){
return PlayerInventory[compItem];
}

@script AddComponentMenu(“Inventory/Player’s Inventory”)

You’ve got a couple options.

  1. Create functions to count items and remove items from the player, then implement inventory on whatever will be holding the items.

  2. Create functions to get and remove the entire inventory at once, and then implement inventory on whatever and have functions to set the whole inventory at once.