IEnumerator Teleport() { this.GetComponent <BoxCollider>().enabled = false; rb.useGravity = false; material.color = new Color(material.color.r, material.color.g, material.color.b, 0.5f); //Teleport Duration yield return(new WaitForSeconds(properties.teleportDuration)); this.GetComponent <BoxCollider>().enabled = true; rb.useGravity = true; material.color = new Color(material.color.r, material.color.g, material.color.b, 1.0f); ColorChange cc = FindObjectOfType <ColorChange>(); cc.ChangeColor(properties.telePUColor); cc.BordersEnabled(false); }
private void OnTriggerEnter(Collider other) { Instantiate(ps, this.transform); ColorChange cc = FindObjectOfType <ColorChange>(); cc.BordersEnabled(true); if (this.tag == "TelePU") { cc.ChangeColor(properties.telePUColor); properties.teleActivated = true; } else if (this.tag == "JumpPU") { cc.ChangeColor(properties.jumpPUColor); properties.jumpActivated = true; } this.GetComponent <MeshRenderer>().enabled = false; Destroy(this.gameObject, 2.0f); }