- visual update on riftraids - ability unlock system through ability tomes - (possible) bugfix sprite issue - player reputation level
60 lines
1.3 KiB
C#
60 lines
1.3 KiB
C#
using Kryz.CharacterStats.Examples;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class SpriteIndexer : MonoBehaviour
|
|
{
|
|
#region Singleton
|
|
private static SpriteIndexer _instance;
|
|
|
|
// Public reference to the singleton instance
|
|
public static SpriteIndexer Instance
|
|
{
|
|
get
|
|
{
|
|
return _instance;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
public List<Sprite> Sprites = new List<Sprite>();
|
|
|
|
public Sprite GetSpriteByName(string name)
|
|
{
|
|
for (int i = 0; i < Sprites.Count; i++)
|
|
{
|
|
if (Sprites[i].name == name)
|
|
return Sprites[i];
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
protected void Awake()
|
|
{
|
|
// Ensure there's only one instance
|
|
if (_instance != null && _instance != this)
|
|
{
|
|
Destroy(gameObject);
|
|
return;
|
|
}
|
|
|
|
// If this is the first instance, set it as the singleton
|
|
_instance = this;
|
|
DontDestroyOnLoad(gameObject);
|
|
}
|
|
/*
|
|
private void OnValidate()
|
|
{
|
|
if (Sprites == null) return;
|
|
|
|
foreach (Sprite item in Resources.LoadAll<Sprite>("Icons/"))
|
|
{
|
|
if (Sprites.Contains(item)) continue;
|
|
|
|
Sprites.Add(item);
|
|
}
|
|
}*/
|
|
}
|