void Update() { //If E is pressed, see daily, if (Input.GetKeyDown(KeyCode.E) & objetoMueres == true) { gameController.setLife(100f); } }
IEnumerator FadeTransition() { //reset life gameController.setLife(-100); //Stop fps Time.timeScale = 0; //Fade ON fade = true; yield return(new WaitForSecondsRealtime(timeToFade)); //new position of player and camera is the gameobject startPosition player.transform.position = new Vector3(transform.position.x, transform.position.y, 0); Camera.main.transform.position = new Vector3(transform.position.x, transform.position.y + correctionCameraHeight, -10); //Return fps Time.timeScale = 1; //Fade OFF fade = false; }
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); } }