private void OnTriggerEnter(Collider other) { pressureDeath pressureDeath = pressurePadBad.GetComponent <pressureDeath>(); pressureGood pressureGood = pressurePadGood.GetComponent <pressureGood>(); Renderer collideded = this.GetComponent <Renderer>(); if (collideded.material.color == Color.red) { if (pressureDeath.triggerRed == 0) { pad1.material.color = Color.grey; pad2.material.color = Color.grey; pad3.material.color = Color.grey; pad4.material.color = Color.grey; pad5.material.color = Color.grey; pad6.material.color = Color.grey; pressureDeath.triggerRed = 0; pressureGood.triggerGreen = 0; } } if (collideded.material.color == Color.green) { if (pressureGood.triggerGreen == 0) { pad1.material.color = Color.grey; pad2.material.color = Color.grey; pad3.material.color = Color.grey; pad4.material.color = Color.grey; pad5.material.color = Color.grey; pad6.material.color = Color.grey; pressureDeath.triggerRed = 0; pressureGood.triggerGreen = 0; } } }
private void OnTriggerEnter(Collider other) { pressureDeath pressureDeath = pressurePadBad.GetComponent <pressureDeath>(); pressureDeath.triggerRed = 0; triggerGreen = 1; anim.SetFloat("speed", 1); pad1.material.color = Color.red; pad2.material.color = Color.green; pad3.material.color = Color.green; pad4.material.color = Color.green; pad5.material.color = Color.red; pad6.material.color = Color.green; }
private void OnTriggerEnter(Collider other) { pressureDeath pressureDeath = pressurePadBad.GetComponent <pressureDeath>(); pressureGood pressureGood = pressurePadGood.GetComponent <pressureGood>(); Renderer collideded = this.GetComponent <Renderer>(); if (collideded.material.color == Color.red) { if (pressureDeath.triggerRed == 1) { door.SetActive(false); } } if (collideded.material.color == Color.green) { if (pressureGood.triggerGreen == 1) { door.SetActive(false); } } }