Blur fade!
This commit is contained in:
parent
20d5e2c411
commit
179a3f7d22
@ -62401,6 +62401,7 @@ Transform:
|
|||||||
- {fileID: 1550580935}
|
- {fileID: 1550580935}
|
||||||
- {fileID: 1787272690}
|
- {fileID: 1787272690}
|
||||||
- {fileID: 1853140661}
|
- {fileID: 1853140661}
|
||||||
|
- {fileID: 7588367539711513062}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
@ -62448,6 +62449,8 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
gameTimer: {fileID: 0}
|
gameTimer: {fileID: 0}
|
||||||
|
mainMenu: {fileID: 0}
|
||||||
|
UICanvas: {fileID: 0}
|
||||||
<pauseLevel>k__BackingField: 1
|
<pauseLevel>k__BackingField: 1
|
||||||
fadingTime: 3
|
fadingTime: 3
|
||||||
minFadingValue: 0.1
|
minFadingValue: 0.1
|
||||||
@ -63259,6 +63262,80 @@ Transform:
|
|||||||
m_CorrespondingSourceObject: {fileID: 1933134022928666816, guid: 4da2d7c3520f17b4ebee7e57a5908d12, type: 3}
|
m_CorrespondingSourceObject: {fileID: 1933134022928666816, guid: 4da2d7c3520f17b4ebee7e57a5908d12, type: 3}
|
||||||
m_PrefabInstance: {fileID: 1575358957}
|
m_PrefabInstance: {fileID: 1575358957}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!1001 &1739929594
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 9196727425507610130}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 7588367541264262684, guid: c642408fc60a479419848c9119286505, type: 3}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 12
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7588367541264262684, guid: c642408fc60a479419848c9119286505, type: 3}
|
||||||
|
propertyPath: m_LocalScale.x
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7588367541264262684, guid: c642408fc60a479419848c9119286505, type: 3}
|
||||||
|
propertyPath: m_LocalScale.y
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7588367541264262684, guid: c642408fc60a479419848c9119286505, type: 3}
|
||||||
|
propertyPath: m_LocalScale.z
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7588367541264262684, guid: c642408fc60a479419848c9119286505, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7588367541264262684, guid: c642408fc60a479419848c9119286505, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7588367541264262684, guid: c642408fc60a479419848c9119286505, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7588367541264262684, guid: c642408fc60a479419848c9119286505, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7588367541264262684, guid: c642408fc60a479419848c9119286505, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: -0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7588367541264262684, guid: c642408fc60a479419848c9119286505, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: -0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7588367541264262684, guid: c642408fc60a479419848c9119286505, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: -0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7588367541264262684, guid: c642408fc60a479419848c9119286505, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7588367541264262684, guid: c642408fc60a479419848c9119286505, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7588367541264262684, guid: c642408fc60a479419848c9119286505, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7775117503087316140, guid: c642408fc60a479419848c9119286505, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: Global Volume
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: c642408fc60a479419848c9119286505, type: 3}
|
||||||
|
--- !u!4 &7588367539711513062 stripped
|
||||||
|
Transform:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 7588367541264262684, guid: c642408fc60a479419848c9119286505, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 1739929594}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
--- !u!1001 &1779977739
|
--- !u!1001 &1779977739
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
64
Assets/Prefabs/Global Volume.prefab
Normal file
64
Assets/Prefabs/Global Volume.prefab
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &7775117503087316140
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 7588367541264262684}
|
||||||
|
- component: {fileID: 6742154694633569523}
|
||||||
|
- component: {fileID: 5221859989499760603}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Global Volume
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &7588367541264262684
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7775117503087316140}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: -400.00003, y: -225.09909, z: -10.568032}
|
||||||
|
m_LocalScale: {x: 1.0568032, y: 1.0568032, z: 1.0568032}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &6742154694633569523
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7775117503087316140}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
isGlobal: 1
|
||||||
|
priority: 0
|
||||||
|
blendDistance: 0
|
||||||
|
weight: 1
|
||||||
|
sharedProfile: {fileID: 11400000, guid: 19d4201eb56e2de4582bf8a0a32b484a, type: 2}
|
||||||
|
--- !u!114 &5221859989499760603
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7775117503087316140}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 2e0e17f28aaf1fe44af28e32da43d018, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
transitionSpeed: 0.04
|
||||||
7
Assets/Prefabs/Global Volume.prefab.meta
Normal file
7
Assets/Prefabs/Global Volume.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c642408fc60a479419848c9119286505
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -169,7 +169,6 @@ RectTransform:
|
|||||||
- {fileID: 4394421821813469863}
|
- {fileID: 4394421821813469863}
|
||||||
- {fileID: 4394421821957890210}
|
- {fileID: 4394421821957890210}
|
||||||
- {fileID: 4394421820717285783}
|
- {fileID: 4394421820717285783}
|
||||||
- {fileID: 9052363376224837333}
|
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
@ -904,51 +903,3 @@ MonoBehaviour:
|
|||||||
m_FillOrigin: 0
|
m_FillOrigin: 0
|
||||||
m_UseSpriteMesh: 0
|
m_UseSpriteMesh: 0
|
||||||
m_PixelsPerUnitMultiplier: 1
|
m_PixelsPerUnitMultiplier: 1
|
||||||
--- !u!1 &9154125589810721893
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 9052363376224837333}
|
|
||||||
- component: {fileID: 5296173155622552634}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Global Volume
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!4 &9052363376224837333
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 9154125589810721893}
|
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
|
||||||
m_LocalPosition: {x: -400.00003, y: -225.09909, z: -10.568032}
|
|
||||||
m_LocalScale: {x: 1.0568032, y: 1.0568032, z: 1.0568032}
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 4394421820928219484}
|
|
||||||
m_RootOrder: 5
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!114 &5296173155622552634
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 9154125589810721893}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
isGlobal: 1
|
|
||||||
priority: 0
|
|
||||||
blendDistance: 0
|
|
||||||
weight: 1
|
|
||||||
sharedProfile: {fileID: 11400000, guid: 19d4201eb56e2de4582bf8a0a32b484a, type: 2}
|
|
||||||
|
|||||||
@ -120,7 +120,7 @@ public class AIEntity : Entity {
|
|||||||
RaycastHit2D hit = Physics2D.Raycast(transform.position, direction, attackRange, (1 << LayerMask.NameToLayer("Safezone")));//Layer 6 is safeZone
|
RaycastHit2D hit = Physics2D.Raycast(transform.position, direction, attackRange, (1 << LayerMask.NameToLayer("Safezone")));//Layer 6 is safeZone
|
||||||
Physics2D.queriesHitTriggers = true;
|
Physics2D.queriesHitTriggers = true;
|
||||||
if(!(hit.collider is null)){ //We have hit the safe zone
|
if(!(hit.collider is null)){ //We have hit the safe zone
|
||||||
Debug.Log("hit");
|
//Debug.Log("hit");
|
||||||
isAvoiding = true;
|
isAvoiding = true;
|
||||||
Vector3 avoidDir = Vector3.zero;
|
Vector3 avoidDir = Vector3.zero;
|
||||||
//Between top and bottom
|
//Between top and bottom
|
||||||
|
|||||||
29
Assets/Scripts/BlurFade.cs
Normal file
29
Assets/Scripts/BlurFade.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Rendering;
|
||||||
|
|
||||||
|
public class BlurFade : MonoBehaviour {
|
||||||
|
Volume volume = null!;
|
||||||
|
Coroutine? coroutine;
|
||||||
|
bool blurred;
|
||||||
|
[SerializeField] [Range(0f, 1f)]
|
||||||
|
float transitionSpeed = 0.2f;
|
||||||
|
|
||||||
|
void Awake() => volume = GetComponent<Volume>();
|
||||||
|
|
||||||
|
public void SetBlurred(bool value) {
|
||||||
|
blurred = value;
|
||||||
|
coroutine ??= StartCoroutine(BlurCoroutine());
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumerator BlurCoroutine() {
|
||||||
|
while (blurred ? volume.weight <= 1f : volume.weight >= 0f) {
|
||||||
|
volume.weight += transitionSpeed * (blurred ? 1f : -1f);
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
coroutine = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/BlurFade.cs.meta
Normal file
11
Assets/Scripts/BlurFade.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2e0e17f28aaf1fe44af28e32da43d018
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -15,6 +15,8 @@ public class GameFlowManager : MonoBehaviour {
|
|||||||
[SerializeField] [Required]
|
[SerializeField] [Required]
|
||||||
Canvas UICanvas = null!;
|
Canvas UICanvas = null!;
|
||||||
|
|
||||||
|
BlurFade blurFade = null!;
|
||||||
|
|
||||||
public enum PauseLevel {
|
public enum PauseLevel {
|
||||||
NotPaused,
|
NotPaused,
|
||||||
PreventActions,
|
PreventActions,
|
||||||
@ -43,6 +45,8 @@ public class GameFlowManager : MonoBehaviour {
|
|||||||
#region Unity Messages
|
#region Unity Messages
|
||||||
|
|
||||||
void Awake() {
|
void Awake() {
|
||||||
|
blurFade = GetComponentInChildren<BlurFade>();
|
||||||
|
|
||||||
CurrentState = new StartMenuFlowState(this);
|
CurrentState = new StartMenuFlowState(this);
|
||||||
if (startTxt != null) {
|
if (startTxt != null) {
|
||||||
startTxt.transform.parent.gameObject.SetActive(true);
|
startTxt.transform.parent.gameObject.SetActive(true);
|
||||||
@ -152,6 +156,7 @@ public class GameFlowManager : MonoBehaviour {
|
|||||||
gameFlowManager.mainMenu.gameObject.SetActive(true);
|
gameFlowManager.mainMenu.gameObject.SetActive(true);
|
||||||
gameFlowManager.mainMenu.SetMenuMode(MainMenuManager.MenuMode.MainMenu);
|
gameFlowManager.mainMenu.SetMenuMode(MainMenuManager.MenuMode.MainMenu);
|
||||||
gameFlowManager.UICanvas.gameObject.SetActive(false);
|
gameFlowManager.UICanvas.gameObject.SetActive(false);
|
||||||
|
gameFlowManager.blurFade.SetBlurred(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LeaveState() {
|
public override void LeaveState() {
|
||||||
@ -160,6 +165,7 @@ public class GameFlowManager : MonoBehaviour {
|
|||||||
gameFlowManager.mainMenu.ResetMenuState();
|
gameFlowManager.mainMenu.ResetMenuState();
|
||||||
gameFlowManager.mainMenu.gameObject.SetActive(false);
|
gameFlowManager.mainMenu.gameObject.SetActive(false);
|
||||||
gameFlowManager.UICanvas.gameObject.SetActive(true);
|
gameFlowManager.UICanvas.gameObject.SetActive(true);
|
||||||
|
gameFlowManager.blurFade.SetBlurred(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,6 +213,7 @@ public class GameFlowManager : MonoBehaviour {
|
|||||||
gameFlowManager.mainMenu.gameObject.SetActive(true);
|
gameFlowManager.mainMenu.gameObject.SetActive(true);
|
||||||
gameFlowManager.mainMenu.SetMenuMode(MainMenuManager.MenuMode.PauseMenu);
|
gameFlowManager.mainMenu.SetMenuMode(MainMenuManager.MenuMode.PauseMenu);
|
||||||
gameFlowManager.SetPauseLevel(PauseLevel.TimeStop);
|
gameFlowManager.SetPauseLevel(PauseLevel.TimeStop);
|
||||||
|
gameFlowManager.blurFade.SetBlurred(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LeaveState() {
|
public override void LeaveState() {
|
||||||
@ -215,6 +222,7 @@ public class GameFlowManager : MonoBehaviour {
|
|||||||
gameFlowManager.mainMenu.ResetMenuState();
|
gameFlowManager.mainMenu.ResetMenuState();
|
||||||
gameFlowManager.mainMenu.gameObject.SetActive(false);
|
gameFlowManager.mainMenu.gameObject.SetActive(false);
|
||||||
gameFlowManager.SetPauseLevel(PauseLevel.NotPaused);
|
gameFlowManager.SetPauseLevel(PauseLevel.NotPaused);
|
||||||
|
gameFlowManager.blurFade.SetBlurred(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,8 +234,11 @@ public class GameFlowManager : MonoBehaviour {
|
|||||||
|
|
||||||
Debug.Log("You died!\nPress Accept to restart!");
|
Debug.Log("You died!\nPress Accept to restart!");
|
||||||
gameFlowManager.SetPauseLevel(PauseLevel.PreventActions);
|
gameFlowManager.SetPauseLevel(PauseLevel.PreventActions);
|
||||||
|
gameFlowManager.blurFade.SetBlurred(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void LeaveState() => gameFlowManager.blurFade.SetBlurred(false);
|
||||||
|
|
||||||
public void ReloadGame() {
|
public void ReloadGame() {
|
||||||
Debug.Log("Reloading scene...");
|
Debug.Log("Reloading scene...");
|
||||||
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
|
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user