private void OnTriggerEnter2D(Collider2D _collider) { // Debug.LogError(_collider.gameObject.name); if (_collider.CompareTag("GravitationField")) { // Changes active buttons on GUI if it enters a planet PlayerInOrbit(); isOnGravitationField = true; } if (_collider.CompareTag("ShootZone")) { PlanetWeapon weapon = _collider.GetComponent <PlanetWeapon>(); weapon.SetTarget(transform); } }
void OnTriggerExit2D(Collider2D _collider) { if (_collider.CompareTag("GravitationField")) { // Changes active buttons on GUI if it goes out of a planet PlayerInOrbit(); UpdateButton(); if (atractorRayComponent.IsAlienRayOn) { ToggleShipRay(); } isOnGravitationField = false; } if (_collider.CompareTag("ShootZone")) { PlanetWeapon weapon = _collider.GetComponent <PlanetWeapon>(); weapon.SetTarget(null); } }