private void PickingUp()
    {
        others.RemoveAll(item => item == null);

        // Disable children, disabling the whole game object would disable the audio too
        foreach (Transform child in transform)
        {
            child.gameObject.SetActive(false);
        }

        foreach (Collider other in others)
        {
            KeycardInventory inventory = other.GetComponent <KeycardInventory>();
            if (inventory != null)
            {
                inventory.AddKeycard(this);
            }
        }
    }
Exemple #2
0
    public void CloneDeath()
    {
        cloningController.platformactivated = false;
        GameManager.Instance.clones.Remove(this.gameObject);
        GameManager.audioPlayer.ElectricShock();

        KeycardInventory inventory = GetComponent <KeycardInventory>();

        if (inventory != null)
        {
            KeycardInventory playerInventory = GameManager.Instance.player.GetComponent <KeycardInventory>();
            foreach (Keycard card in inventory.keycards)
            {
                if (!playerInventory.HasKeycard(card.keycardId))
                {
                    card.Reset();
                }
            }
        }

        animator.SetBool("Death", true);
        GetComponent <CloneController>().alive = false;
        StartCoroutine(DeathCoroutine());
    }