public void OnKinCharacterDeath(RaycastHit hitInfo)
        {
            // Already dying
            if (CurrentCharacterState == CharacterState.Dying)
            {
                return;
            }

            if (Math.Abs(hitInfo.point.z - transform.position.z) > 0)
            {
                Debug.Log("HitFront: " + hitInfo.point + " " + transform.position);
                HitFront = true;
            }
            else
            {
                Debug.Log("HitBack: " + hitInfo.point + " " + transform.position);
                HitFront = false;
            }

            // Decrease life count
            OnUpdateHUDLives?.Invoke(-1);

            // Reset the level
            OnResetLevel?.Invoke();

            TransitionToState(CharacterState.Dying);
        }
예제 #2
0
        private IEnumerator WaitForAnimationToEnd()
        {
            OnDie?.Invoke();
            RigidBody2D.velocity = Vector2.zero;
            yield return(new WaitForSeconds(1.67f));

            OnResetLevel?.Invoke();
            ResetPlayer();
        }