using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class PartyMember { /// <summary> /// Container for the ally prefab /// </summary> public GameObject Ally_Object { get; private set; } public Ally AllyState { get; private set; } public bool FreshState { get; private set; } public void SetAllyState(Ally ally) { this.FreshState = false; this.AllyState = ally; } private readonly string PartyMemberName; private readonly Sprite PartyMemberSprite; public string GetMemberName() => this.PartyMemberName; public Sprite GetMemberSprite() => this.PartyMemberSprite; /// <summary> /// Loads the reference of the Party Member via string into the Object container for recall /// </summary> /// <param name="memberName">The name of the party member</param> /// <exception cref="NullReferenceException">If the party member name cannot be found than exception is thrown</exception> public PartyMember(string memberName) { try { this.Ally_Object = Resources.Load<GameObject>($"Entities/Allies/{memberName}"); this.PartyMemberSprite = Resources.Load<Sprite>($"Sprites/Allies/{memberName}"); this.PartyMemberName = memberName; this.AllyState = this.Ally_Object.GetComponent<Ally>(); this.FreshState = true; } catch (Exception e) { throw new NullReferenceException("Ally was not found in folder!", e); } } }