Exemple #1
0
        public override void Kill(Transform source)
        {
            if (IsDead || DeathMove.Active)
            {
                return;
            }

            // Bring the player to the front
            var spriteRenderer = Controller.RendererObject.GetComponent <SpriteRenderer>();

            if (spriteRenderer != null)
            {
                spriteRenderer.sortingLayerName = "Foreground";
            }

            DeathMove.Perform();
            DeathMove.OnEnd.AddListener(OnDeathEnd);

            if (DeathSound != null)
            {
                SoundManager.Instance.PlayClipAtPoint(DeathSound, transform.position);
            }

            base.Kill(source);
        }