using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LaundryRoom : MonoBehaviour
{
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "kid")
        {
            GameManager.instance.Lives--;
            GameManager.instance.KidsAlive--;
            //Destroy(other.gameObject);
            if (GameManager.instance.Lives <= 0)
            {
                GameManager.instance.SwitchState(new GameOver() { Won = false });
                return;
            }
            if(GameManager.instance.KidsAlive <= 0)
            {
                if (++GameManager.instance.Period == GameManager.instance.KidsInWave.Count)
                {
                    GameManager.instance.SwitchState(new GameOver() { Won = true });
                    print("Yo");
                }
                else
                {
                    GameManager.instance.SwitchState(new TransitionPhase() { Cooldown = GameManager.instance.TimeBetweenWaves });
                }
            }
        }
    }
}
