using UnityEngine;
using System.Linq;
using System.Collections;
using Gamelogic.Grids2;

public class SpawnRandomMonster : MonoBehaviour {
    public int MinDistFromPlayerSpawn=4;
    public int ActivateAtDepth = 1;

	void Start () 
    {
        if (ActivateAtDepth > GameController.CurrentDepth)
            return;

        Transform monprefab = MonsterLibrary.instance.GetMonsterPrefab();
        GridPoint2 spawn = new GridPoint2(9,1);
        GridPoint2 pos = ListHelper.DrawFromAtRandom(
            GameMap.instance.Grid.Points
            .Where(p => PointyHexPoint.HexNorm(spawn - p) >= MinDistFromPlayerSpawn)
            .Where(q => GameMap.Available(q))
            .ToList());

        SpawnActor.SpawnPrefabAt(monprefab, pos);
	}
	

}
