Example #1
0
    public void CompleteWin()
    {
        //SoundManager.instance.PlaySingle(winClip, true);
        //cam.GetComponent<Animator>().SetTrigger("Win");
        camAnimator.SetTrigger("Win");

        if (movesMade <= mainController.GetCurrentLevel().levelLimits[0])
        {
            Debug.Log("Win " + 3);
            winPanel.Win(3, mainController.GetCurrentLevel().levelRewards[0]);
            mainController.SetLevelProgress(3, mainController.GetCurrentLevel().levelRewards[0]);
        }
        else if (movesMade <= mainController.GetCurrentLevel().levelLimits[1])
        {
            Debug.Log("Win " + 2);
            winPanel.Win(2, mainController.GetCurrentLevel().levelRewards[1]);
            mainController.SetLevelProgress(2, mainController.GetCurrentLevel().levelRewards[1]);
        }
        else if (movesMade <= mainController.GetCurrentLevel().levelLimits[2])
        {
            Debug.Log("Win " + 1);
            winPanel.Win(1, mainController.GetCurrentLevel().levelRewards[2]);
            mainController.SetLevelProgress(1, mainController.GetCurrentLevel().levelRewards[2]);
        }
        // Save last played pack/level
        mainController.SaveLastPlayedLevel();
    }
Example #2
0
    public void Damage(int damage)
    {
        health += damage;
        // AdjustSize ();

        if (health <= 1)
        {
            if (cells.Contains(this))
            {
                cells.RemoveAt(cells.IndexOf(this));
            }
            for (int i = 0; i < diseases.Count; i++)
            {
                Disease.diseases--;
            }
            if (cells.Count < 1)
            {
                WinPanel.Win();
            }
            print("Cell death");
            Util.CheckForGameOver();
            Destroy(gameObject);
            DiseaseButton.AddDisease();
            return;
        }

        CalculateScale();
    }