Ejemplo n.º 1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (!homing && collision.gameObject.tag == "Goal" && dude.isAlive && !dude.IsAttachedOrGrabbed())
        {
            dude.canDie       = false;
            dude.canGrab      = false;
            homing            = true;
            goalPos           = collision.gameObject.transform.position;
            body.gravityScale = 0f;

            Invoke("DoSuccess", 2f);
            GameManager.Instance.running = false;

            AudioManager.Instance.PlayEffectAt(21, transform.position, 1.48f);
            AudioManager.Instance.PlayEffectAt(27, transform.position, 0.259f);
            AudioManager.Instance.PlayEffectAt(39, transform.position, 1.205f);
            AudioManager.Instance.PlayEffectAt(33, transform.position, 1.444f);

            AudioManager.Instance.PlayEffectAt(Random.Range(63, 70), transform.position, 2f);

            if (!isIntro)
            {
                AudioManager.Instance.Lowpass();
            }

            if (isIntro)
            {
                Invoke("ToStart", 3f);
            }
        }
    }
Ejemplo n.º 2
0
    bool CanGrab(GameObject go, Collider2D col)
    {
        if (go.tag == "MultiBlock")
        {
            multiBlock = go.GetComponentInChildren <MultiBlock>();
            grabDir    = col.name;
            multiBlock.Activate(col.name);
            return(true);
        }

        if (go.tag == "Block" || go.tag == "Slippery" && dude.IsAttachedOrGrabbed())
        {
            Block block = go.GetComponent <Block>();
            if (!dude.HasActivated(block))
            {
                dude.ActivateBlock(block);
                block.Activate();
            }
            return(true);
        }

        if (go.tag == "Limb" && go.transform.parent != transform.parent)
        {
            var d = go.GetComponentInParent <Dude>();
            if (d && d.isAlive)
            {
                d.GetGrabbed();
            }

            return(true);
        }

        return(false);
    }