setting up character manager
This commit is contained in:
38
Assets/Scripts/CharacterManager.cs
Normal file
38
Assets/Scripts/CharacterManager.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using UnityEngine;
|
||||
|
||||
public class CharacterManager : MonoBehaviour
|
||||
{
|
||||
public static CharacterManager Instance;
|
||||
|
||||
[SerializeField] private List<CharacterData> m_characterDatas;
|
||||
|
||||
public ReadOnlyCollection<CharacterData> CharacterDatas => m_characterDatas.AsReadOnly();
|
||||
|
||||
private Dictionary<string, bool> m_interviewed = new Dictionary<string, bool>();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("There can only be one instance of the CharacterManager class");
|
||||
}
|
||||
}
|
||||
|
||||
// Returns if a character has been interviewed.
|
||||
public bool CharacterInterviewed(string name)
|
||||
{
|
||||
return m_interviewed.ContainsKey(name);
|
||||
}
|
||||
|
||||
// Stores a character as interviewed.
|
||||
public void SetInterviewed(string name)
|
||||
{
|
||||
m_interviewed.Add(name, true);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/CharacterManager.cs.meta
Normal file
11
Assets/Scripts/CharacterManager.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: afced2bc2620add47923c6430dfb713e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user