Added first crafting steps, finished quest generation save and load, v1.4.0
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -45,6 +46,8 @@ namespace Assets.Scripts
|
||||
}
|
||||
}
|
||||
|
||||
public CollectQuest(JToken token, GameObject display) : base(token, display) { }
|
||||
|
||||
override
|
||||
public void update(object obj, int amount)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -15,6 +16,8 @@ namespace Assets.Scripts
|
||||
questname = "Travel to " + Mathf.Floor(coordinates.x) + "/" + Mathf.Floor(coordinates.z) + "(X/Z)";
|
||||
}
|
||||
|
||||
public ExploreQuest(JToken token, GameObject display) : base(token, display) { }
|
||||
|
||||
override
|
||||
public void update(object obj, int amount)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -37,6 +38,8 @@ namespace Assets.Scripts
|
||||
}
|
||||
}
|
||||
|
||||
public FindQuest(JToken token, GameObject display) : base(token, display) { }
|
||||
|
||||
public void generateCityQuest()
|
||||
{
|
||||
questname = "Find all cities";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -29,6 +30,8 @@ namespace Assets.Scripts
|
||||
}
|
||||
}
|
||||
|
||||
public KillQuest(JToken token, GameObject display) : base(token, display) { }
|
||||
|
||||
override
|
||||
public void update(object obj, int amount)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -20,6 +21,17 @@ namespace Assets.Scripts
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
public Quest(JToken token, GameObject display)
|
||||
{
|
||||
this.display = display;
|
||||
questname = token["questname"].ToString();
|
||||
keyword = token["keyword"].ToString();
|
||||
current = int.Parse(token["current"].ToString());
|
||||
goal = int.Parse(token["goal"].ToString());
|
||||
isFinished = bool.Parse(token["isFinished"].ToString());
|
||||
coordinates = new Vector3(float.Parse(token["coordinates"].ToString().Split('/')[0]), 0, float.Parse(token["coordinates"].ToString().Split('/')[1])) ;
|
||||
}
|
||||
|
||||
public virtual void update(object obj, int amount)
|
||||
{
|
||||
//empty
|
||||
@@ -61,6 +73,18 @@ namespace Assets.Scripts
|
||||
{
|
||||
GameObject.Destroy(display);
|
||||
}
|
||||
|
||||
public string saveQuest()
|
||||
{
|
||||
string result = "";
|
||||
result = result + FileHandler.generateJSON("questname", "\"" + questname + "\"") + ",\r\n";
|
||||
result = result + FileHandler.generateJSON("keyword", "\"" + keyword + "\"") + ",\r\n";
|
||||
result = result + FileHandler.generateJSON("current", current) + ",\r\n";
|
||||
result = result + FileHandler.generateJSON("goal", goal) + ",\r\n";
|
||||
result = result + FileHandler.generateJSON("isFinished", "\"" + isFinished + "\"") + ",\r\n";
|
||||
result = result + FileHandler.generateJSON("coordinates", "\"" + coordinates.x + "/" + coordinates.z + "\"") + "\r\n";
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user