// Update is called once per frame void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "VillageTag") { OpenWorldController.mySave(0, 1, 0); if (Application.CanStreamedLevelBeLoaded("Village Management")) { GameControl.control.PlayBgm4(); Application.LoadLevel("Village Management"); } } else if (other.gameObject.tag == "EnemyTag") { GameControl.control.openWorldData.enemyType = 1; Debug.Log(other.name); OpenWorldController.mySave(1, 0, 0); if (Application.CanStreamedLevelBeLoaded("BoxCombat")) { GameControl.control.PlayBgm3(); Application.LoadLevel("BoxCombat"); } } else if (other.gameObject.tag == "FriendTag") { MeetFriend(); } else if (other.gameObject.tag == "NeutralTag") { MeetNeutral(); } }
void MeetNeutral() { Debug.Log("MeetNeutral"); if (!GameControl.control.openWorldData.neutral1.isEnemy) { //teleport player GameObject player = GameObject.FindGameObjectWithTag("Player"); //switch camera mainCamera.SetActive(false); neutralCamera.SetActive(true); //teleport player player.transform.position = trapPoint.transform.position; //reinitialize panels neutralPanel1.SetActive(false); neutralPanel2.SetActive(false); neutralPanel3.SetActive(false); neutralPanel1.SetActive(true); } else { GameControl.control.openWorldData.enemyType = 2; OpenWorldController.mySave(0, 0, 1); if (Application.CanStreamedLevelBeLoaded("BoxCombat")) { GameControl.control.PlayBgm3(); Application.LoadLevel("BoxCombat"); } } }
public void Save() { if (Application.loadedLevel == 2) { OpenWorldController.mySave(0, 0, 0); } BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(Application.persistentDataPath + "/playerInfo.dat"); bf.Serialize(file, playerData); file.Close(); file = File.Create(Application.persistentDataPath + "/openWorldInfo.dat"); bf.Serialize(file, openWorldData); file.Close(); file = File.Create(Application.persistentDataPath + "/villageInfo.dat"); bf.Serialize(file, villageData); file.Close(); }