add snow canvas group & fade function

master
tigerchen 6 years ago
parent 1458745b33
commit 124c9aa278
  1. 213
      08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scenes/DarkSea.unity
  2. 63
      08_DarkSea/Unity-19050-08-DarkSea/19050-08-DarkSea/Assets/Scripts/StatManager.cs

@ -182,6 +182,117 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 229700559} m_GameObject: {fileID: 229700559}
m_CullTransparentMesh: 0 m_CullTransparentMesh: 0
--- !u!1 &276261345
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 276261346}
- component: {fileID: 276261349}
- component: {fileID: 276261348}
- component: {fileID: 276261347}
- component: {fileID: 276261350}
m_Layer: 5
m_Name: Snow_Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &276261346
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 276261345}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!114 &276261347
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 276261345}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &276261348
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 276261345}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!223 &276261349
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 276261345}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 3
m_TargetDisplay: 0
--- !u!225 &276261350
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 276261345}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0
--- !u!1 &388490434 --- !u!1 &388490434
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -212,10 +323,11 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
fade_sec: 1 fade_sec: 1
loop_to_trigger: 4 loop_to_trigger: 1
idle_player: {fileID: 540220394} idle_player: {fileID: 540220394}
h_player: {fileID: 1232323602} h_player: {fileID: 1232323602}
h_grp: {fileID: 1781519744} h_grp: {fileID: 1781519744}
s_grp: {fileID: 276261350}
--- !u!4 &388490436 --- !u!4 &388490436
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -228,8 +340,65 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 6 m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &472923654
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1056807493977812, guid: 6143453941a05b54582f835773a10d58, type: 3}
propertyPath: m_Name
value: ConfigurationServer
objectReference: {fileID: 0}
- target: {fileID: 4601478661674938, guid: 6143453941a05b54582f835773a10d58, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4601478661674938, guid: 6143453941a05b54582f835773a10d58, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4601478661674938, guid: 6143453941a05b54582f835773a10d58, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4601478661674938, guid: 6143453941a05b54582f835773a10d58, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4601478661674938, guid: 6143453941a05b54582f835773a10d58, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4601478661674938, guid: 6143453941a05b54582f835773a10d58, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4601478661674938, guid: 6143453941a05b54582f835773a10d58, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4601478661674938, guid: 6143453941a05b54582f835773a10d58, type: 3}
propertyPath: m_RootOrder
value: 11
objectReference: {fileID: 0}
- target: {fileID: 4601478661674938, guid: 6143453941a05b54582f835773a10d58, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4601478661674938, guid: 6143453941a05b54582f835773a10d58, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4601478661674938, guid: 6143453941a05b54582f835773a10d58, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 6143453941a05b54582f835773a10d58, type: 3}
--- !u!1 &503604495 --- !u!1 &503604495
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -341,7 +510,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4472652550524646, guid: 1f68bf7cec2600e49a46d2f0554453c8, type: 3} - target: {fileID: 4472652550524646, guid: 1f68bf7cec2600e49a46d2f0554453c8, type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 8 value: 9
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4472652550524646, guid: 1f68bf7cec2600e49a46d2f0554453c8, type: 3} - target: {fileID: 4472652550524646, guid: 1f68bf7cec2600e49a46d2f0554453c8, type: 3}
propertyPath: m_LocalEulerAnglesHint.x propertyPath: m_LocalEulerAnglesHint.x
@ -583,7 +752,7 @@ Canvas:
m_SortingBucketNormalizedSize: 0 m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0 m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingOrder: 3 m_SortingOrder: 4
m_TargetDisplay: 0 m_TargetDisplay: 0
--- !u!225 &655193975 --- !u!225 &655193975
CanvasGroup: CanvasGroup:
@ -690,7 +859,7 @@ RectTransform:
m_Children: m_Children:
- {fileID: 503604496} - {fileID: 503604496}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 4 m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
@ -739,7 +908,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 7 m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &914806966 --- !u!114 &914806966
MonoBehaviour: MonoBehaviour:
@ -754,7 +923,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
img: {fileID: 2829506254029656376, guid: 8bbc036a3be21954681613cbe4f0e9a8, type: 3} img: {fileID: 2829506254029656376, guid: 8bbc036a3be21954681613cbe4f0e9a8, type: 3}
canvas: {fileID: 798465533} canvas: {fileID: 276261346}
VisualizeTouches: 1 VisualizeTouches: 1
frame_gap: 10 frame_gap: 10
delta_threshold: 100 delta_threshold: 100
@ -949,6 +1118,36 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100} m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1351281754
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1351281755}
m_Layer: 0
m_Name: UnitySpout
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1351281755
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1351281754}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 31}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1781519743 --- !u!1 &1781519743
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

