Browse Source

Add portrait DimColor

master
morningfungame 8 years ago
parent
commit
0cc280cddb
  1. 6
      Assets/Fungus/Scripts/Components/PortraitController.cs
  2. 8
      Assets/Fungus/Scripts/Components/Stage.cs
  3. 3
      Assets/Tests/Narrative/ConversationTests.unity

6
Assets/Fungus/Scripts/Components/PortraitController.cs

@ -32,7 +32,7 @@ namespace Fungus
public enum FacingDirection
{
/// <summary> Unknown direction </summary>
None,
None,
/// <summary> Facing left. </summary>
Left,
/// <summary> Facing right. </summary>
@ -605,14 +605,14 @@ namespace Fungus
character.State.dimmed = dimmedState;
Color targetColor = dimmedState ? new Color(0.5f, 0.5f, 0.5f, 1f) : Color.white;
Color targetColor = dimmedState ? stage.DimColor : Color.white;
// LeanTween doesn't handle 0 duration properly
float duration = (stage.FadeDuration > 0f) ? stage.FadeDuration : float.Epsilon;
LeanTween.color(character.State.portraitImage.rectTransform, targetColor, duration).setEase(stage.FadeEaseType);
}
#endregion
}
}

8
Assets/Fungus/Scripts/Components/Stage.cs

@ -20,6 +20,9 @@ namespace Fungus
[Tooltip("Dim portraits when a character is not speaking.")]
[SerializeField] protected bool dimPortraits;
[Tooltip("Choose a dimColor")]
[SerializeField] protected Color dimColor =new Color(0.5f, 0.5f, 0.5f, 1f);
[Tooltip("Duration for fading character portraits in / out.")]
[SerializeField] protected float fadeDuration = 0.5f;
@ -96,6 +99,11 @@ namespace Fungus
/// </summary>
public virtual bool DimPortraits { get { return dimPortraits; } set { dimPortraits = value; } }
/// <summary>
/// Choose a dimColor.
/// </summary>
public virtual Color DimColor { get { return dimColor; } set { dimColor = value; } }
/// <summary>
/// Duration for fading character portraits in / out.
/// </summary>

3
Assets/Tests/Narrative/ConversationTests.unity

@ -737,7 +737,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!114 &215354033
MonoBehaviour:
m_ObjectHideFlags: 0
@ -4165,6 +4165,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
portraitCanvas: {fileID: 191157555}
dimPortraits: 1
dimColor: {r: 0.5019608, g: 0.5019608, b: 0.5019608, a: 1}
fadeDuration: 0.75
moveDuration: 1
fadeEaseType: 4

Loading…
Cancel
Save