internal void ChangeAffiliation(Affiliations affiliation) { Affiliation = affiliation; Sprite[] textures = Resources.LoadAll<Sprite>("Sprites"); string[] names = new string[textures.Length]; for (int ii = 0; ii < names.Length; ii++) { names[ii] = textures[ii].name; } Sprite sprite = textures[Array.IndexOf(names, Affiliation.ToString())]; var sRenderer = gameObject.GetComponent<SpriteRenderer>(); sRenderer.sprite = sprite; switch (Affiliation) { case Affiliations.FullControl: GC.Instance.ScriptPlayer.AddControlledSystem(gameObject); var scriptAction = LastAction.GetComponent<ActionBehaviour>(); break; case Affiliations.PartialControl: break; case Affiliations.EnemyControl: sRenderer.sprite = sprite; break; default: return; } }