private void OnTriggerEnter(Collider other) { if (other.CompareTag("Portal")) { Portal = true; SongTeleport.Play(); } if (other.CompareTag("LaserRed")) { laser = true; SongLaser.Play(); Animat = true; } if (other.CompareTag("LaserGreen")) { laser = false; SongLaser.Play(); Animat = true; } if (other.CompareTag("Room")) { if (Room.rooms != rom) { if (laser && Animat) { _animator.SetTrigger("change_color"); _imageJoy.color = Color.green; number = 1; StartColor = Color.green; } else if (!laser && Animat) { _animator.SetTrigger("change_color"); _imageJoy.color = Color.red; number = 2; StartColor = Color.red; } numberlayer.Invoke(number); rom = Room.rooms; } } }
private void OnTriggerExit(Collider other) { if (other.CompareTag("OneLaserRed")) { _animator.SetTrigger("change_color"); SongLaser.Play(); _imageJoy.color = Color.green; number = 1; StartColor = Color.green; numberlayer.Invoke(number); } if (other.CompareTag("OneLaserGreen")) { _animator.SetTrigger("change_color"); SongLaser.Play(); _imageJoy.color = Color.red; number = 2; StartColor = Color.red; numberlayer.Invoke(number); } }