Browse Source

Merge pull request #366 from FungusGames/punch-object-property

Specify the object to shake for punch tag
master
Chris Gregan 9 years ago
parent
commit
6b6ebc0610
  1. 91
      Assets/Fungus/Narrative/Resources/SayDialog.prefab
  2. 14
      Assets/Fungus/UI/Scripts/Writer.cs
  3. 250
      Assets/FungusExamples/Sherlock/TheExperiment.unity

91
Assets/Fungus/Narrative/Resources/SayDialog.prefab

@ -146,6 +146,7 @@ AudioSource:
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
@ -170,6 +171,7 @@ AudioSource:
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
@ -180,6 +182,7 @@ AudioSource:
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 0
spreadCustomCurve:
serializedVersion: 2
m_Curve:
@ -190,6 +193,7 @@ AudioSource:
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
@ -200,6 +204,7 @@ AudioSource:
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 0
--- !u!114 &11404316
MonoBehaviour:
m_ObjectHideFlags: 1
@ -241,11 +246,11 @@ MonoBehaviour:
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: .960784316, g: .960784316, b: .960784316, a: 1}
m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1}
m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: .100000001
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
@ -285,7 +290,13 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
@ -294,6 +305,7 @@ MonoBehaviour:
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
@ -348,6 +360,12 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 21300000, guid: ea8f56c43254d41728f5ac4e8299b6c9, type: 3}
m_Type: 0
m_PreserveAspect: 1
@ -430,10 +448,13 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
targetTextObject: {fileID: 188894}
punchObject: {fileID: 188900}
writingSpeed: 60
punctuationPause: .25
punctuationPause: 0.25
hiddenTextColor: {r: 1, g: 1, b: 1, a: 0}
writeWholeWords: 0
forceRichText: 1
instantComplete: 1
--- !u!114 &11488894
MonoBehaviour:
m_ObjectHideFlags: 1
@ -445,14 +466,13 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3a0bbe22c246e4c78ad8e9816cbae9d5, type: 3}
m_Name:
m_EditorClassIdentifier:
fadeDuration: .25
fadeDuration: 0.25
continueButton: {fileID: 11419088}
dialogCanvas: {fileID: 22388894}
nameText: {fileID: 11488900}
storyText: {fileID: 11488896}
characterImage: {fileID: 11448914}
fitTextWithImage: 1
textWidthScale: .800000012
--- !u!114 &11488896
MonoBehaviour:
m_ObjectHideFlags: 1
@ -466,14 +486,21 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 12800000, guid: 79197ecfbc3a4294a89ce589dac02cf2, type: 3}
m_FontSize: 50
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_MaxSize: 50
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
@ -491,15 +518,22 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: .258823544, g: .254901975, b: .262745112, a: 1}
m_Color: {r: 0.25882354, g: 0.25490198, b: 0.2627451, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 12800000, guid: bb145366ce7024469a5758b08d31802c, type: 3}
m_FontSize: 50
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_MaxSize: 50
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
m_VerticalOverflow: 0
@ -518,6 +552,12 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 21300000, guid: eeb00f6cd27e9ef4d9174551b3342dec, type: 3}
m_Type: 0
m_PreserveAspect: 1
@ -560,6 +600,12 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 21300000, guid: 226248ac6f184e448af731df91b91958, type: 3}
m_Type: 0
m_PreserveAspect: 0
@ -621,6 +667,7 @@ Canvas:
m_OverridePixelPerfect: 0
m_SortingLayerID: 0
m_SortingOrder: 1
m_TargetDisplay: 0
--- !u!224 &22433354
RectTransform:
m_ObjectHideFlags: 1
@ -636,9 +683,9 @@ RectTransform:
m_RootOrder: 1
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -38.9000244, y: 38.0749931}
m_SizeDelta: {x: 77.9000244, y: 77}
m_Pivot: {x: .5, y: .5}
m_AnchoredPosition: {x: -38.900024, y: 38.074993}
m_SizeDelta: {x: 77.900024, y: 77}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &22443574
RectTransform:
m_ObjectHideFlags: 1
@ -655,7 +702,7 @@ RectTransform:
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &22448914
RectTransform:
m_ObjectHideFlags: 1
@ -670,9 +717,9 @@ RectTransform:
m_RootOrder: 0
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 1386, y: 263.130005}
m_AnchoredPosition: {x: 1386, y: 263.13}
m_SizeDelta: {x: 357, y: 435}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &22488894
RectTransform:
m_ObjectHideFlags: 1
@ -689,7 +736,7 @@ RectTransform:
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 588.75, y: 235.37001}
m_SizeDelta: {x: 1178.5, y: 71}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &22488896
RectTransform:
m_ObjectHideFlags: 1
@ -706,9 +753,9 @@ RectTransform:
m_RootOrder: 1
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 799, y: 145.630005}
m_AnchoredPosition: {x: 799, y: 145.63}
m_SizeDelta: {x: 1531, y: 200}
m_Pivot: {x: .5, y: .5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &22488900
RectTransform:
m_ObjectHideFlags: 1
@ -723,8 +770,8 @@ RectTransform:
- {fileID: 22488896}
m_Father: {fileID: 22488902}
m_RootOrder: 0
m_AnchorMin: {x: .5, y: 0}
m_AnchorMax: {x: .5, y: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: -805, y: 0}
m_SizeDelta: {x: 1605, y: 335}
m_Pivot: {x: 0, y: 0}

14
Assets/Fungus/UI/Scripts/Writer.cs

@ -38,6 +38,9 @@ namespace Fungus
[Tooltip("Gameobject containing a Text, Inout Field or Text Mesh object to write to")]
public GameObject targetTextObject;
[Tooltip("Gameobject to punch when the punch tags are displayed. If none is set, the main camera will shake instead.")]
public GameObject punchObject;
[Tooltip("Writing characters per second")]
public float writingSpeed = 60;
@ -752,11 +755,16 @@ namespace Fungus
protected virtual void Punch(Vector3 axis, float time)
{
if (Camera.main == null)
GameObject go = punchObject;
if (go == null)
{
return;
go = Camera.main.gameObject;
}
if (go != null)
{
iTween.ShakePosition(go, axis, time);
}
iTween.ShakePosition(Camera.main.gameObject, axis, time);
}
protected virtual void Flash(float duration)

250
Assets/FungusExamples/Sherlock/TheExperiment.unity

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save