using UnityEngine;

public class GatherHumansForVictory : MonoBehaviour 
{
    public float Interval = 0.6f;
	void Start () 
	{
        float x = 0;

        foreach (GameObject go in GameObject.FindGameObjectsWithTag("Human"))
        {
            go.transform.position = transform.position + new Vector3(x, 0, 0);
            x += Interval;

            if (Random.Range(0f, 1f) > .5f)
                go.transform.localScale = new Vector3(-1, 1, 1);
        }
    }

    void OnDestroy()
    {
        foreach (GameObject go in GameObject.FindGameObjectsWithTag("Human"))
        {
            HumanControl.RemoveHuman(go.transform);
            DestroyImmediate(go);
        }
    }

}
