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

namespace Onward.CustomContent.Assets
{
    public class ObjectiveOpHunt : Objective
    {
        public override void Validate()
        {
            // Rules are different for this objective.
            //base.Validate();

            ValidateSpawnSystemEntries(ref AttackingTeamSpawns, gameObject);
            ValidateSpawnSystemEntries(ref DefendingTeamSpawns, gameObject);

            if (DefendingTeamSpawns.Length > 0)
            {
                DefendingTeamSpawns = new SpawnSystem[] { };

#if UNITY_EDITOR
                UnityEditor.EditorUtility.SetDirty(this);
                UnityEditor.EditorUtility.SetDirty(gameObject);
#endif

                throw new ContentExceptionWithGameObject(gameObject, "Defending team must not have spawns, clearing. Please rebuild.");
            }

            if (AttackingTeamSpawns.Length <= 0)
                throw new ContentExceptionWithGameObject(gameObject, "No spawns for attacking team.");
        }
    }
}