private Texture2D GetPortrait(Transform character, Actor actor) { Texture2D portrait = null; if (character != null) { OverrideActorName overrideActorName = character.GetComponentInChildren <OverrideActorName>(); if (overrideActorName != null) { portrait = GetPortraitByActorName(overrideActorName.GetOverrideName()); } if (portrait == null) { portrait = GetPortraitByActorName(character.name); } } if ((portrait == null) && (actor != null)) { portrait = GetPortraitByActorName(actor.Name); if (portrait == null) { portrait = actor.portrait; } } return(portrait); }
public void Start() { if (string.IsNullOrEmpty(overrideActorName)) { OverrideActorName globalOverrideActorName = GetComponentInChildren <OverrideActorName>(); if (globalOverrideActorName != null) { overrideActorName = globalOverrideActorName.GetOverrideName(); } } }
/// <summary> /// Gets the name of the actor, either from the GameObject or its OverrideActorComponent /// if present. /// </summary> /// <returns>The actor name.</returns> /// <param name="t">The actor's transform.</param> public static string GetActorName(Transform t) { OverrideActorName overrideActorName = t.GetComponentInChildren <OverrideActorName>(); if (overrideActorName == null && t.parent != null) { overrideActorName = t.parent.GetComponent <OverrideActorName>(); } return(((overrideActorName == null) || string.IsNullOrEmpty(overrideActorName.overrideName)) ? t.name : overrideActorName.GetOverrideName()); }