2018-04-17 13:55:28 -05:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using UnityEngine.SceneManagement;
|
|
|
|
|
|
|
|
|
|
public class MonsterManager : MonoBehaviour {
|
2018-04-23 18:49:34 -05:00
|
|
|
|
|
|
|
|
|
public GameObject inventory;
|
|
|
|
|
public Item item;
|
2018-04-17 13:55:28 -05:00
|
|
|
|
|
2018-04-24 13:49:36 -05:00
|
|
|
|
public Inventory inv;
|
2018-04-23 18:49:34 -05:00
|
|
|
|
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
2018-04-24 13:49:36 -05:00
|
|
|
|
//inv = FindObjectOfType<Inventory> ();
|
|
|
|
|
inv.AddItem (item);
|
2018-04-23 18:49:34 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void showItems()
|
|
|
|
|
{
|
|
|
|
|
if (inventory.activeSelf == false)
|
|
|
|
|
inventory.SetActive (true);
|
|
|
|
|
else inventory.SetActive (false);
|
2018-04-19 14:16:56 -05:00
|
|
|
|
}
|
|
|
|
|
|
2018-04-23 18:49:34 -05:00
|
|
|
|
public void saveMonster()
|
2018-04-17 13:55:28 -05:00
|
|
|
|
{
|
2018-04-25 23:16:28 -05:00
|
|
|
|
GameObject[] monsterParts = GameObject.FindGameObjectsWithTag("MonsterPart");
|
|
|
|
|
|
|
|
|
|
StringBuilder pos = new StringBuilder ();
|
|
|
|
|
string savedString;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < monsterParts.Length; i++) {
|
|
|
|
|
pos = new StringBuilder ();
|
|
|
|
|
pos.Append(GameObject.Find(monsterParts[i].name).transform.position.x).Append(" ").Append(GameObject.Find(monsterParts[i].name).transform.position.y).Append(" ").Append(GameObject.Find(monsterParts[i].name).transform.position.z);
|
|
|
|
|
savedString = pos.ToString ();
|
|
|
|
|
PlayerPrefs.SetString(SceneManager.GetActiveScene().name + monsterParts[i].name, savedString);
|
|
|
|
|
}
|
|
|
|
|
/*
|
2018-04-17 13:55:28 -05:00
|
|
|
|
StringBuilder eyePos = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
eyePos.Append(GameObject.Find("circle_eye").transform.position.x).Append(" ").Append(GameObject.Find("circle_eye").transform.position.y).Append(" ").Append(GameObject.Find("circle_eye").transform.position.z);
|
|
|
|
|
string savedString = eyePos.ToString();
|
|
|
|
|
PlayerPrefs.SetString(SceneManager.GetActiveScene().name + "eyePosition", savedString);
|
|
|
|
|
|
|
|
|
|
StringBuilder hairPos = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
hairPos.Append(GameObject.Find("crazy_hair").transform.position.x).Append(" ").Append(GameObject.Find("crazy_hair").transform.position.y).Append(" ").Append(GameObject.Find("crazy_hair").transform.position.z);
|
|
|
|
|
savedString = hairPos.ToString();
|
|
|
|
|
PlayerPrefs.SetString(SceneManager.GetActiveScene().name + "hairPosition", savedString);
|
|
|
|
|
|
|
|
|
|
StringBuilder headPos = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
headPos.Append(GameObject.Find("circle_head").transform.position.x).Append(" ").Append(GameObject.Find("circle_head").transform.position.y).Append(" ").Append(GameObject.Find("circle_head").transform.position.z);
|
|
|
|
|
savedString = headPos.ToString();
|
|
|
|
|
PlayerPrefs.SetString(SceneManager.GetActiveScene().name + "headPosition", savedString);
|
|
|
|
|
|
|
|
|
|
StringBuilder hatPos = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
hatPos.Append(GameObject.Find("crown").transform.position.x).Append(" ").Append(GameObject.Find("crown").transform.position.y).Append(" ").Append(GameObject.Find("crown").transform.position.z);
|
|
|
|
|
savedString = hatPos.ToString();
|
|
|
|
|
PlayerPrefs.SetString(SceneManager.GetActiveScene().name + "hatPosition", savedString);
|
|
|
|
|
|
|
|
|
|
StringBuilder mouthPos = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
mouthPos.Append(GameObject.Find("gap_mouth").transform.position.x).Append(" ").Append(GameObject.Find("gap_mouth").transform.position.y).Append(" ").Append(GameObject.Find("gap_mouth").transform.position.z);
|
|
|
|
|
savedString = mouthPos.ToString();
|
|
|
|
|
PlayerPrefs.SetString(SceneManager.GetActiveScene().name + "mouthPosition", savedString);
|
2018-04-19 14:16:03 -05:00
|
|
|
|
|
|
|
|
|
StringBuilder nosePos = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
nosePos.Append(GameObject.Find("pig_nose").transform.position.x).Append(" ").Append(GameObject.Find("pig_nose").transform.position.y).Append(" ").Append(GameObject.Find("pig_nose").transform.position.z);
|
|
|
|
|
savedString = nosePos.ToString();
|
|
|
|
|
PlayerPrefs.SetString(SceneManager.GetActiveScene().name + "nosePosition", savedString);
|
2018-04-25 23:16:28 -05:00
|
|
|
|
*/
|
2018-04-17 13:55:28 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void loadMonster ()
|
|
|
|
|
{
|
2018-04-25 23:16:28 -05:00
|
|
|
|
string savedString;
|
|
|
|
|
string[] values;
|
|
|
|
|
|
|
|
|
|
/*
|
2018-04-17 13:55:28 -05:00
|
|
|
|
string savedString = PlayerPrefs.GetString(SceneManager.GetActiveScene().name + "eyePosition");
|
|
|
|
|
string[] values = savedString.Split(' ');
|
|
|
|
|
|
|
|
|
|
GameObject.Find("circle_eye").transform.position = new Vector3(float.Parse(values[0]),float.Parse(values[1]),float.Parse(values[2]));
|
|
|
|
|
|
|
|
|
|
savedString = PlayerPrefs.GetString(SceneManager.GetActiveScene().name + "hairPosition");
|
|
|
|
|
values = savedString.Split(' ');
|
|
|
|
|
|
|
|
|
|
GameObject.Find("crazy_hair").transform.position = new Vector3(float.Parse(values[0]),float.Parse(values[1]),float.Parse(values[2]));
|
|
|
|
|
|
|
|
|
|
savedString = PlayerPrefs.GetString(SceneManager.GetActiveScene().name + "headPosition");
|
|
|
|
|
values = savedString.Split(' ');
|
|
|
|
|
|
|
|
|
|
GameObject.Find("circle_head").transform.position = new Vector3(float.Parse(values[0]),float.Parse(values[1]),float.Parse(values[2]));
|
|
|
|
|
|
|
|
|
|
savedString = PlayerPrefs.GetString(SceneManager.GetActiveScene().name + "hatPosition");
|
|
|
|
|
values = savedString.Split(' ');
|
|
|
|
|
|
|
|
|
|
GameObject.Find("crown").transform.position = new Vector3(float.Parse(values[0]),float.Parse(values[1]),float.Parse(values[2]));
|
|
|
|
|
|
|
|
|
|
savedString = PlayerPrefs.GetString(SceneManager.GetActiveScene().name + "mouthPosition");
|
|
|
|
|
values = savedString.Split(' ');
|
|
|
|
|
|
|
|
|
|
GameObject.Find("gap_mouth").transform.position = new Vector3(float.Parse(values[0]),float.Parse(values[1]),float.Parse(values[2]));
|
|
|
|
|
|
2018-04-19 14:16:03 -05:00
|
|
|
|
savedString = PlayerPrefs.GetString(SceneManager.GetActiveScene().name + "nosePosition");
|
|
|
|
|
values = savedString.Split(' ');
|
|
|
|
|
|
|
|
|
|
GameObject.Find("pig_nose").transform.position = new Vector3(float.Parse(values[0]),float.Parse(values[1]),float.Parse(values[2]));
|
2018-04-25 23:16:28 -05:00
|
|
|
|
*/
|
2018-04-17 13:55:28 -05:00
|
|
|
|
}
|
|
|
|
|
}
|