Added inheritance for quests, finished quest implementation (90%), v1.4.0
This commit is contained in:
83
Assets/Scripts/Quests/FindQuest.cs
Normal file
83
Assets/Scripts/Quests/FindQuest.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets.Scripts
|
||||
{
|
||||
public class FindQuest : Quest
|
||||
{
|
||||
public FindQuest(GameObject display) : base(display)
|
||||
{
|
||||
current = 0;
|
||||
goal = getRandomNumber(10) + 1;
|
||||
questname = "Find " + goal + " ";
|
||||
int index = getRandomNumber(5);
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
questname = questname + "planes";
|
||||
keyword = "Plane";
|
||||
break;
|
||||
case 1:
|
||||
questname = questname + "mountains";
|
||||
keyword = "Mountain";
|
||||
break;
|
||||
case 2:
|
||||
questname = questname + "forests";
|
||||
keyword = "Forest";
|
||||
break;
|
||||
case 3:
|
||||
questname = questname + "rivers";
|
||||
keyword = "River";
|
||||
break;
|
||||
case 4:
|
||||
questname = questname + "lakes";
|
||||
keyword = "Lake";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void generateCityQuest()
|
||||
{
|
||||
questname = "Find all cities";
|
||||
keyword = "City";
|
||||
current = 0;
|
||||
goal = GameObject.Find("WorldGenerator").GetComponent<WorldGenerator>().getCityAmount();
|
||||
}
|
||||
|
||||
override
|
||||
public void update(object obj, int amount)
|
||||
{
|
||||
GameObject tile = (GameObject)obj;
|
||||
string tilename = tile.GetComponent<Tile>().getTileType();
|
||||
if (keyword == "Forest" && tilename.ToLower().Contains("forest"))
|
||||
{
|
||||
current++;
|
||||
}
|
||||
if (keyword == "Plane" && tilename.ToLower().Contains("plane"))
|
||||
{
|
||||
current++;
|
||||
}
|
||||
if (keyword == "Mountain" && tilename.ToLower().Contains("mountain"))
|
||||
{
|
||||
current++;
|
||||
}
|
||||
if (keyword == "River" && tilename.ToLower().Contains("river"))
|
||||
{
|
||||
current++;
|
||||
}
|
||||
if (keyword == "Lake" && tilename.ToLower().Contains("lake"))
|
||||
{
|
||||
current++;
|
||||
}
|
||||
if (keyword == "City" && tilename.ToLower().Contains("city"))
|
||||
{
|
||||
current++;
|
||||
}
|
||||
if (current >= goal)
|
||||
{
|
||||
isFinished = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user