Exemplo n.º 1
0
    void OnTriggerEnter2D(Collider2D enter)
    {
        if (enter.tag == "Player" && !popup.helpStatus)
        {
            popup.gameObject.SetActive(true);
        }



        if (enter.tag == "mouth")
        {
            DoorLadder temp = enter.GetComponent <DoorLadder>();
            if (temp.movingUp && playerMoveDown && !playerMoveUp)
            {
                //Debug.Log("Delete ladder");
                isClimb         = false;
                notmovetoLadder = false;
                playerMoveDown  = false;
                playerMoveUp    = false;
                isFindladder    = false;
                currentladder   = null;
            }
            else if (!temp.movingUp && !playerMoveDown && playerMoveUp)
            {
                currentladder = null;
            }
        }
    }
    void OnTriggerEnter2D(Collider2D e)
    {
        if (e.tag == "mouth")
        {
            DoorLadder temp = e.GetComponent <DoorLadder>();
            if (temp.movingUp && enemyMoveDown && !EnemyMoveup)
            {
                isClimb = false;
                //checkInsideLadder = false;
                enemyMoveDown = false;
                EnemyMoveup   = false;
                isFindladder  = false;
                currentladder = null;
            }
            else if (!temp.movingUp && !enemyMoveDown && EnemyMoveup)
            {
                currentladder = null;
            }
            if (temp.movingUp && !isAttackEnemy && isClimb)
            {
                Debug.Log("stop climbing");
                isClimb                  = false;
                currentladder            = null;
                rigidbody2D.gravityScale = 0.34f;
                rigidbody2D.isKinematic  = false;
            }
            if ((!temp.movingUp || temp.movingUp) && (originalDown || !originalUp) && (!originalDown || originalUp))
            {
                findladderforgetback = false;
            }
            //go to door case

            /*else if(goToDoorFromLadder == true){
             *  currentladder = null;
             * }*/
        }

        if ((e.tag == "Door") && !isAttackEnemy && Application.loadedLevelName != spawnScreen)
        {
            Destroy(gameObject);
        }
    }