Compare commits
4 Commits
clean_up_l
...
damianCont
| Author | SHA1 | Date | |
|---|---|---|---|
| 50c1144e83 | |||
| 88d03773a7 | |||
| 8d41356418 | |||
| e1f62a0fa1 |
@@ -649,6 +649,7 @@ MonoBehaviour:
|
||||
- {fileID: 1062017697}
|
||||
- {fileID: 173052728}
|
||||
surfacingTimeline: {fileID: 2064311130}
|
||||
flashRef: {fileID: 553184965}
|
||||
--- !u!4 &424805726
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -790,6 +791,54 @@ Animator:
|
||||
m_AllowConstantClipSamplingOptimization: 1
|
||||
m_KeepAnimatorStateOnDisable: 0
|
||||
m_WriteDefaultValuesOnDisable: 0
|
||||
--- !u!1 &553184965
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 553184968}
|
||||
- component: {fileID: 553184966}
|
||||
m_Layer: 0
|
||||
m_Name: Flash
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &553184966
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 553184965}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 194155c0137366c4ea64558d2601e19a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: '::'
|
||||
square: {fileID: 1946128997}
|
||||
flashInDuration: 0.05
|
||||
flashOutDuration: 0.2
|
||||
--- !u!4 &553184968
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 553184965}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 6.94, y: 0.26, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1946128999}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &730962732
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1367,15 +1416,15 @@ LineRenderer:
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Positions:
|
||||
- {x: -0.15602553, y: 4.074945, z: 0}
|
||||
- {x: -0.11662118, y: 3.8796225, z: 0}
|
||||
- {x: -0.15602553, y: 4.0749445, z: 0}
|
||||
- {x: -0.11662118, y: 3.879622, z: 0}
|
||||
- {x: -0.07721684, y: 3.7057445, z: 0}
|
||||
- {x: -0.03781248, y: 3.5533106, z: 0}
|
||||
- {x: 0.0015918687, y: 3.4223216, z: 0}
|
||||
- {x: 0.040996216, y: 3.3127766, z: 0}
|
||||
- {x: 0.08040057, y: 3.2246757, z: 0}
|
||||
- {x: 0.11980491, y: 3.1580195, z: 0}
|
||||
- {x: 0.15920927, y: 3.112808, z: 0}
|
||||
- {x: 0.08040057, y: 3.2246761, z: 0}
|
||||
- {x: 0.11980491, y: 3.15802, z: 0}
|
||||
- {x: 0.15920927, y: 3.1128082, z: 0}
|
||||
- {x: 0.1986136, y: 3.0890405, z: 0}
|
||||
- {x: 0.23801796, y: 3.0867176, z: 0}
|
||||
m_Parameters:
|
||||
@@ -1910,13 +1959,13 @@ LineRenderer:
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Positions:
|
||||
- {x: -0.15602553, y: 4.074945, z: 0}
|
||||
- {x: -0.18956745, y: 3.8764977, z: 0}
|
||||
- {x: -0.15602553, y: 4.0749445, z: 0}
|
||||
- {x: -0.18956745, y: 3.8764973, z: 0}
|
||||
- {x: -0.22310936, y: 3.7000232, z: 0}
|
||||
- {x: -0.25665125, y: 3.5455208, z: 0}
|
||||
- {x: -0.29019317, y: 3.4129908, z: 0}
|
||||
- {x: -0.25665125, y: 3.5455203, z: 0}
|
||||
- {x: -0.29019317, y: 3.412991, z: 0}
|
||||
- {x: -0.32373506, y: 3.3024335, z: 0}
|
||||
- {x: -0.35727698, y: 3.213848, z: 0}
|
||||
- {x: -0.35727698, y: 3.2138484, z: 0}
|
||||
- {x: -0.39081886, y: 3.1472359, z: 0}
|
||||
- {x: -0.4243608, y: 3.1025958, z: 0}
|
||||
- {x: -0.45790267, y: 3.0799282, z: 0}
|
||||
@@ -2318,6 +2367,96 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 2106431002}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1946128997
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1946128999}
|
||||
- component: {fileID: 1946128998}
|
||||
m_Layer: 0
|
||||
m_Name: Square
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!212 &1946128998
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1946128997}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||
m_RayTracingAccelStructBuildFlags: 1
|
||||
m_SmallMeshCulling: 1
|
||||
m_ForceMeshLod: -1
|
||||
m_MeshLodSelectionBias: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_GlobalIlluminationMeshLod: 0
|
||||
m_SortingLayerID: -1132846201
|
||||
m_SortingLayer: 1
|
||||
m_SortingOrder: 10
|
||||
m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 0}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!4 &1946128999
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1946128997}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: -7, y: 0, z: 0}
|
||||
m_LocalScale: {x: 14, y: 18, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 553184968}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1976291907
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -2600,6 +2739,7 @@ SceneRoots:
|
||||
m_Roots:
|
||||
- {fileID: 1063641114}
|
||||
- {fileID: 224729333}
|
||||
- {fileID: 553184968}
|
||||
- {fileID: 747976397}
|
||||
- {fileID: 2106431002}
|
||||
- {fileID: 116234201}
|
||||
|
||||
69
Assets/Scripts/DamianExperiments/Minigame/FlashBehaviour.cs
Normal file
69
Assets/Scripts/DamianExperiments/Minigame/FlashBehaviour.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class FlashBehaviour : MonoBehaviour
|
||||
{
|
||||
public GameObject square; // Assign in inspector or find in Start
|
||||
public float flashInDuration = 0.05f;
|
||||
public float flashOutDuration = 0.2f;
|
||||
|
||||
private Color squareColor;
|
||||
private Coroutine flashCoroutine;
|
||||
private SpriteRenderer spriteRenderer;
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
||||
if (square == null)
|
||||
square = transform.Find("Square")?.gameObject;
|
||||
|
||||
if (square != null)
|
||||
spriteRenderer = square.GetComponent<SpriteRenderer>();
|
||||
|
||||
if (spriteRenderer != null)
|
||||
{
|
||||
squareColor = spriteRenderer.color;
|
||||
squareColor.a = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void TriggerFlash()
|
||||
{
|
||||
if (flashCoroutine != null)
|
||||
StopCoroutine(flashCoroutine);
|
||||
flashCoroutine = StartCoroutine(FlashRoutine());
|
||||
}
|
||||
|
||||
private IEnumerator FlashRoutine()
|
||||
{
|
||||
// Fade in
|
||||
float t = 0;
|
||||
while (t < flashInDuration)
|
||||
{
|
||||
t += Time.deltaTime;
|
||||
SetAlpha(Mathf.Lerp(0, 1, t / flashInDuration));
|
||||
yield return null;
|
||||
}
|
||||
SetAlpha(1);
|
||||
|
||||
// Fade out
|
||||
t = 0;
|
||||
while (t < flashOutDuration)
|
||||
{
|
||||
t += Time.deltaTime;
|
||||
SetAlpha(Mathf.Lerp(1, 0, t / flashOutDuration));
|
||||
yield return null;
|
||||
}
|
||||
SetAlpha(0);
|
||||
}
|
||||
|
||||
private void SetAlpha(float alpha)
|
||||
{
|
||||
if (spriteRenderer != null)
|
||||
{
|
||||
squareColor.a = alpha;
|
||||
spriteRenderer.color = squareColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 194155c0137366c4ea64558d2601e19a
|
||||
@@ -29,7 +29,11 @@ namespace Minigames.DivingForPictures
|
||||
[Header("Surfacing Settings")]
|
||||
[Tooltip("Reference to the PlayableDirector that will play the surfacing timeline")]
|
||||
[SerializeField] private PlayableDirector surfacingTimeline;
|
||||
|
||||
|
||||
[Header("Flash Effect Reference")]
|
||||
[Tooltip("Reference to the Flash Effect when the picture is taken")]
|
||||
[SerializeField] private GameObject flashRef;
|
||||
|
||||
private CameraViewfinderManager viewfinderManager;
|
||||
|
||||
// Settings reference
|
||||
@@ -866,7 +870,20 @@ namespace Minigames.DivingForPictures
|
||||
|
||||
// Calculate score based on proximity and depth
|
||||
CalculateScore(_currentPhotoTarget, _capturedProximity);
|
||||
|
||||
|
||||
|
||||
//Trigger the Flash Effect
|
||||
if (flashRef != null)
|
||||
{
|
||||
|
||||
var flash = flashRef.GetComponent<FlashBehaviour>();
|
||||
if (flash != null)
|
||||
{
|
||||
|
||||
flash.TriggerFlash();
|
||||
}
|
||||
}
|
||||
|
||||
// Complete the sequence
|
||||
CompletePhotoSequence();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user