Ejemplo n.º 1
0
    void SplitEnemy()
    {
        Vector3 tmpVec = transform.position;

        Instantiate(deathEffect, tmpVec, Quaternion.identity);
        AudioSource.PlayClipAtPoint(deathSound, tmpVec);

        enemiesScript.CreateNewEnemies();
        //Give coins to the Player
        GameManager.instance.AddCoins(coins);

        health             = GameManager.instance.currentEnemyHealth; //reset the health
        transform.position = enemiesScript.startPosition.position;    //reset the position

        gameObject.GetComponent <SpriteRenderer>().color = new Color(1f, 1f, 1f);
        if (GameManager.instance.choosenEnemy != null &&
            GameManager.instance.choosenEnemy.name == gameObject.name)
        {
            GameManager.instance.SetChoosenEnemy(null);
        }

        SetNextGoal(0);
    }