void ChangeColor() { if (polarity == Definitions.Polarity.Negative) { polarity = Definitions.Polarity.Positive; nucleusRender.material = _positive_core_material; var mats1 = shellRender [0].materials; var mats2 = shellRender [2].materials; mats1 [0] = _positive_shell_material; mats2 [1] = _positive_shell_material; for (int i = 0; i < 6; i++) { shellRender [i].materials = (i != 2 ? mats1 : mats2); } } else { polarity = Definitions.Polarity.Negative; nucleusRender.material = _negative_core_material; var mats1 = shellRender [0].materials; var mats2 = shellRender [2].materials; mats1 [0] = _negative_shell_material; mats2 [1] = _negative_shell_material; for (int i = 0; i < 6; i++) { shellRender [i].materials = (i != 2 ? mats1 : mats2); } } }
private void OnTriggerEnter(Collider other) { if (other.tag.Equals("Bullet")) { Polarity = other.gameObject.GetComponent <BulletBehaviour>().Polarity; Destroy(other.gameObject); } }