using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using UnityEngine;
using System;

public class StorageModule : ContainerModule {

	public StorageModule(JObject json) : base(json) {
		icon = Resources.Load("Sprites/Modules/Icons/Storage/" + getUniqueName(), typeof(Sprite)) as Sprite;
		silhouette = Resources.Load("Sprites/Modules/Silhouettes/Storage/" + getUniqueName(), typeof(Sprite)) as Sprite;
	}

	override public bool canStore(Class unitClass) {
		return true;
	}

	public static StorageModule[] loadModules(string[] filenames) {
		Array.Sort(filenames);
		StorageModule[] array = new StorageModule[filenames.Length];

		for (int i = 0; i < filenames.Length; i++) {
			array[i] = new StorageModule(jsonFromFile(filenames[i]));
		}

		return array;
	}

	override public void updateClasses() {
	}

	override public ModuleData getData(int parent, float angleOffset, Vector position) {
		return new StorageModuleData(parent, this, position);
	}
}

public class StorageModuleData : ContainerModuleData {
	
	public StorageModuleData(int parent, Module template, Vector position) : base(parent, template, position) {
	}
}