Ejemplo n.º 1
0
    public void RestartGame()
    {
        isRestarting  = true;
        isPaused      = false;
        wallDestroyed = false;

        gameOverTextOBJ.SetActive(false);
        WallCount wallCount = FindObjectOfType <WallCount>();

        wallCount.wallCounts = 40;
        StartCoroutine(restartCountDown());
        UnPauseGame();
        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
        //isRestarting = false;
    }
Ejemplo n.º 2
0
    public void DamageWall(int damageAmount, string damageType)
    {
        if (damageType == "blue" && blueHP > 0)
        {
            blueHP -= 10;
        }
        else if (damageType == "red" && redHP > 0)
        {
            redHP -= 10;
        }

        //wallHP -= damageAmount;
        if (blueHP == 0 && !wallCounted)
        {
            //print("Block is blue!!");
            Instantiate(blueWall, transform.position, transform.rotation);
            if (!wallCounted)
            {
                WallCount wallCount = GetComponentInParent <WallCount>();
                wallCount.removeWall();
                wallCounted = true;
            }
            Destroy(gameObject);
            //broadcast message to all children to delete all of their children and turn to specific color
        }
        else if (redHP == 0 && !wallCounted)
        {
            //print("Block is red!!");
            Instantiate(redWall, transform.position, transform.rotation);
            if (!wallCounted)
            {
                WallCount wallCount = GetComponentInParent <WallCount>();
                wallCount.removeWall();
                wallCounted = true;
            }
            Destroy(gameObject);
        }
    }