private void OnTriggerEnter2D(Collider2D outro) { if (outro.gameObject.tag == "MiraPlayer02") { outro.GetComponent <SpriteRenderer>().color = Color.green; Mira2 p = outro.GetComponent <Mira2>(); p.velocidade = 1.5f; StartCoroutine("Delay"); colidiu = true; } }
private void OnTriggerExit2D(Collider2D outro) { if (outro.gameObject.tag == "MiraPlayer02") { outro.GetComponent <SpriteRenderer>().color = Color.white; Mira2 p = outro.GetComponent <Mira2>(); p.velocidade = 3.5f; StopCoroutine("Delay"); colidiu = false; } }
// Start is called before the first frame update void Start() { cm = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>(); cm2 = GameObject.FindGameObjectWithTag("MainCamera2").GetComponent <Camera>(); miraP01 = GameObject.FindGameObjectWithTag("MiraPlayer01").GetComponent <Mira>(); miraP02 = GameObject.FindGameObjectWithTag("MiraPlayer02").GetComponent <Mira2>(); player = GameObject.FindGameObjectWithTag("Player01"); player2 = GameObject.FindGameObjectWithTag("Player02"); playerScript = GameObject.FindGameObjectWithTag("Player01").GetComponent <Player>(); playerScript2 = GameObject.FindGameObjectWithTag("Player02").GetComponent <Player2>(); }
// Start is called before the first frame update void Start() { canvas.SetActive(false); player01 = GameObject.FindGameObjectWithTag("Player01").GetComponent <Player>(); miraPlayer01 = GameObject.FindGameObjectWithTag("MiraPlayer01").GetComponent <Mira>(); camera1 = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>(); player02 = GameObject.FindGameObjectWithTag("Player02").GetComponent <Player2>(); miraPlayer02 = GameObject.FindGameObjectWithTag("MiraPlayer02").GetComponent <Mira2>(); camera2 = GameObject.FindGameObjectWithTag("MainCamera2").GetComponent <Camera>(); }