private void OnTriggerEnter(Collider col) { if (col.CompareTag("Ball")) { // If ball enters the gravity shield trigger, change gravity by specified Vector3 _alphaLevelManager.GravityChange(gravityChange); // Play gravity enter sound AudioManager.Instance.Play("ShieldEnter"); } }
private void OnTriggerEnter(Collider col) { if (col.CompareTag("Ball")) { if (!_isGravityChanged) { // Toggle bool if gravity can change back by passing through this shield if (_canChangeBackGravity) { _isGravityChanged = true; } // Turn off gravity if ball hasnt already passed through the shield _alphaManager.GravityChange(Vector3.zero); } else if (_canChangeBackGravity) { _isGravityChanged = false; // Turn pn gravity if ball has already passed through the shield _alphaManager.GravityChange(_originalGravity); } } }