Пример #1
0
        /// <summary>
        /// Kill the player.
        /// </summary>
        public void Die()
        {
            Instantiate(
                player.EffectsSettings.DeathEffect,
                player.Physics.Position,
                Quaternion.identity
                );

            playerSprite.enabled = false;

            TransitionManager.Wipe();

            player.Physics.Disable();

            if (player.CarriedItem != null)
            {
                player.CarriedItem.OnPutDown();
            }

            player.EndInteraction();

            player.DisableCrouch(this);
            player.DisableJump(this);
            player.DisableMove(this);

            isDead = true;
        }
Пример #2
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Player"))
     {
         player = other.GetComponent <PlayerCharacter>();
         player.DisableJump(this);
     }
 }
Пример #3
0
        //-------------------------------------------------------------------------
        // Unity API
        //-------------------------------------------------------------------------

        private void OnEnable()
        {
            BoxCollider2D col = GetComponent <BoxCollider2D>();

            Collider2D[] hits = Physics2D.OverlapBoxAll(col.bounds.center, col.bounds.size, 0);
            foreach (var hit in hits)
            {
                if (hit.CompareTag("Player"))
                {
                    player = hit.GetComponent <PlayerCharacter>();
                    player.DisableJump(this);
                }
            }
        }