how can i make the same key activate the different effects on the items in my inventory

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine.EventSystems;

public class Inventory : MonoBehaviour//, IPointerExitHandler
{
public int slotsX = 5;
public int slotsY = 5;
public GUISkin skin;
public List inventory = new List();
public bool showInventory = false;
public bool showCrafting = false;
public static List recipes = new List ();
public Transform Hand;
public Transform Parent;
PlayerHealth playerHealth;
GameObject player;
private bool ShowToolTip;
private string toolTip;
public GameObject NameText;
public GameObject DescText;
public GameObject Panel;
public Transform MPanel;
private MouseLook mouseLook;

private Item swappedItem;
private bool draggingItem = false;
private Item draggedItem;
private int prevIndex;
private int spikeCount;
private Rect invRect = new Rect(200, 140, 350, 420);
private Rect imageRect = new Rect(0, 0, 30, 30);
private Rect craftRect = new Rect(0, 40, 350, 350);
private Vector2 scrollPosition = Vector2.zero;


// Use this for initialization
void Start () 
{
	player = GameObject.FindGameObjectWithTag ("Player");
	playerHealth = playerHealth.GetComponent <PlayerHealth> ();

	Screen.showCursor = false;

	invRect = new Rect(Screen.width / 2 - (invRect.width / 2), 0, invRect.width, invRect.height);
	craftRect = new Rect(Screen.width / 2 - craftRect.width - invRect.width / 2, 0, craftRect.width, craftRect.height);
	
	for(int i = 0; i < (slotsX * slotsY); i++)
	{
		inventory.Add(new Item());
	}

	new RecipeCreator();
}

IEnumerator MyAction()
{
	Panel.SetActive (true);
	yield return new WaitForSeconds (2);
	Panel.SetActive (false);
	StopCoroutine ("MyAction");
}

void Awake()
{
	player = GameObject.FindGameObjectWithTag ("Player");
	playerHealth = player.GetComponent <PlayerHealth> ();
	mouseLook = GetComponent<MouseLook> ();
}

// Update is called once per frame
void Update () {
	if(Input.GetKeyDown(KeyCode.I))
	{
		showInventory = !showInventory;
		showCrafting = !showCrafting;
		Screen.showCursor = !Screen.showCursor;
		
		if(draggingItem)
		{
			inventory[prevIndex] = draggedItem;
			draggingItem = false;
			draggedItem = null;
		}
	}
	
	//Cheat Keys
	if(Input.GetKeyDown("1"))
	{
		AddItem("Wood");
	}
	
	if(Input.GetKeyDown("2"))
	{
		AddItem("WoodPlanks");
	}

	if(Input.GetKeyDown("3"))
	{
		AddItem("Stone");
	}
	if(Input.GetKeyDown("4"))
	{
		AddItem("Knife");
	}
}
void OnGUI()
{
	//toolTip = "";
	GUI.skin = skin;
	
	if(showInventory)
	{
		GetCraftable();
		invRect = GUI.Window(0, invRect, DrawInventory,  "");

		
		if(Event.current.type == EventType.mouseUp && draggingItem)
		{
			if(invRect.Contains(Event.current.mousePosition))
			{
				inventory[prevIndex] = draggedItem;
				draggingItem = false;
				draggedItem = null;
			} else {
				RemoveItem(prevIndex);
				draggingItem = false;
				draggedItem = null;
			}
		}
		
		if(draggingItem)
		{
			CreateDraggedItem();
		}

		if(showCrafting)
		{
			craftRect = GUI.Window(5, craftRect, DrawCraftView, "");
		}
	}
}

void AddSpikes (float winX)
{
	spikeCount = (int)Mathf.Floor (winX - 152) / 22;
	GUILayout.BeginHorizontal ();
	GUILayout.Label ("", "SpikeLeft");//-------------------------------- custom
	for (int i = 0; i < spikeCount; i++) {
		GUILayout.Label ("", "SpikeMid");//-------------------------------- custom
	}
	GUILayout.Label ("", "SpikeRight");//-------------------------------- custom
	GUILayout.EndHorizontal ();
}


void DrawInventory(int windowId)
{
	toolTip = "";
	AddSpikes(windowId);
	
	GUILayout.Label ("Inventory");
	
	Event e = Event.current;
	
	int i = 0;
	
	for(int x = 0; x < slotsX; x++)
	{
		GUILayout.BeginHorizontal();
		for(int y = 0; y < slotsY; y++)
		{
			GUILayout.BeginVertical();
			GUILayout.Box (inventory*.itemIcon);*

_ if(inventory*.multiItems)_
_
{_
_ if(inventory.itemCounter > 1)
{
GUI.Box(GUILayoutUtility.GetLastRect(), inventory.itemCounter.ToString(), “ItemCounter”);
}
}*_

_ if(inventory*.itemName != null)
{
//GUI.DrawTexture(imageRect, inventory.itemIcon);
if(ShowToolTip)
{
//GUI.Box(new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 200, 200), toolTip);
}
if(IsMouseOver())
{
//GUI.Label(new Rect(80, 10, 250, 50) (“” + name));
//GameObject Panel = GameObject.Find(“Panel”);
//Panel.SetActive(true);
StartCoroutine(“MyAction”);
Text nametext = NameText.GetComponent();
nametext.text = “” + inventory.itemName;
Text desctext = DescText.GetComponent();
desctext.text = “” + inventory.itemDescription;
/if(imageRect.Contains(Event.current.mousePosition))
{

toolTip = CreateToolTip(inventory*);
ShowToolTip = true;
}/

* if(Input.GetKeyDown(KeyCode.M))
{
if(inventory.itemType == Item.ItemType.Medicine);
{
RemoveItem(“” + inventory.itemName, 1);
playerHealth.GainHealth(0.1f);
}
}
if(Input.GetKeyDown(KeyCode.F))
{
if(inventory.itemType == Item.ItemType.Food);
{
RemoveItem(“” + inventory.itemName, 1);
playerHealth.EatFood(0.1f);
}
}*_

* if(e.button == 0 && e.type == EventType.mouseDown && !draggingItem)*
* {*
* draggingItem = true;*
* prevIndex = i;*
_ draggedItem = inventory*;
inventory = new Item();
}
if(Input.GetKeyDown(KeyCode.E))
{
//GameObject instance = Instantiate(Resources.Load(“” + inventory.itemName), Hand.position, Hand.rotation);
GameObject instance = Instantiate(Resources.Load(“” + inventory.itemName), Hand.position, Hand.rotation) as GameObject;
instance.transform.SetParent(Hand);
//instance.rigidbody.constraints = RigidbodyConstraints.FreezeAll;
instance.tag = “EItem”;
instance.collider.enabled = false;
//GameObject (“” + inventory.itemName);
//GameObject Hand;
//Clone.transform.SetParent(Hand);
}*_

* if(e.type == EventType.mouseUp && draggingItem)*
* {*
_ inventory[prevIndex] = inventory*;
inventory = draggedItem;
draggingItem = false;
draggedItem = null;
}
}
if (toolTip == “”)
{
ShowToolTip = false;
}
//if(!IsMouseOver())
//{
// CloseToolTip();
//}
}
else {
if(IsMouseOver())
{
if(e.type == EventType.mouseUp && draggingItem)
{
inventory = draggedItem;
draggingItem = false;
draggedItem = null;
}
}
}
GUILayout.EndVertical();
i++;
}
GUILayout.EndHorizontal();
}
GUI.DragWindow (new Rect(0, 0, 10000, 75));
}
string CreateToolTip(Item item)
{
toolTip = item.itemName;
return toolTip;
}
void DrawCraftView(int windowID)
{
AddSpikes(craftRect.width);
Event e = Event.current;
GUILayout.Space(8);
GUILayout.Label(“Crafting”);
GUILayout.Label(“”, “Divider”);
scrollPosition = GUILayout.BeginScrollView(scrollPosition);
for(int i = 0; i < GetCraftable().Count; i++)
{
if(GUILayout.Button(GetCraftable()))
{
Craft(GetCraftable());
}
}
GUILayout.EndScrollView();
GUILayout.Label(“”, “Divider”);
GUILayout.Space(8);
GUI.DragWindow(new Rect(0, 0, 10000, 75));
}*_

* bool IsMouseOver()*
* {*
* return GUILayoutUtility.GetLastRect ().Contains (Event.current.mousePosition);*
* }*
* //public void OnPointerExit(PointerEventData data)*
* //{*
* // CloseToolTip ();*
* //}*
* void CreateDraggedItem()*
* {*
* Rect tempRect = new Rect (Event.current.mousePosition.x + 5, Event.current.mousePosition.y, 64, 64);*
* imageRect = GUI.Window (2, tempRect, DrawDraggedItem, “”, “DragImage”);*
* }*
_ /public void ShowToolTip()
{
toolTip.SetActive (true);
}
public void CloseToolTip()
{
toolTip.SetActive (false);
}/_

* void DrawDraggedItem(int windowID)*
* {*
* GUILayout.Box (draggedItem.itemIcon, “DragImage”);*
* }*

* public void AddItem(int id)*
* {*
* if(Database.isItemMultiple(id))*
* {*
* if(InventoryContains(id))*
* {*
* AddItemToExisting(id);*
* return;*
* }*
* }*

* for(int i = 0 ; i < inventory.Count; i++)*
* {*
_ if(inventory*.itemName == null)
{
for(int j = 0; j < Database.items.Count; j++)
{
if(Database.items[j].itemID == id)
{
Database.CopyItem(inventory, Database.items[j]);
}
}
break;
}
}
}*_

* public void AddItem(string name)*
* {*
* if(Database.isItemMultiple(name))*
* {*
* if(InventoryContains(name))*
* {*
* AddItemToExisting(name);*
* return;*
* }*
* }*

* for(int i = 0 ; i < inventory.Count; i++)*
* {*
_ if(inventory*.itemName == null)
{
for(int j = 0; j < Database.items.Count; j++)
{
if(Database.items[j].itemName == name)
{
Database.CopyItem(inventory, Database.items[j]);
}
}
break;
}
}
}*_

* public void AddItem(Item item)*
* {*
* if(Database.isItemMultiple(item.itemID))*
* {*
* if(InventoryContains(item.itemID))*
* {*
* AddItemToExisting(item.itemID);*
* return;*
* }*
* }*

* for(int i = 0 ; i < inventory.Count; i++)*
* {*
_ if(inventory*.itemName == null)
{
inventory = item;
break;
}
}
}*_

* void RemoveItem(string name, int amount)*
* {*
* int removed = 0;*

* for(int i = 0; i < inventory.Count; i++)*
* {*
_ if(inventory*.itemName == name)
{
if(inventory.multiItems)
{
if(inventory.itemCounter > (amount - removed))
{
inventory.itemCounter -= (amount - removed);
break;
}
else if(inventory.itemCounter == (amount - removed)){
inventory = new Item();
break;
} else {
removed += inventory.itemCounter;
inventory = new Item();
if(removed >= amount)
{
break;
}
}
} else {
if(removed < amount)
{
removed ++;
inventory = new Item();
} else {
break;
}
}
}
}
}*_

* void RemoveItem(int index)*
* {*
* inventory[index] = new Item ();*
* }*

* bool InventoryContains(int id)*
* {*
* for(int i = 0; i < inventory.Count; i++)*
* {*
_ if(inventory*.itemID == id)
{
return true;
}
}
return false;
}*_

* bool InventoryContains(string name)*
* {*
* for (int i = 0; i < inventory.Count; i++)*
* {*
_ if (inventory .itemName == name)
* {
return true;
}
}
return false;
}*_

* bool InventoryContains(string name, int amount)*
* {*
* for (int i = 0; i < inventory.Count; i++)*
* {*
_ if(inventory .itemName == name)
* {
if (inventory .multiItems)
{
if (inventory .itemCounter >= amount)
{
return true;
}
} else {
return false;
}
}
}
return false;
}*_

* void AddItemToExisting(int id)*
* {*
* for(int i = 0; i < inventory.Count; i++)*
* {*
_ if(inventory*.itemID == id)
{
inventory.itemCounter ++;
}
}
}*_

* void AddItemToExisting(string name)*
* {*
* for(int i = 0; i < inventory.Count; i++)*
* {*
_ if(inventory*.itemName == name)
{
inventory.itemCounter ++;
}
}
}
public List GetCraftable()
{
List craftable = new List();
for(int i = 0; i < recipes.Count; i++)
{
foreach(var mat in recipes.items.Keys)
{
if(InventoryContains(mat, recipes.items[mat]))
{
craftable.Add(recipes.itemName);
}
}
}
return craftable;
}
public void Craft(string item)
{
List craftable = GetCraftable();
for(int i = 0; i < recipes.Count; i++)
{
if(recipes.itemName == item)
{
foreach(var mat in recipes.items.Keys)
{
RemoveItem(mat, recipes.items[mat]);
}
}
}
AddItem(item);
}*_

}
so im trying to add effects to my items and the effects work perfectly but for some reason every item has that effect on it for example
if(Input.GetKeyDown(KeyCode.M))
* {*
_ if(inventory*.itemType == Item.ItemType.Medicine);
{
RemoveItem(“” + inventory.itemName, 1);
playerHealth.GainHealth(0.1f);
}
}
if(Input.GetKeyDown(KeyCode.F))
{
if(inventory.itemType == Item.ItemType.Food);
{
RemoveItem(“” + inventory.itemName, 1);
playerHealth.EatFood(0.1f);
}
}*

i tried to set it up so it gets the itemType and if its a certain one like medicine it does that effect. and at first i thought it was working except that id have to use different keys for each effect. but then i realized that if i pressed that key on all the other items it used the effect. i dont know why it isnt working and i tried figuring it out but i couldnt. im still really new to scripting. So what i need to know is how to set it up so it checks the itemType and depending on the type it uses a different effect and also so i only have to press one key. Hopefully its enough details for everyone. But let me know if you need more information_

Ok i figured out the problem. instead of doing

if(Input.GetKeyDown(KeyCode.F))
                     {
                         if(inventory*.itemType == Item.ItemType.Food);*

{
RemoveItem(“” + inventory*.itemName, 1);*
playerHealth.EatFood(0.1f);
}
}

i needed to do a double if statement like
if(Input.GetKeyDown(KeyCode.U) && inventory*.itemType == Item.ItemType.Medicine)*
* {*
_ RemoveItem(“” + inventory*.itemName, 1);
playerHealth.GainHealth(0.1f);
}*_