Added NPCs to game, fixed explore and collect quest, added quest remove, fixed quest update, v1.4.0

This commit is contained in:
Nicola Sovic
2022-07-14 23:48:37 +02:00
parent 3f8d9c0551
commit 59e34ef728
10 changed files with 199 additions and 62 deletions

View File

@@ -49,31 +49,7 @@ namespace Assets.Scripts
public void update(object obj, int amount)
{
Item item = (Item)obj;
if (keyword == "Slimeball" && item.getName().ToLower().Contains("slimeball"))
{
current = current + amount;
}
if (keyword == "Stone" && item.getName().ToLower().Contains("stone"))
{
current = current + amount;
}
if (keyword == "Wood" && item.getName().ToLower().Contains("wood"))
{
current = current + amount;
}
if (keyword == "Common" && item.getName().ToLower().Contains("common"))
{
current = current + amount;
}
if (keyword == "Rare" && item.getName().ToLower().Contains("rare"))
{
current = current + amount;
}
if (keyword == "Epic" && item.getName().ToLower().Contains("epic"))
{
current = current + amount;
}
if (keyword == "Legendary" && item.getName().ToLower().Contains("legendary"))
if (checkItem(item))
{
current = current + amount;
}
@@ -81,7 +57,73 @@ namespace Assets.Scripts
{
isFinished = true;
}
else
{
isFinished = false;
}
}
public void removeItems(Inventory inventory)
{
Item item;
int counter = 0;
for (int i = 0; i < 3; i++)
{
foreach (GameObject slot in inventory.slots)
{
item = slot.GetComponent<InventorySlot>().getItem(i);
if (item != null)
{
if (checkItem(item))
{
slot.GetComponent<InventorySlot>().removeItem(i);
counter++;
}
}
if (counter == goal)
{
break;
}
}
if (counter == goal)
{
break;
}
}
}
private bool checkItem(Item item)
{
bool result = false;
if (keyword == "Slimeball" && item.getName().ToLower().Contains("slimeball"))
{
return true;
}
if (keyword == "Stone" && item.getName().ToLower().Contains("stone"))
{
return true;
}
if (keyword == "Wood" && item.getName().ToLower().Contains("wood"))
{
return true;
}
if (keyword == "Common" && item.getName().ToLower().Contains("common"))
{
return true;
}
if (keyword == "Rare" && item.getName().ToLower().Contains("rare"))
{
return true;
}
if (keyword == "Epic" && item.getName().ToLower().Contains("epic"))
{
return true;
}
if (keyword == "Legendary" && item.getName().ToLower().Contains("legendary"))
{
return true;
}
return result;
}
}
}