private bool ConnectExists(FormationData.Connection _connection)
    {
        bool exists = false;

        foreach (FormationData.Connection connection in Formation.Connections)
        {
            if (connection.Equals(_connection))
            {
                Formation.Connections.Remove(connection);
                return(true);
            }
        }

        return(exists);
    }
    public void ActivateZone(FormationZone _zone)
    {
        if (_zone.Zone == Zone.OwnGoal)
        {
            Debug.LogWarning("Cannot remove Goal Keeper position");
            return;
        }

        if (formationZones.Contains(_zone.Zone))
        {
            formationZones.Remove(_zone.Zone);
            _zone.Deactivate();

            List <FormationData.Connection> list = new List <FormationData.Connection>(Formation.Connections);

            for (int i = 0; i < list.Count; i++)
            {
                FormationData.Connection connection = list[i];
                if (connection.ZoneA == _zone.Zone || connection.ZoneB == _zone.Zone)
                {
                    list.RemoveAt(i);
                }
            }

            Formation.Connections = list;
            UpdateConnections();
            return;
        }

        if (formationZones.Count == 11)
        {
            Debug.LogWarning("Cannot have more than 11 active zones");
        }
        else
        {
            formationZones.Add(_zone.Zone);
            _zone.Activate(true);
        }
    }
    public void Connect(FormationZone zone)
    {
        if (SelectedZone == null)
        {
            Debug.LogWarning("Select a zone first");
        }
        else if (zone == SelectedZone)
        {
            Debug.LogWarning("Cannot connect zone to itself");
        }
        else
        {
            FormationData.Connection connection = new FormationData.Connection(SelectedZone.Zone, zone.Zone);

            if (!ConnectExists(connection))
            {
                Formation.Connections.Add(connection);
            }
        }

        UpdateConnections();
    }