public void TakeDamage(float damage) { currentHealth -= damage; if (currentHealth <= 0) { Destroy(gameObject); Level_Loader load = loader.GetComponent <Level_Loader>(); load.LoadNextLevel(0, 3); } }
public static void Update() { MediaPlayer.IsRepeating = true; if (first) { MediaPlayer.Play(song); } first = false; switch (gamestate) { case "startScreen": startScreen.Update(); if (startScreen.Begin) { gamestate = "initLevel"; // <= Skipping Help } break; case "help": helpScreen.Update(); if (helpScreen.Begin) { gamestate = "initLevel"; effect.Play(); } break; case "initLevel": Level_Loader.LoadLevel(); gamestate = "level"; break; case "level": EntityHandler.Update(); Camera.Update(); //if (((GoalHandler)(EntityHandler.entities[0])).score == ((GoalHandler)(EntityHandler.entities[0])).maxScore) gamestate = "win"; break; case "die": gamestate = "initLevel"; //fail.Play(); break; case "win": //TODO: probably never, but this is where it would be impelmented break; } cursorHandler.Update(); //Level_Loader.LoadLevel(); }
void Died() { animator.SetBool("isDead", true); GetComponent <BoxCollider2D>().enabled = false; GetComponent <CircleCollider2D>().enabled = false; GetComponent <Rigidbody2D>().gravityScale = 0f; Level_Loader load = loader.GetComponent <Level_Loader>(); load.LoadNextLevel(0, 3); this.enabled = false; }