void Awake() { if (gm == null) { gm = GameObject.FindGameObjectWithTag("GM2").GetComponent <GM2>(); } }
// Update is called once per frame void Update() { if (transform.position.y < sogliaMorte) { GM2.KillPlayer2(this); } }
// Use this for initialization void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } Setup(); }
void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.tag == "Enemy") { GM2.KillPlayer2(this); } if (other.gameObject.tag == "Head" && !fine) { hitA.Play(); anim.SetBool("hitted", true); vita--; switch (vita) { case 2: Destroy(GameObject.Find("vite2")); break; case 1: Destroy(GameObject.Find("vite1")); break; case 0: Destroy(GameObject.Find("vite")); break; } if (vita > 0) { StartCoroutine(waita()); Debug.Log("waita()"); } else { Destroy(other.gameObject); GameObject pls = GameObject.Find("peachPLS"); Vector3 ppls = pls.transform.position; ppls.z = 0; pls.transform.position = ppls; GameObject audio = GameObject.Find("bosssaudio"); Destroy(audio); fine = true; Instantiate(winwin.gameObject, spawnPoint.position, spawnPoint.rotation); StartCoroutine(freeMario()); } } }
//private GameObject clonePaddle; //private GameObject cloneBalls; // Use this for initialization void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } Setup(); scene = SceneManager.GetActiveScene().buildIndex; if (scene == 1) { timer = 60f; } if (scene == 2) { timer = 0f; } }