Example #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.GetComponent <InteractableBlocks>())
        {
            InteractableBlocks block = collision.GetComponent <InteractableBlocks>();

            switch (block.type)
            {
            case BlockType.Hidden:
                if (playerRigid.velocity.y > 0)
                {
                    if (!hasInteractedHidden)
                    {
                        hasInteractedHidden = true;
                        HiddenBlock hidden = collision.GetComponent <HiddenBlock>();
                        hidden.Interacted();
                        block.Interacted(player.isGrown);
                        StartCoroutine(hiddenReset());
                    }
                }
                break;

            default:
                block.Interacted(player.isGrown);
                break;
            }
        }
        player.ResetJump();
    }
Example #2
0
 private void Start()
 {
     blocks = GetComponent <InteractableBlocks>();
 }