protected virtual void Start() { gameMenu = FindObjectOfType <GameMenu>(); gameEndText = GameObject.FindGameObjectWithTag("Finish").GetComponent <Text>(); gameEndText.gameObject.SetActive(false); hintCanvas = FindObjectOfType <HintCanvas>(); hintCanvas.HideHint(); if (PlayerPrefs.GetString(VersionKey, "") != version) { PlayerPrefs.SetInt(PlayerFirstWin, 0); PlayerPrefs.SetInt(PlayerFirstLose, 0); PlayerPrefs.SetInt(PlayerFirstTie, 0); PlayerPrefs.SetInt(AiFirstWin, 0); PlayerPrefs.SetInt(AiFirstLose, 0); PlayerPrefs.SetInt(AiFirstTie, 0); PlayerPrefs.SetString(VersionKey, version); } }
/// <summary> /// OnTriggerEnter is called when the Collider other enters the trigger. /// </summary> /// <param name="other">The other Collider involved in this collision.</param> /// <summary> /// OnTriggerStay is called once per frame for every Collider other /// that is touching the trigger. /// </summary> /// <param name="other">The other Collider involved in this collision.</param> void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Fly") { PhotonNetwork.Instantiate("Character_Water_Proof", transform.position, Quaternion.identity, 0); } if (other.gameObject.tag == "Treasure") { findTreasure = true; Debug.Log("FIND!"); } if (other.gameObject.tag == "AngelCircle") { StartCoroutine("hitAndChangeColor"); if (health > 0) { health -= 10f; } else if (dead == false) { dead = true; Invoke("Respawn", 2.0f); } } /*if (other.gameObject.name = "water(Clone)") { * water_skill = true; * } * if (other.gameObject.name = "fire(Clone)") { * lava_skill = true; * }*/ /*if (other.gameObject.tag == "Hint") { * if (Hint_Canvas != null) { * GameObject hint_panel = Hint_Canvas.transform.GetChild (0).gameObject; * hint_panel.SetActive (true); * Hint_Canvas.GetComponent<HintCanvas> ().setText ((int)(other.gameObject.GetComponent<Hint> ().pos.x), (int)(other.gameObject.GetComponent<Hint> ().pos.y)); * } * }*/ if (other.gameObject.tag == "Transport" && isTrans == false) { if (Hint_Canvas != null) { Transport trans_script = other.gameObject.GetComponent <Transport> (); if (other.gameObject.GetComponent <Transport> ().tag == 0) { HintCanvas h_script = Hint_Canvas.GetComponent <HintCanvas> (); h_script.spawn1.interactable = true; h_script.spawn2.interactable = true; h_script.spwanPoint1 = new Vector3(start_x, start_y, transform.position.z); h_script.spwanPoint2 = new Vector3(trans_script.to_pos.x, trans_script.to_pos.y, transform.position.z); } else if (other.gameObject.GetComponent <Transport> ().tag == 1) { Hint_Canvas.GetComponent <HintCanvas> ().spawn3.interactable = true; Hint_Canvas.GetComponent <HintCanvas> ().spwanPoint3 = new Vector3(trans_script.to_pos.x, trans_script.to_pos.y, transform.position.z); } else if (other.gameObject.GetComponent <Transport> ().tag == 2) { Hint_Canvas.GetComponent <HintCanvas> ().spawn4.interactable = true; Hint_Canvas.GetComponent <HintCanvas> ().spwanPoint4 = new Vector3(trans_script.to_pos.x, trans_script.to_pos.y, transform.position.z); } Hint_Canvas.transform.GetChild(0).gameObject.SetActive(true); } /*isTrans = true; * Invoke ("Trans", 3f);*/ } if (other.gameObject.tag == "Cure") { ExitGames.Client.Photon.Hashtable c = new ExitGames.Client.Photon.Hashtable(); c.Add("Cure", 1); PhotonNetwork.player.SetCustomProperties(c); } }