private void OnTriggerExit2D(Collider2D other) { if (other.TryGetComponent(out DashRadius dashRadius)) { _dashRadius = null; } }
private void OnTriggerEnter2D(Collider2D other) { if (other.TryGetComponent(out DashRadius dashRadius)) { _dashRadius = dashRadius; } else if (other.CompareTag("Ground") || other.CompareTag("Wall")) { Destroy(gameObject); } }
void Awake() { _rigidbody2D = GetComponent <Rigidbody2D>(); _animator = GetComponent <Animator>(); _spriteRenderer = GetComponent <SpriteRenderer>(); _collider = GetComponent <Collider2D>(); pauseManager = FindObjectOfType <PauseManager>(); _lineRenderer = GetComponent <LineRenderer>(); dashRadius = detectionZone.GetComponent <DashRadius>(); deflectDirectionCircle.SetActive(false); SetTimeFrozen(false); freezeTimeCoroutine = FreezeTimeDuration(); freezeTimeCoroutineStopped = false; dashCooled = true; }