Added inheritance for quests, finished quest implementation (90%), v1.4.0
This commit is contained in:
87
Assets/Scripts/Quests/CollectQuest.cs
Normal file
87
Assets/Scripts/Quests/CollectQuest.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets.Scripts
|
||||
{
|
||||
public class CollectQuest : Quest
|
||||
{
|
||||
public CollectQuest(GameObject display) : base(display)
|
||||
{
|
||||
current = 0;
|
||||
goal = getRandomNumber(10) + 1;
|
||||
questname = "Collect " + goal + " ";
|
||||
int index = getRandomNumber(7);
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
questname = questname + "slimeballs";
|
||||
keyword = "Slimeball";
|
||||
break;
|
||||
case 1:
|
||||
questname = questname + "stones";
|
||||
keyword = "Stone";
|
||||
break;
|
||||
case 2:
|
||||
questname = questname + "wood";
|
||||
keyword = "Wood";
|
||||
break;
|
||||
case 3:
|
||||
questname = questname + "common items";
|
||||
keyword = "Common";
|
||||
break;
|
||||
case 4:
|
||||
questname = questname + "rare items";
|
||||
keyword = "Rare";
|
||||
break;
|
||||
case 5:
|
||||
questname = questname + "epic items";
|
||||
keyword = "Epic";
|
||||
break;
|
||||
case 6:
|
||||
questname = questname + "legendary items";
|
||||
keyword = "Legendary";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
override
|
||||
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"))
|
||||
{
|
||||
current = current + amount;
|
||||
}
|
||||
if (current >= goal)
|
||||
{
|
||||
isFinished = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user