using UnityEngine;
using System.Collections;

public class CharacterIcons : MonoBehaviour {

    public Texture2D[] m_enemyTextures;
    public Texture2D m_playerTexture;

    public static CharacterIcons ms_instance;
    public static CharacterIcons Instance
    {
        get { return ms_instance; }
    }

	// Use this for initialization
	void Start () {

        if (ms_instance != null)
        {
            Debug.LogError("Only one charicons allowed");
        }
        ms_instance = this;

	}

    void ApplyIcon( Transform trans, Texture2D tex )
    {
        trans.renderer.material.mainTexture = tex;
    }

    public void ApplyPlayerIcon(Transform trans)
    {
        ApplyIcon(trans, m_playerTexture);
    }

    public void ApplyEnemyIcon(Transform trans, int index)
    {
        if ( index >= m_enemyTextures.Length )
        {
            Debug.LogError( "Bad enemy icon index" + index );
            return;
        }

        ApplyIcon(trans, m_enemyTextures[index]);
    }
	
	// Update is called once per frame
	void Update () {
	
	}
}
