diff --git a/MoCha/Assets/Scenes/Home.unity b/MoCha/Assets/Scenes/Home.unity index beeefce..c6a8bad 100644 Binary files a/MoCha/Assets/Scenes/Home.unity and b/MoCha/Assets/Scenes/Home.unity differ diff --git a/MoCha/Assets/Scripts/GetGoals.cs b/MoCha/Assets/Scripts/GetGoals.cs index 85d3e1a..7274b65 100644 --- a/MoCha/Assets/Scripts/GetGoals.cs +++ b/MoCha/Assets/Scripts/GetGoals.cs @@ -4,11 +4,13 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; +using System.Text; //Pretty much a copy of GetData... namespace PedometerU.Tests { public class GetGoals : MonoBehaviour { + private string[] items = { "circle_eye", "crazy_hair", "circle_head", "gap_mouth", "pig_nose", "crown" }; public Text goalText; public string currentDayStr = System.DateTime.Now.ToString("MM/dd/yyyy"); @@ -156,6 +158,12 @@ public class GetGoals : MonoBehaviour { savedPoints += stepsGoal*10; PlayerPrefs.SetInt("totalPoints", savedPoints); pointsText.text = "Points: " + PlayerPrefs.GetInt("totalPoints").ToString (); + + //Random item + StringBuilder invList = new StringBuilder (); + invList.Append(PlayerPrefs.GetString ("inventory")); + invList.Append(items[(int)Math.Round(UnityEngine.Random.value*6.0f)]).Append(" "); + PlayerPrefs.SetString ("inventory", invList.ToString()); } //only applies if "daily" goal diff --git a/MoCha/Assets/Scripts/MonsterDraw.cs b/MoCha/Assets/Scripts/MonsterDraw.cs new file mode 100644 index 0000000..e6aab2a --- /dev/null +++ b/MoCha/Assets/Scripts/MonsterDraw.cs @@ -0,0 +1,32 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class MonsterDraw : MonoBehaviour { + + public GameObject anchorPoint; + + + private Vector2 anchorPos; + + void Start() + { + anchorPos = new Vector2 (anchorPoint.transform.position.x, anchorPoint.transform.position.y); + loadMonster(); + } + + public void loadMonster () + { + string equippedString = PlayerPrefs.GetString("Equipped"); + string[] equipped = equippedString.Split (' '); + + for (int i = 0; i < equipped.Length - 1; i++) { + string savedString = PlayerPrefs.GetString(equipped[i]); + string[] values = savedString.Split (); + GameObject instance = (GameObject)Instantiate(Resources.Load(equipped[i])); + instance.name = equipped [i]; + //instance.GetComponent ().inventory = inv; + instance.transform.position = new Vector2(float.Parse(values[0]), float.Parse(values[1])); + } + } +} diff --git a/MoCha/Assets/Scripts/MonsterDraw.cs.meta b/MoCha/Assets/Scripts/MonsterDraw.cs.meta new file mode 100644 index 0000000..4b0a996 --- /dev/null +++ b/MoCha/Assets/Scripts/MonsterDraw.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 709c87110c75f4e4c83650b83f4b96ae +timeCreated: 1524754933 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: