/// <summary>
		/// Finds an actor's portrait texture.
		/// </summary>
		/// <param name="actor">Actor.</param>
		/// <param name="portraitFolder">Portrait folder.</param>
		protected virtual void FindPortraitTexture(Actor actor, string portraitFolder) {
			if (actor == null) return;
			string textureName = actor.TextureName;
			if (!string.IsNullOrEmpty(textureName)) {
				string filename = Path.GetFileName(textureName).Replace('\\', '/');
				string assetPath = string.Format("{0}/{1}", portraitFolder, filename);
				Texture2D texture = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Texture2D)) as Texture2D;
				if (texture == null) {
					Debug.LogWarning(string.Format("{0}: Can't find portrait texture {1} for {2}.", DialogueDebug.Prefix, assetPath, actor.Name));
				}
				actor.portrait = texture;
			}
		}
示例#2
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="sourceActor">Source actor.</param>
 public Actor(Actor sourceActor)
     : base(sourceActor as Asset)
 {
     this.portrait = sourceActor.portrait;
 }
 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;
 }
 private string GetActorName(Actor actor)
 {
     return (actor != null) ? actor.Name : "null";
 }
示例#5
0
 private static void MergeActors(DialogueDatabase destination, DialogueDatabase source, NewIDs newIDs)
 {
     foreach (var actor in source.actors) {
         if (newIDs.actor.ContainsKey(actor.id)) {
             Actor newActor = new Actor(actor);
             newActor.id = newIDs.actor[actor.id];
             ConvertFieldIDs(newActor.fields, newIDs);
             destination.actors.Add(newActor);
         }
     }
 }
示例#6
0
 public Actor CreateActor(int id, string name, bool isPlayer)
 {
     Actor actor = new Actor();
     actor.fields = CreateFields(actorFields);
     actor.id = id;
     actor.Name = name;
     actor.IsPlayer = isPlayer;
     return actor;
 }