@ -19,15 +19,18 @@ public class StatManager : MonoBehaviour
public DShowMoviePlayer idle_player; public DShowMoviePlayer idle_player;
public DShowMoviePlayer h_player; public DShowMoviePlayer h_player;
public CanvasGroup h_grp; public CanvasGroup h_grp;
public CanvasGroup s_grp;
int loop_count; int loop_count;
float lerp_val = 1f; float h_lerp_val;
float s_lerp_val;
void Start() void Start()
{ {
h_grp.alpha = 0f; h_grp.alpha = 0f;
loop_count = 0; loop_count = 0;
lerp_val = 0; h_lerp_val = 0f;
s_lerp_val = 1f;
} }
void Update() void Update()
@ -42,41 +45,77 @@ public class StatManager : MonoBehaviour
{ {
Debug.Log("horse fade in"); Debug.Log("horse fade in");
h_player.Play(); h_player.Play();
StartCoroutine("fade_in"); StartCoroutine("h_fade_in");
loop_count = 0; loop_count = 0;
} }
} }
else else
{ {
if(h_player.GetCurrentTime == 18f)
{
Debug.Log("snow out");
StartCoroutine("s_fade_out");
}
else if(h_player.GetCurrentTime == 27f)
{
Debug.Log("snow in");
StartCoroutine("s_fade_in");
}
if(h_player.Frame == h_player.TotalNumFrames - fade_sec * 30) if(h_player.Frame == h_player.TotalNumFrames - fade_sec * 30)
{ {
idle_player.Frame = 0; idle_player.Frame = 0;
Debug.Log("horse fade out"); Debug.Log("horse fade out");
StartCoroutine("fade_out"); StartCoroutine("h_fade_out");
} }
} }
} }
IEnumerator fade_in() IEnumerator h_fade_in()
{
h_lerp_val = 0f;
while (h_grp.alpha <= 1f)
{
h_lerp_val += Time.deltaTime / fade_sec;
h_grp.alpha = Mathf.Lerp(0f, 1f, h_lerp_val);
yield return null;
}
yield break;
}
IEnumerator h_fade_out()
{
h_lerp_val = 1f;
while (h_grp.alpha >= 0f)
{
h_lerp_val -= Time.deltaTime / fade_sec;
h_grp.alpha = Mathf.Lerp(0f, 1f, h_lerp_val);
yield return null;
}
yield break;
}
IEnumerator s_fade_in()
{ {
lerp_val = 0f; s_lerp_val = 0f;
while (h_grp.alpha <= 1f) while (h_grp.alpha <= 1f)
{ {
lerp_val += Time.deltaTime / fade_sec; s_lerp_val += Time.deltaTime / fade_sec;
h_grp.alpha = Mathf.Lerp(0f, 1f, lerp_val); s_grp.alpha = Mathf.Lerp(0f, 1f, s_lerp_val);
yield return null; yield return null;
} }
yield break; yield break;
} }
IEnumerator fade_out() IEnumerator s_fade_out()
{ {
lerp_val = 1f; s_lerp_val = 1f;
while (h_grp.alpha >= 0f) while (h_grp.alpha >= 0f)
{ {
lerp_val -= Time.deltaTime / fade_sec; s_lerp_val -= Time.deltaTime / fade_sec;
h_grp.alpha = Mathf.Lerp(0f, 1f, lerp_val); s_grp.alpha = Mathf.Lerp(0f, 1f, s_lerp_val);
yield return null; yield return null;
} }
yield break; yield break;

Loading…
Cancel
Save