diff --git a/Assets/Fungus/Scripts/Components/Character.cs b/Assets/Fungus/Scripts/Components/Character.cs
index 2f7c6f94..c606ff05 100644
--- a/Assets/Fungus/Scripts/Components/Character.cs
+++ b/Assets/Fungus/Scripts/Components/Character.cs
@@ -13,7 +13,7 @@ namespace Fungus
/// A Character that can be used in dialogue via the Say, Conversation and Portrait commands.
///
[ExecuteInEditMode]
- public class Character : MonoBehaviour, ICharacter, ILocalizable
+ public class Character : MonoBehaviour, ILocalizable
{
[Tooltip("Character name as displayed in Say Dialog.")]
[SerializeField] protected string nameText; // We need a separate name as the object name is used for character variations (e.g. "Smurf Happy", "Smurf Sad")
@@ -54,32 +54,69 @@ namespace Fungus
activeCharacters.Remove(this);
}
- #region ICharacter implementation
+ #region Public methods
+ ///
+ /// Character name as displayed in Say Dialog.
+ ///
public virtual string NameText { get { return nameText; } }
+ ///
+ /// Color to display the character name in Say Dialog.
+ ///
public virtual Color NameColor { get { return nameColor; } }
+ ///
+ /// Sound effect to play when this character is speaking.
+ ///
+ /// The sound effect.
public virtual AudioClip SoundEffect { get { return soundEffect; } }
- public virtual Sprite ProfileSprite { get; set; }
-
+ ///
+ /// List of portrait images that can be displayed for this character.
+ ///
public virtual List Portraits { get { return portraits; } }
+ ///
+ /// Direction that portrait sprites face.
+ ///
public virtual FacingDirection PortraitsFace { get { return portraitsFace; } }
+ ///
+ /// Currently display profile sprite for this character.
+ ///
+ /// The profile sprite.
+ public virtual Sprite ProfileSprite { get; set; }
+
+ ///
+ /// Current display state of this character's portrait.
+ ///
+ /// The state.
public virtual PortraitState State { get { return portaitState; } }
+ ///
+ /// Sets the active Say dialog with a reference to a Say Dialog object in the scene. This Say Dialog will be used whenever the character speaks.
+ ///
public virtual ISayDialog SetSayDialog { get { return setSayDialog; } }
+ ///
+ /// Returns the name of the game object.
+ ///
public string GetObjectName() { return gameObject.name; }
+ ///
+ /// Returns true if the character name starts with the specified string. Case insensitive.
+ ///
public virtual bool NameStartsWith(string matchString)
{
return name.StartsWith(matchString, true, System.Globalization.CultureInfo.CurrentCulture)
|| nameText.StartsWith(matchString, true, System.Globalization.CultureInfo.CurrentCulture);
}
+ ///
+ /// Looks for a portrait by name on a character
+ /// If none is found, give a warning and return a blank sprite
+ ///
public virtual Sprite GetPortrait(string portraitString)
{
if (String.IsNullOrEmpty(portraitString))
diff --git a/Assets/Fungus/Scripts/Components/SayDialog.cs b/Assets/Fungus/Scripts/Components/SayDialog.cs
index b8aa103d..6b18ccf0 100644
--- a/Assets/Fungus/Scripts/Components/SayDialog.cs
+++ b/Assets/Fungus/Scripts/Components/SayDialog.cs
@@ -53,7 +53,7 @@ namespace Fungus
public static ISayDialog activeSayDialog;
// Most recent speaking character
- public static ICharacter speakingCharacter;
+ public static Character speakingCharacter;
public static ISayDialog GetSayDialog()
{
@@ -245,7 +245,7 @@ namespace Fungus
gameObject.SetActive(state);
}
- public virtual void SetCharacter(ICharacter character, IFlowchart flowchart = null)
+ public virtual void SetCharacter(Character character, IFlowchart flowchart = null)
{
if (character == null)
{
@@ -261,7 +261,7 @@ namespace Fungus
}
else
{
- ICharacter prevSpeakingCharacter = speakingCharacter;
+ var prevSpeakingCharacter = speakingCharacter;
speakingCharacter = character;
// Dim portraits of non-speaking characters
diff --git a/Assets/Fungus/Scripts/Interfaces/ICharacter.cs b/Assets/Fungus/Scripts/Interfaces/ICharacter.cs
deleted file mode 100644
index 4312ac0c..00000000
--- a/Assets/Fungus/Scripts/Interfaces/ICharacter.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
-// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
-
-using UnityEngine;
-using System.Collections.Generic;
-using Fungus.Utils;
-
-namespace Fungus
-{
- ///
- /// A Character that can be used in dialogue via the Say, Conversation and Portrait commands.
- ///
- public interface ICharacter
- {
- ///
- /// Character name as displayed in Say Dialog.
- ///
- string NameText { get; }
-
- ///
- /// Color to display the character name in Say Dialog.
- ///
- Color NameColor { get; }
-
- ///
- /// Sound effect to play when this character is speaking.
- ///
- /// The sound effect.
- AudioClip SoundEffect { get; }
-
- ///
- /// List of portrait images that can be displayed for this character.
- ///
- List Portraits { get; }
-
- ///
- /// Direction that portrait sprites face.
- ///
- FacingDirection PortraitsFace { get; }
-
- ///
- /// Currently display profile sprite for this character.
- ///
- /// The profile sprite.
- Sprite ProfileSprite { get; set; }
-
- ///
- /// Current display state of this character's portrait.
- ///
- /// The state.
- PortraitState State { get; }
-
- ///
- /// Sets the active Say dialog with a reference to a Say Dialog object in the scene. This Say Dialog will be used whenever the character speaks.
- ///
- ISayDialog SetSayDialog { get; }
-
- ///
- /// Returns the name of the game object.
- ///
- string GetObjectName();
-
- ///
- /// Returns true if the character name starts with the specified string. Case insensitive.
- ///
- bool NameStartsWith(string matchString);
-
- ///
- /// Looks for a portrait by name on a character
- /// If none is found, give a warning and return a blank sprite
- ///
- Sprite GetPortrait(string portraitString);
- }
-}
\ No newline at end of file
diff --git a/Assets/Fungus/Scripts/Interfaces/ICharacter.cs.meta b/Assets/Fungus/Scripts/Interfaces/ICharacter.cs.meta
deleted file mode 100644
index 5fdff1de..00000000
--- a/Assets/Fungus/Scripts/Interfaces/ICharacter.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 07a9457a850c147049f1fb7ea4b860cf
-timeCreated: 1473676955
-licenseType: Free
-MonoImporter:
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/Fungus/Scripts/Interfaces/ISayDialog.cs b/Assets/Fungus/Scripts/Interfaces/ISayDialog.cs
index a6882b36..b5b060ad 100644
--- a/Assets/Fungus/Scripts/Interfaces/ISayDialog.cs
+++ b/Assets/Fungus/Scripts/Interfaces/ISayDialog.cs
@@ -21,7 +21,7 @@ namespace Fungus
///
/// The active speaking character.
/// An optional Flowchart to use for variable substitution in the character name string.
- void SetCharacter(ICharacter character, IFlowchart flowchart = null);
+ void SetCharacter(Character character, IFlowchart flowchart = null);
///
/// Sets the character image to display on the Say Dialog.