Ejemplo n.º 1
0
    private void OnTriggerEnter(Collider other)
    {
        DamagableTower DT = other.GetComponent <DamagableTower>();

        if (DT != null)
        {
            _targets.Add(other.gameObject);
        }
    }
    private void CalculateLevelResults()
    {
        float hpSum = 0;
        float hpMax = 0;

        for (int i = 0; i < _towers.Length; i++)
        {
            DamagableTower da = _towers[i].GetComponent <DamagableTower>();
            hpSum += da.CurrHealth;
            hpMax += da.MaxHealth;
        }
        DamagableTower dab = _mainBase.GetComponent <DamagableTower>();

        hpSum += dab.CurrHealth;
        hpMax += dab.MaxHealth;

        float part       = hpSum / hpMax;
        int   starsCount = part <0.33f ? 1 : part> 0.66f ? 3 : 2;

        if (_levelResults.LevelResultsList[_currLevelResultIndex].StarsCount < starsCount)
        {
            _levelResults.LevelResultsList[_currLevelResultIndex].StarsCount = starsCount;
        }
    }
Ejemplo n.º 3
0
 private void OnDestroyTarget(DamagableTower damagableTower)
 {
     SetNewTarget(GameManager.Instance.GetNearestTower(gameObject.transform.position));
 }
 private void OnBaseDie(DamagableTower damagableTower)
 {
     CanvasManager.Instance.GameOverScreen();
 }