Beispiel #1
0
    public static void KillCitizen(bool hasFinished)
    {
        if (!IsAlive)
        {
            return;
        }

        instance.activeCitizenCount--;

        if (hasFinished)
        {
            instance.hitpointCount--;

            if (OnCitizenFinished != null)
            {
                OnCitizenFinished.Invoke();
            }

            if (instance.hitpointCount == 0)
            {
                instance.isPlaying = false;

                if (OnGameOver != null)
                {
                    OnGameOver.Invoke();
                }

                return;
            }
        }

        if (instance.activeCitizenCount == 0)
        {
            instance.isPlaying = false;

            instance.treeBatches[instance.currentWaveIndex - 1].FadeOut();

            instance.houseBatches[instance.currentWaveIndex - 1].SetActive(true);

            instance.pavements[instance.currentWaveIndex - 1].SetActive(true);

            if (OnWaveEnded != null)
            {
                OnWaveEnded.Invoke();
            }

            if (!HasWavesLeft)
            {
                if (OnGameOver != null)
                {
                    OnGameOver.Invoke();
                }
            }
        }
    }
Beispiel #2
0
    public static void Damage()
    {
        if (!IsAlive)
        {
            return;
        }

        instance.hitpointCount--;

        if (OnCitizenFinished != null)
        {
            OnCitizenFinished.Invoke();
        }

        if (instance.hitpointCount == 0)
        {
            instance.isPlaying = false;

            if (OnGameOver != null)
            {
                OnGameOver.Invoke();
            }
        }
    }