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

[System.Serializable]
public class StarShip {
	public enum Type {
		hero,
		small,
		medium,
		big
	}
	public int HitPoints { get; private set;}
	public int MaxHitPoints { get; private set;}
	public Type HullType { get; private set;}
	public List<string> Drop { get; private set;}

	public bool IsAlive {
		get {
			return HitPoints > 0;
		}
	}

	public StarShip(StarShipConfig config, List<string> drop = null) {
		HullType = config.Type;
		HitPoints = config.HitPoints;
		MaxHitPoints = config.HitPoints;
		Drop = drop ?? new List<string>();
	}

	public StarShip(Type type = Type.medium, int hp = 100) {
		HullType = type;
		HitPoints = hp;
		MaxHitPoints = hp;
	}

	public void Hit(int damage) {
		HitPoints -= damage;
		if (!IsAlive) {
			Destroy ();
		}
	}

	private void Destroy() {
		Debug.Log ("Destroy");
	}
}
