void Update()
    {
        //die without checkPoint
        if (gameController.getLife() <= 0 && !gameController.getcheckPointController())
        {
            StartCoroutine(FadeTransition());
        }
        //die with checkpoints
        else if (gameController.getLife() <= 0 && gameController.getcheckPointController())
        {
            StartCoroutine(RespawnCheckPoint());
        }

        animator.SetBool("Fade", fade);
    }
Ejemplo n.º 2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        switch (collision.gameObject.tag) //switch for terrain effects
        {
        case "darkness":

            moveReduction = darkness;
            break;

        case "thickWeed":

            moveReduction = thickWeed;
            break;

        case "surfaceWater":

            moveReduction = surfaceWater;
            break;

        case "midiumWater":

            moveReduction = midiumWater;
            break;

        case "deepWater":

            moveReduction = deepWater;
            break;

        case "ice":
            gameController.setfreezeCamera(true);
            ice = true;
            if (!directionIce)
            {
                rb.AddForce(new Vector2(iceForce, 0), ForceMode2D.Impulse);
            }
            else if (directionIce)
            {
                rb.AddForce(new Vector2(-iceForce, 0), ForceMode2D.Impulse);
            }
            blockDirectionIce = true;

            break;

        case "fire":
            insideFire = true;
            break;

        case "brambles":
            insideBrambles = true;
            break;

        case "bonesplinters":
            gameController.setLife(boneSplintersDamage);
            print(gameController.getLife());
            break;
        }
        if (collision.gameObject.tag == "Enemy" && collision.gameObject.GetComponent <EnemyController>().playerDetected == true)
        {
            print("mueres");
            gameController.setLife(100);
        }
    }