Beispiel #1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.GetComponent <PlatformerCharacter2D> () == null)
        {
            return;
        }

        Collectables.AddPoints(pointsToAdd);
        NutSoundEffect.Play();
        Destroy(gameObject);
    }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        if (HP <= 0)
        {
            Collectables.AddPoints(pointsOnDeath);
            Destroy(gameObject);

            if (gameObject.name == "Jarbas")
            {
                Application.LoadLevel(mainMenu);
            }
        }
    }
    public IEnumerator RespawnPlayerCoroutine()
    {
        player.transform.position = CheckPoint.transform.position;
        player.enabled            = false;
        player.GetComponent <Renderer> ().enabled      = false;
        player.GetComponent <BoxCollider2D> ().enabled = false;
        camera.isFollowing = false;
        Collectables.AddPoints(-penalty);
        yield return(new WaitForSeconds(2));

        Application.LoadLevel(GameOver);
        //Debug.Log ("Player Respawn");
        //yield return new WaitForSeconds (RespawnDelay);
        //player.transform.position = CheckPoint.transform.position;
        //player.enabled = true;
        //player.GetComponent<Renderer> ().enabled = true;
        //player.GetComponent<BoxCollider2D> ().enabled = true;
        //camera.isFollowing = true;
    }