/// <summary> /// Sent each frame where another object is within a trigger collider /// attached to this object (2D physics only). /// </summary> /// <param name="other">The other Collider2D involved in this collision.</param> void OnTriggerEnter2D(Collider2D other) { var damageable = other.gameObject.GetComponent <IDamageable>(); if (damageable == null) { return; } OnAttackHit?.Invoke(this, new AttackHitEventArgs() { Damageable = damageable }); }
// Start is called before the first frame update new void Start() { _stepParticleRenderer = StepSnow.gameObject.GetComponent <ParticleSystemRenderer>(); //OnChangeLineEnd.AddListener(ChangeSortingLayer); #if UNITY_ANDROID OnAttackHit.AddListener(() => { if (GameData.Instance.VibrationStatus) { Handheld.Vibrate(); } }); #endif GameController.Instance.OnGameModeChanged.AddListener(OnGameModeChanged); base.Start(); if (HelpControl.helpControl != null) { FinishHelp += HelpControl.helpControl.Move; } _animator.SetBool("IsIdle", false); }