예제 #1
0
 public void TakeDamage(float damage)
 {
     currentHealth -= damage;
     if (currentHealth <= 0)
     {
         Destroy(gameObject);
         Level_Loader load = loader.GetComponent <Level_Loader>();
         load.LoadNextLevel(0, 3);
     }
 }
예제 #2
0
        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();
        }
예제 #3
0
    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;
    }