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

namespace Onward.CustomContent.Assets
{
    public class Spawnpoint : Entity
    {
        public override void Validate()
        {
            base.Validate();

            SpawnSystem spawnSys = GetComponentInParent<SpawnSystem>();

            if (spawnSys == null)
            {
                throw new ContentExceptionWithGameObject(gameObject, "Spawn point must be parented to a SpawnSystem.");
            }
        }

#if UNITY_EDITOR
        public void OnDrawGizmos()
        {
            Gizmos.color = Color.green;
            Gizmos.DrawWireSphere(transform.position, 0.5f);

            const float LineLength = 0.75f;

            Gizmos.color = Color.white;
            Gizmos.DrawLine(transform.position, transform.position + Vector3.forward * LineLength);

            Util.RenderDownwardsLine(transform.position);
        }
#endif
    }
}