{"action":"closed","issue":{"url":"https://api.github.com/repos/Lerondo/Mythe/issues/6","labels_url":"https://api.github.com/repos/Lerondo/Mythe/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/Lerondo/Mythe/issues/6/comments","events_url":"https://api.github.com/repos/Lerondo/Mythe/issues/6/events","html_url":"https://github.com/Lerondo/Mythe/issues/6","id":57812874,"number":6,"title":"DRY","user":{"login":"RichardRam87","id":5513037,"avatar_url":"https://avatars.githubusercontent.com/u/5513037?v=3","gravatar_id":"","url":"https://api.github.com/users/RichardRam87","html_url":"https://github.com/RichardRam87","followers_url":"https://api.github.com/users/RichardRam87/followers","following_url":"https://api.github.com/users/RichardRam87/following{/other_user}","gists_url":"https://api.github.com/users/RichardRam87/gists{/gist_id}","starred_url":"https://api.github.com/users/RichardRam87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RichardRam87/subscriptions","organizations_url":"https://api.github.com/users/RichardRam87/orgs","repos_url":"https://api.github.com/users/RichardRam87/repos","events_url":"https://api.github.com/users/RichardRam87/events{/privacy}","received_events_url":"https://api.github.com/users/RichardRam87/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-16T14:51:39Z","updated_at":"2015-03-03T15:03:58Z","closed_at":"2015-03-03T15:03:58Z","body":"```c\npublic void EquipItem(int itemId)\n\t{\n\t\tif(_itemDatabase.itemList[itemId].GetItemSort() == Item.ItemSort.sword)\n\t\t{\n\t\t\tUpdateItemStats(_swordId,itemId);\n\t\t\t_swordId = itemId;\n\t\t\tplayerSword.renderer.material.mainTexture = _itemDatabase.GetItemTexture(itemId);\n\t\t\tplayerSword.GetComponent<MeshFilter>().mesh = _itemDatabase.GetItemMesh(itemId);\n\t\t} \n\t\telse if(_itemDatabase.itemList[itemId].GetItemSort() == Item.ItemSort.shield)\n\t\t{\n\t\t\tUpdateItemStats(_shieldId,itemId);\n\t\t\t_shieldId = itemId;\n\t\t} else if(_itemDatabase.itemList[itemId].GetItemSort() == Item.ItemSort.helm)\n\t\t{\n\t\t\tUpdateItemStats(_helmId,itemId);\n\t\t\t_helmId = itemId;\n\t\t} else if(_itemDatabase.itemList[itemId].GetItemSort() == Item.ItemSort.legs)\n\t\t{\n\t\t\tUpdateItemStats(_legsId,itemId);\n\t\t\t_legsId = itemId;\n\t\t} else if(_itemDatabase.itemList[itemId].GetItemSort() == Item.ItemSort.body)\n\t\t{\n\t\t\tUpdateItemStats(_bodyId,itemId);\n\t\t\t_bodyId = itemId;\n\t\t} else if(_itemDatabase.itemList[itemId].GetItemSort() == Item.ItemSort.boots)\n\t\t{\n\t\t\tUpdateItemStats(_bootsId,itemId);\n\t\t\t_bootsId = itemId;\n\t\t} else if(_itemDatabase.itemList[itemId] == null)\n\t\t{\n\t\t\tDebug.LogError(\"Item does not exist!\");\n\t\t}\n\t} \n```\n\nBestand: https://github.com/Lerondo/Mythe/blob/master/Assets/Scripts/Controller/EquipmentController.cs\n\nDeze functie is niet DRY (Don't Repeat Yourself).\nJe herhaalt een zelfde type proces afhankelijk van een bepaalde variabele. Dit kan efficiënter."}}