ajout de transition avant de loader le level
besoin : - le level était loadé directement au moment de cliquer dans le level selector ce qui n'est pas très fenshui solution : - fade out avec nuages - les tuiles tombent à leur place au lieu d'apparaitre toutes en même temps
This commit is contained in:
parent
da9257f78e
commit
9e07c48fd4
@ -103,7 +103,7 @@ Important considerations :
|
|||||||
targ.Level = map;
|
targ.Level = map;
|
||||||
_infoText = string.Empty;
|
_infoText = string.Empty;
|
||||||
}
|
}
|
||||||
private void Load()
|
private async void Load()
|
||||||
{
|
{
|
||||||
var targ = (LevelEditor)target;
|
var targ = (LevelEditor)target;
|
||||||
if (!targ.Level)
|
if (!targ.Level)
|
||||||
@ -123,7 +123,7 @@ Important considerations :
|
|||||||
tilemap.tileAnchor = Vector3.zero;
|
tilemap.tileAnchor = Vector3.zero;
|
||||||
tilemap.gameObject.AddComponent<TilemapRenderer>();
|
tilemap.gameObject.AddComponent<TilemapRenderer>();
|
||||||
tilemap.transform.SetParent(targ.transform);
|
tilemap.transform.SetParent(targ.transform);
|
||||||
tilemapData.LoadToTilemap(tilemap);
|
await tilemapData.LoadToTilemap(tilemap);
|
||||||
}
|
}
|
||||||
_infoText = string.Empty;
|
_infoText = string.Empty;
|
||||||
EditorSceneManager.MarkAllScenesDirty();
|
EditorSceneManager.MarkAllScenesDirty();
|
||||||
|
|||||||
51
Assets/Editor/SceneDrawer.cs
Normal file
51
Assets/Editor/SceneDrawer.cs
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
[CustomPropertyDrawer(typeof(SceneAttribute))]
|
||||||
|
public class SceneDrawer : PropertyDrawer
|
||||||
|
{
|
||||||
|
|
||||||
|
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (property.propertyType == SerializedPropertyType.String)
|
||||||
|
{
|
||||||
|
var sceneObject = GetSceneObject(property.stringValue);
|
||||||
|
var scene = EditorGUI.ObjectField(position, label, sceneObject, typeof(SceneAsset), true);
|
||||||
|
if (scene == null)
|
||||||
|
{
|
||||||
|
property.stringValue = "";
|
||||||
|
}
|
||||||
|
else if (scene.name != property.stringValue)
|
||||||
|
{
|
||||||
|
var sceneObj = GetSceneObject(scene.name);
|
||||||
|
if (sceneObj == null)
|
||||||
|
{
|
||||||
|
Debug.LogWarning("The scene " + scene.name + " cannot be used. To use this scene add it to the build settings for the project");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
property.stringValue = scene.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
EditorGUI.LabelField(position, label.text, "Use [Scene] with strings.");
|
||||||
|
}
|
||||||
|
protected SceneAsset GetSceneObject(string sceneObjectName)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(sceneObjectName))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var editorScene in EditorBuildSettings.scenes)
|
||||||
|
{
|
||||||
|
if (editorScene.path.IndexOf(sceneObjectName) != -1)
|
||||||
|
{
|
||||||
|
return AssetDatabase.LoadAssetAtPath(editorScene.path, typeof(SceneAsset)) as SceneAsset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Debug.LogWarning("Scene [" + sceneObjectName + "] cannot be used. Add this scene to the 'Scenes in the Build' in build settings.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Editor/SceneDrawer.cs.meta
Normal file
11
Assets/Editor/SceneDrawer.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 389cc3c423055324fb8d7de50f62f709
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Assets/Nuage.png
Normal file
BIN
Assets/Nuage.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 922 B |
147
Assets/Nuage.png.meta
Normal file
147
Assets/Nuage.png.meta
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d5c46c86f0bc20847ba28d9f215cce42
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 12
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
vTOnly: 0
|
||||||
|
ignoreMasterTextureLimit: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 0
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 10
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
flipbookRows: 1
|
||||||
|
flipbookColumns: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
ignorePngGamma: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
cookieLightType: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Server
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Android
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
nameFileIdTable: {}
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
109
Assets/Prefabs/UI/UICloud.prefab
Normal file
109
Assets/Prefabs/UI/UICloud.prefab
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &4897909026855453892
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 4897909026855453895}
|
||||||
|
- component: {fileID: 4897909026855453888}
|
||||||
|
- component: {fileID: 4897909026855453889}
|
||||||
|
- component: {fileID: 4897909026855453894}
|
||||||
|
- component: {fileID: 1209880087491985449}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: UICloud
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &4897909026855453895
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4897909026855453892}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
|
m_SizeDelta: {x: 1392, y: 683}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!222 &4897909026855453888
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4897909026855453892}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!114 &4897909026855453889
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4897909026855453892}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
m_RaycastTarget: 1
|
||||||
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
m_Maskable: 1
|
||||||
|
m_OnCullStateChanged:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
m_Sprite: {fileID: 21300000, guid: 73b56022ea22aa34fa14d354f2264194, type: 3}
|
||||||
|
m_Type: 0
|
||||||
|
m_PreserveAspect: 0
|
||||||
|
m_FillCenter: 1
|
||||||
|
m_FillMethod: 4
|
||||||
|
m_FillAmount: 1
|
||||||
|
m_FillClockwise: 1
|
||||||
|
m_FillOrigin: 0
|
||||||
|
m_UseSpriteMesh: 0
|
||||||
|
m_PixelsPerUnitMultiplier: 1
|
||||||
|
--- !u!225 &4897909026855453894
|
||||||
|
CanvasGroup:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4897909026855453892}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_Alpha: 0
|
||||||
|
m_Interactable: 0
|
||||||
|
m_BlocksRaycasts: 0
|
||||||
|
m_IgnoreParentGroups: 1
|
||||||
|
--- !u!114 &1209880087491985449
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4897909026855453892}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 53b285ec0113524479b4bcd7a30632bf, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
properties:
|
||||||
|
fadeInTime: 1
|
||||||
|
stayTime: 1
|
||||||
|
fadeOutTime: 1
|
||||||
|
speed: 1
|
||||||
7
Assets/Prefabs/UI/UICloud.prefab.meta
Normal file
7
Assets/Prefabs/UI/UICloud.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3918c7d48763f184a92c7d61380ca258
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
File diff suppressed because it is too large
Load Diff
390
Assets/Scenes/LoadingScreen.unity
Normal file
390
Assets/Scenes/LoadingScreen.unity
Normal file
@ -0,0 +1,390 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!29 &1
|
||||||
|
OcclusionCullingSettings:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_OcclusionBakeSettings:
|
||||||
|
smallestOccluder: 5
|
||||||
|
smallestHole: 0.25
|
||||||
|
backfaceThreshold: 100
|
||||||
|
m_SceneGUID: 00000000000000000000000000000000
|
||||||
|
m_OcclusionCullingData: {fileID: 0}
|
||||||
|
--- !u!104 &2
|
||||||
|
RenderSettings:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 9
|
||||||
|
m_Fog: 0
|
||||||
|
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||||
|
m_FogMode: 3
|
||||||
|
m_FogDensity: 0.01
|
||||||
|
m_LinearFogStart: 0
|
||||||
|
m_LinearFogEnd: 300
|
||||||
|
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||||
|
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||||
|
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||||
|
m_AmbientIntensity: 1
|
||||||
|
m_AmbientMode: 3
|
||||||
|
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||||
|
m_SkyboxMaterial: {fileID: 0}
|
||||||
|
m_HaloStrength: 0.5
|
||||||
|
m_FlareStrength: 1
|
||||||
|
m_FlareFadeSpeed: 3
|
||||||
|
m_HaloTexture: {fileID: 0}
|
||||||
|
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_DefaultReflectionMode: 0
|
||||||
|
m_DefaultReflectionResolution: 128
|
||||||
|
m_ReflectionBounces: 1
|
||||||
|
m_ReflectionIntensity: 1
|
||||||
|
m_CustomReflection: {fileID: 0}
|
||||||
|
m_Sun: {fileID: 0}
|
||||||
|
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
|
m_UseRadianceAmbientProbe: 0
|
||||||
|
--- !u!157 &3
|
||||||
|
LightmapSettings:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 12
|
||||||
|
m_GIWorkflowMode: 1
|
||||||
|
m_GISettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_BounceScale: 1
|
||||||
|
m_IndirectOutputScale: 1
|
||||||
|
m_AlbedoBoost: 1
|
||||||
|
m_EnvironmentLightingMode: 0
|
||||||
|
m_EnableBakedLightmaps: 0
|
||||||
|
m_EnableRealtimeLightmaps: 0
|
||||||
|
m_LightmapEditorSettings:
|
||||||
|
serializedVersion: 12
|
||||||
|
m_Resolution: 2
|
||||||
|
m_BakeResolution: 40
|
||||||
|
m_AtlasSize: 1024
|
||||||
|
m_AO: 0
|
||||||
|
m_AOMaxDistance: 1
|
||||||
|
m_CompAOExponent: 1
|
||||||
|
m_CompAOExponentDirect: 0
|
||||||
|
m_ExtractAmbientOcclusion: 0
|
||||||
|
m_Padding: 2
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_LightmapsBakeMode: 1
|
||||||
|
m_TextureCompression: 1
|
||||||
|
m_FinalGather: 0
|
||||||
|
m_FinalGatherFiltering: 1
|
||||||
|
m_FinalGatherRayCount: 256
|
||||||
|
m_ReflectionCompression: 2
|
||||||
|
m_MixedBakeMode: 2
|
||||||
|
m_BakeBackend: 1
|
||||||
|
m_PVRSampling: 1
|
||||||
|
m_PVRDirectSampleCount: 32
|
||||||
|
m_PVRSampleCount: 512
|
||||||
|
m_PVRBounces: 2
|
||||||
|
m_PVREnvironmentSampleCount: 256
|
||||||
|
m_PVREnvironmentReferencePointCount: 2048
|
||||||
|
m_PVRFilteringMode: 1
|
||||||
|
m_PVRDenoiserTypeDirect: 1
|
||||||
|
m_PVRDenoiserTypeIndirect: 1
|
||||||
|
m_PVRDenoiserTypeAO: 1
|
||||||
|
m_PVRFilterTypeDirect: 0
|
||||||
|
m_PVRFilterTypeIndirect: 0
|
||||||
|
m_PVRFilterTypeAO: 0
|
||||||
|
m_PVREnvironmentMIS: 1
|
||||||
|
m_PVRCulling: 1
|
||||||
|
m_PVRFilteringGaussRadiusDirect: 1
|
||||||
|
m_PVRFilteringGaussRadiusIndirect: 5
|
||||||
|
m_PVRFilteringGaussRadiusAO: 2
|
||||||
|
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||||
|
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||||
|
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||||
|
m_ExportTrainingData: 0
|
||||||
|
m_TrainingDataDestination: TrainingData
|
||||||
|
m_LightProbeSampleCountMultiplier: 4
|
||||||
|
m_LightingDataAsset: {fileID: 0}
|
||||||
|
m_LightingSettings: {fileID: 0}
|
||||||
|
--- !u!196 &4
|
||||||
|
NavMeshSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_BuildSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
agentTypeID: 0
|
||||||
|
agentRadius: 0.5
|
||||||
|
agentHeight: 2
|
||||||
|
agentSlope: 45
|
||||||
|
agentClimb: 0.4
|
||||||
|
ledgeDropHeight: 0
|
||||||
|
maxJumpAcrossDistance: 0
|
||||||
|
minRegionArea: 2
|
||||||
|
manualCellSize: 0
|
||||||
|
cellSize: 0.16666667
|
||||||
|
manualTileSize: 0
|
||||||
|
tileSize: 256
|
||||||
|
accuratePlacement: 0
|
||||||
|
maxJobWorkers: 0
|
||||||
|
preserveTilesOutsideBounds: 0
|
||||||
|
debug:
|
||||||
|
m_Flags: 0
|
||||||
|
m_NavMeshData: {fileID: 0}
|
||||||
|
--- !u!1 &16265664
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 16265668}
|
||||||
|
- component: {fileID: 16265667}
|
||||||
|
- component: {fileID: 16265666}
|
||||||
|
- component: {fileID: 16265665}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: UI
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!114 &16265665
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 16265664}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_IgnoreReversedGraphics: 1
|
||||||
|
m_BlockingObjects: 0
|
||||||
|
m_BlockingMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
--- !u!114 &16265666
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 16265664}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_UiScaleMode: 1
|
||||||
|
m_ReferencePixelsPerUnit: 100
|
||||||
|
m_ScaleFactor: 1
|
||||||
|
m_ReferenceResolution: {x: 1920, y: 1080}
|
||||||
|
m_ScreenMatchMode: 0
|
||||||
|
m_MatchWidthOrHeight: 0
|
||||||
|
m_PhysicalUnit: 3
|
||||||
|
m_FallbackScreenDPI: 96
|
||||||
|
m_DefaultSpriteDPI: 96
|
||||||
|
m_DynamicPixelsPerUnit: 1
|
||||||
|
m_PresetInfoIsWorld: 0
|
||||||
|
--- !u!223 &16265667
|
||||||
|
Canvas:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 16265664}
|
||||||
|
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: 25
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
m_TargetDisplay: 0
|
||||||
|
--- !u!224 &16265668
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 16265664}
|
||||||
|
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_ConstrainProportionsScale: 0
|
||||||
|
m_Children:
|
||||||
|
- {fileID: 1991489726}
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
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!1 &444904903
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 444904904}
|
||||||
|
- component: {fileID: 444904907}
|
||||||
|
- component: {fileID: 444904906}
|
||||||
|
- component: {fileID: 444904905}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: Screen
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &444904904
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 444904903}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 1991489726}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!225 &444904905
|
||||||
|
CanvasGroup:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 444904903}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_Alpha: 0
|
||||||
|
m_Interactable: 0
|
||||||
|
m_BlocksRaycasts: 0
|
||||||
|
m_IgnoreParentGroups: 1
|
||||||
|
--- !u!114 &444904906
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 444904903}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_Color: {r: 0.19215688, g: 0.3019608, b: 0.47058827, a: 1}
|
||||||
|
m_RaycastTarget: 1
|
||||||
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
m_Maskable: 1
|
||||||
|
m_OnCullStateChanged:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
m_Sprite: {fileID: 0}
|
||||||
|
m_Type: 0
|
||||||
|
m_PreserveAspect: 0
|
||||||
|
m_FillCenter: 1
|
||||||
|
m_FillMethod: 4
|
||||||
|
m_FillAmount: 1
|
||||||
|
m_FillClockwise: 1
|
||||||
|
m_FillOrigin: 0
|
||||||
|
m_UseSpriteMesh: 0
|
||||||
|
m_PixelsPerUnitMultiplier: 1
|
||||||
|
--- !u!222 &444904907
|
||||||
|
CanvasRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 444904903}
|
||||||
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!1 &1991489725
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1991489726}
|
||||||
|
- component: {fileID: 1991489727}
|
||||||
|
- component: {fileID: 1991489728}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: LoadingScreen
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!224 &1991489726
|
||||||
|
RectTransform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1991489725}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children:
|
||||||
|
- {fileID: 444904904}
|
||||||
|
m_Father: {fileID: 16265668}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
|
--- !u!114 &1991489727
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1991489725}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 8a9b542d59e659741b005556831a3390, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
blueScreen: {fileID: 444904905}
|
||||||
|
fadeInDuration: 1
|
||||||
|
fadeOutDuration: 2
|
||||||
|
cloudPrefab: {fileID: 4897909026855453892, guid: 3918c7d48763f184a92c7d61380ca258, type: 3}
|
||||||
|
maxClouds: 10
|
||||||
|
cloudProperties:
|
||||||
|
fadeInTime: 2
|
||||||
|
stayTime: 10
|
||||||
|
fadeOutTime: 1
|
||||||
|
speed: 20
|
||||||
|
--- !u!114 &1991489728
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1991489725}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: aef75be033508a4498fa7f546d6ebef2, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
_gameScene: Game
|
||||||
|
_sceneSelection: LevelSelect
|
||||||
7
Assets/Scenes/LoadingScreen.unity.meta
Normal file
7
Assets/Scenes/LoadingScreen.unity.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6da14f6006606f840b2df7664c50e1ec
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
50
Assets/Scripts/CloudAnimation.cs
Normal file
50
Assets/Scripts/CloudAnimation.cs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using static Codice.Client.Common.WebApi.WebApiEndpoints;
|
||||||
|
|
||||||
|
public class CloudAnimation : MonoBehaviour
|
||||||
|
{
|
||||||
|
[System.Serializable]
|
||||||
|
public class Properties
|
||||||
|
{
|
||||||
|
public float fadeInTime = 1;
|
||||||
|
public float stayTime = 1;
|
||||||
|
public float fadeOutTime = 1;
|
||||||
|
public float speed = 1;
|
||||||
|
}
|
||||||
|
CanvasGroup canvasGroup;
|
||||||
|
public Properties properties;
|
||||||
|
private Coroutine coroutine;
|
||||||
|
// Start is called before the first frame update
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
canvasGroup = GetComponent<CanvasGroup>();
|
||||||
|
coroutine = StartCoroutine(AnimateCloud());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Kill()
|
||||||
|
{
|
||||||
|
StopCoroutine(coroutine);
|
||||||
|
StartCoroutine(KillCloud());
|
||||||
|
}
|
||||||
|
IEnumerator AnimateCloud()
|
||||||
|
{
|
||||||
|
|
||||||
|
canvasGroup.alpha = 0;
|
||||||
|
yield return canvasGroup.FadeTo(1, properties.fadeInTime);
|
||||||
|
yield return new WaitForSeconds(properties.stayTime);
|
||||||
|
yield return KillCloud();
|
||||||
|
}
|
||||||
|
IEnumerator KillCloud()
|
||||||
|
{
|
||||||
|
yield return canvasGroup.FadeTo(0, properties.fadeOutTime);
|
||||||
|
Destroy(gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
transform.position += properties.speed * Time.deltaTime * Vector3.left * Camera.main.orthographicSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/CloudAnimation.cs.meta
Normal file
11
Assets/Scripts/CloudAnimation.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 53b285ec0113524479b4bcd7a30632bf
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -5,9 +5,17 @@ using UnityEngine;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using GatherAndDefend.LevelEditor;
|
using GatherAndDefend.LevelEditor;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
public static class Extensions
|
public static class Extensions
|
||||||
{
|
{
|
||||||
|
public static async Task WaitWhile(Func<bool> untilTrue)
|
||||||
|
{
|
||||||
|
while (untilTrue?.Invoke() == false)
|
||||||
|
{
|
||||||
|
await Task.Yield();
|
||||||
|
}
|
||||||
|
}
|
||||||
public static T[] GetAllComponents<T>(this Component component) where T : Component
|
public static T[] GetAllComponents<T>(this Component component) where T : Component
|
||||||
{
|
{
|
||||||
List<T> comps = new List<T>();
|
List<T> comps = new List<T>();
|
||||||
@ -97,7 +105,12 @@ public static class Extensions
|
|||||||
{
|
{
|
||||||
return Vector2.Distance(vect, tilePosition) < 0.5f;
|
return Vector2.Distance(vect, tilePosition) < 0.5f;
|
||||||
}
|
}
|
||||||
|
public static Vector2 RandomInRectangle(float x, float y)
|
||||||
|
{
|
||||||
|
var randX = UnityEngine.Random.Range(0, x);
|
||||||
|
var randY = UnityEngine.Random.Range(0, y);
|
||||||
|
return new Vector2(randX, randY);
|
||||||
|
}
|
||||||
public static T Minimum<T>(this IEnumerable<T> list, Func<T, float> func)
|
public static T Minimum<T>(this IEnumerable<T> list, Func<T, float> func)
|
||||||
{
|
{
|
||||||
if (list.Count() < 1) throw new Exception("in " + nameof(Minimum) + " : Cannot find minimum of empty list : " + nameof(list));
|
if (list.Count() < 1) throw new Exception("in " + nameof(Minimum) + " : Cannot find minimum of empty list : " + nameof(list));
|
||||||
@ -115,4 +128,16 @@ public static class Extensions
|
|||||||
}
|
}
|
||||||
return minT;
|
return minT;
|
||||||
}
|
}
|
||||||
|
public static IEnumerator FadeTo(this CanvasGroup item, float value, float duration)
|
||||||
|
{
|
||||||
|
var delta = value - item.alpha;
|
||||||
|
var direction = Mathf.Sign(delta);
|
||||||
|
|
||||||
|
while (Mathf.Abs(value - item.alpha) > 0)
|
||||||
|
{
|
||||||
|
item.alpha += Time.deltaTime * direction / duration;
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
item.alpha = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
12
Assets/Scripts/General/Reference.cs
Normal file
12
Assets/Scripts/General/Reference.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
public class Reference<T>
|
||||||
|
{
|
||||||
|
private T _value;
|
||||||
|
public T Value { get => _value; set => _value = value; }
|
||||||
|
public Reference() : this(default) { }
|
||||||
|
public Reference(T initial = default)
|
||||||
|
{
|
||||||
|
_value = initial;
|
||||||
|
}
|
||||||
|
public static implicit operator Reference<T>(T value) => new Reference<T>(value);
|
||||||
|
public static implicit operator T(Reference<T> reference) => reference.Value;
|
||||||
|
}
|
||||||
11
Assets/Scripts/General/Reference.cs.meta
Normal file
11
Assets/Scripts/General/Reference.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e003bd06f19862c4cbbea35f38821ae6
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
39
Assets/Scripts/GlobalOffset.cs
Normal file
39
Assets/Scripts/GlobalOffset.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class GlobalOffset : MonoBehaviour
|
||||||
|
{
|
||||||
|
private Vector2 oldOffset;
|
||||||
|
[field:SerializeField]
|
||||||
|
public Vector2 Offset { get; set; }
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
oldOffset = Offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OffsetChanged()
|
||||||
|
{
|
||||||
|
foreach (var obj in gameObject.scene.GetRootGameObjects())
|
||||||
|
{
|
||||||
|
Translate(obj.transform);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void Translate(Transform transform)
|
||||||
|
{
|
||||||
|
foreach(Transform t in transform) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
if (oldOffset != Offset)
|
||||||
|
{
|
||||||
|
OffsetChanged();
|
||||||
|
oldOffset = Offset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/GlobalOffset.cs.meta
Normal file
11
Assets/Scripts/GlobalOffset.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9b1d84852c45a8f418185efb2a5fa1c9
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
29
Assets/Scripts/GoToScene.cs
Normal file
29
Assets/Scripts/GoToScene.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
|
public class GoToScene : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField]
|
||||||
|
private bool _useLoadingScreen = true;
|
||||||
|
[SerializeField][Scene]
|
||||||
|
private string _loadingScreenScene;
|
||||||
|
[SerializeField][Scene]
|
||||||
|
private string _sceneToLoad;
|
||||||
|
[SerializeField]
|
||||||
|
private int _levelToLoad;
|
||||||
|
public void Execute()
|
||||||
|
{
|
||||||
|
if (_useLoadingScreen)
|
||||||
|
{
|
||||||
|
PlayerPrefs.SetString(LoadingManager.SceneToLoad, _sceneToLoad);
|
||||||
|
PlayerPrefs.SetInt(LoadingManager.LevelToLoad, _levelToLoad);
|
||||||
|
SceneManager.LoadScene(_loadingScreenScene, LoadSceneMode.Additive);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SceneManager.LoadScene(_sceneToLoad);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/GoToScene.cs.meta
Normal file
11
Assets/Scripts/GoToScene.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a71d8cb1374fce94592f4b1c232f38d8
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -19,12 +19,12 @@ namespace GatherAndDefend.LevelEditor
|
|||||||
data.SaveFromTilemap(tilemap);
|
data.SaveFromTilemap(tilemap);
|
||||||
_data.Add(data);
|
_data.Add(data);
|
||||||
}
|
}
|
||||||
public void LoadToTilemap(Tilemap tilemap)
|
public async void LoadToTilemap(Tilemap tilemap)
|
||||||
{
|
{
|
||||||
var data = _data.Find(x => x.Key == tilemap.name);
|
var data = _data.Find(x => x.Key == tilemap.name);
|
||||||
if (data == null) return;
|
if (data == null) return;
|
||||||
|
|
||||||
data.LoadToTilemap(tilemap);
|
await data.LoadToTilemap(tilemap);
|
||||||
}
|
}
|
||||||
public WaveConfig WaveConfig { get { return _waveConfig; } }
|
public WaveConfig WaveConfig { get { return _waveConfig; } }
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ using System;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace GatherAndDefend.LevelEditor
|
namespace GatherAndDefend.LevelEditor
|
||||||
{
|
{
|
||||||
@ -33,8 +34,10 @@ namespace GatherAndDefend.LevelEditor
|
|||||||
|
|
||||||
public string Key => _key;
|
public string Key => _key;
|
||||||
|
|
||||||
public void LoadToTilemap(Tilemap reference)
|
public async Task LoadToTilemap(Tilemap reference, PlacementAnimationHandler placementAnimation = null, Reference<bool> allTilesSpawned = default, Func<float> tileSpawnAcceleration = default)
|
||||||
{
|
{
|
||||||
|
if (tileSpawnAcceleration == default) tileSpawnAcceleration = () => 1;
|
||||||
|
const int tilesPerSecond = 15;
|
||||||
reference.transform.localPosition = _position;
|
reference.transform.localPosition = _position;
|
||||||
reference.transform.localScale = _scale;
|
reference.transform.localScale = _scale;
|
||||||
|
|
||||||
@ -48,10 +51,14 @@ namespace GatherAndDefend.LevelEditor
|
|||||||
collision.isTrigger = _isTrigger;
|
collision.isTrigger = _isTrigger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var tasks = new List<Task>();
|
||||||
foreach (TileData data in _tiles)
|
foreach (TileData data in _tiles)
|
||||||
{
|
{
|
||||||
reference.SetTile(data.Position, data.Tile);
|
tasks.Add(placementAnimation(data.Position, data.Tile, () => reference.SetTile(data.Position, data.Tile)));
|
||||||
|
await Task.Delay((int)(1000f / (tilesPerSecond * tileSpawnAcceleration())));
|
||||||
}
|
}
|
||||||
|
if (allTilesSpawned != null) allTilesSpawned.Value = true;
|
||||||
|
await Task.WhenAll(tasks);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// saves a tilemap into the level object
|
/// saves a tilemap into the level object
|
||||||
|
|||||||
@ -6,6 +6,8 @@ using UnityEngine;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// data class for containing everything level related
|
/// data class for containing everything level related
|
||||||
@ -50,6 +52,8 @@ public class LevelManager : Singleton<LevelManager>
|
|||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool Loading { get; private set; } = false;
|
||||||
|
|
||||||
public LevelManager()
|
public LevelManager()
|
||||||
{
|
{
|
||||||
_toAdd = new List<ILevelObject>();
|
_toAdd = new List<ILevelObject>();
|
||||||
@ -143,8 +147,11 @@ public class LevelManager : Singleton<LevelManager>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="level">le niveau à loader</param>
|
/// <param name="level">le niveau à loader</param>
|
||||||
/// <param name="shouldClear">est ce qu'on veut effacer ce qui est déjà là?</param>
|
/// <param name="shouldClear">est ce qu'on veut effacer ce qui est déjà là?</param>
|
||||||
public void LoadLevel(Level level, bool shouldClear = false)
|
public async Task LoadLevel(Level level, bool shouldClear = false, PlacementAnimationHandler placementAnimation = null)
|
||||||
{
|
{
|
||||||
|
float tileSpawnAcceleration = 1;
|
||||||
|
float tileSpawnAccelerationFunc() => (tileSpawnAcceleration += Time.deltaTime);
|
||||||
|
|
||||||
if (shouldClear)
|
if (shouldClear)
|
||||||
{
|
{
|
||||||
ClearLevel();
|
ClearLevel();
|
||||||
@ -170,16 +177,21 @@ public class LevelManager : Singleton<LevelManager>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var tasks = new List<Task>();
|
||||||
//generate all tilemaps
|
//generate all tilemaps
|
||||||
foreach (TilemapData tilemapData in _currentLevel)
|
foreach (TilemapData tilemapData in _currentLevel)
|
||||||
{
|
{
|
||||||
var tilemap = new GameObject(tilemapData.Key).AddComponent<Tilemap>();
|
var tilemap = new GameObject(tilemapData.Key).AddComponent<Tilemap>();
|
||||||
tilemap.tileAnchor = Vector3.zero;
|
tilemap.tileAnchor = Vector3.zero;
|
||||||
tilemap.gameObject.AddComponent<TilemapRenderer>();
|
tilemap.gameObject.AddComponent<TilemapRenderer>();
|
||||||
tilemapData.LoadToTilemap(tilemap);
|
|
||||||
tilemap.transform.SetParent(grid.transform);
|
tilemap.transform.SetParent(grid.transform);
|
||||||
|
|
||||||
|
Reference<bool> allTileSpawned = false;
|
||||||
|
tasks.Add(tilemapData.LoadToTilemap(tilemap, placementAnimation, allTileSpawned, tileSpawnAccelerationFunc));
|
||||||
|
await Extensions.WaitWhile(() => allTileSpawned);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await Task.WhenAll(tasks);
|
||||||
LevelLoaded?.Invoke(level);
|
LevelLoaded?.Invoke(level);
|
||||||
Debug.Log("level loaded successfully");
|
Debug.Log("level loaded successfully");
|
||||||
}
|
}
|
||||||
@ -189,7 +201,7 @@ public class LevelManager : Singleton<LevelManager>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="levelName">le nom du niveau à loader</param>
|
/// <param name="levelName">le nom du niveau à loader</param>
|
||||||
/// <param name="shouldClear">est ce qu'on veut effacer ce qui est déjà là?</param>
|
/// <param name="shouldClear">est ce qu'on veut effacer ce qui est déjà là?</param>
|
||||||
public void LoadLevel(string levelName, bool shouldClear = false)
|
public async Task LoadLevel(string levelName, bool shouldClear = false, PlacementAnimationHandler placementAnimation = null)
|
||||||
{
|
{
|
||||||
if (shouldClear)
|
if (shouldClear)
|
||||||
{
|
{
|
||||||
@ -199,7 +211,7 @@ public class LevelManager : Singleton<LevelManager>
|
|||||||
//fetch level from database
|
//fetch level from database
|
||||||
_currentLevel = Database.Instance.ScriptableObjects[levelName] as Level;
|
_currentLevel = Database.Instance.ScriptableObjects[levelName] as Level;
|
||||||
|
|
||||||
LoadLevel(_currentLevel, shouldClear);
|
await LoadLevel(_currentLevel, shouldClear, placementAnimation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveFile()
|
public void SaveFile()
|
||||||
|
|||||||
@ -1,34 +1,79 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using GatherAndDefend.LevelEditor;
|
||||||
using Level = GatherAndDefend.LevelEditor.Level;
|
using System.Collections;
|
||||||
public class LevelManagerScript : MonoBehaviour
|
using UnityEngine.Tilemaps;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
public delegate Task PlacementAnimationHandler(Vector3 position, TileBase tile, Action tilePlacement);
|
||||||
|
public class LevelManagerScript : SingletonBehaviour<LevelManagerScript>
|
||||||
{
|
{
|
||||||
[Scene][SerializeField]
|
private Action updateAction = null;
|
||||||
private string _gameScene;
|
public bool loadOnStart = false;
|
||||||
[SerializeField]
|
public Level firstLevel;
|
||||||
private Level _firstLevel;
|
async void Start()
|
||||||
private void Start()
|
|
||||||
{
|
{
|
||||||
LevelManager.Instance.LevelTransform = transform;
|
LevelManager.Instance.LevelLoaded += Instance_LevelLoaded;
|
||||||
int levelToLoadFromWorldMap = PlayerPrefs.GetInt("LevelToLoad", -1);
|
if (loadOnStart && firstLevel)
|
||||||
if (levelToLoadFromWorldMap != -1)
|
|
||||||
{
|
{
|
||||||
string lvlName = $"Level{levelToLoadFromWorldMap}";
|
await LevelManager.Instance.LoadLevel(firstLevel, placementAnimation: PlacementAnimation);
|
||||||
LevelManager.Instance.LoadLevel(lvlName, true);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else if (_firstLevel)
|
|
||||||
{
|
|
||||||
LevelManager.Instance.LoadLevel(_firstLevel, true);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
void OnDestroy()
|
||||||
{
|
{
|
||||||
Debug.LogWarning("there is no first level set in the level manager script");
|
updateAction = null;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
LevelManager.Instance.UpdateLevel();
|
updateAction?.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Instance_LevelLoaded(Level level)
|
||||||
|
{
|
||||||
|
updateAction = LevelManager.Instance.UpdateLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task PlacementAnimation(Vector3 position, TileBase tile, System.Action putTileOnTilemap)
|
||||||
|
{
|
||||||
|
float speed = 0;
|
||||||
|
float acceleration = -9.81f;
|
||||||
|
var tilePlaceholder = new GameObject("tile");
|
||||||
|
var rend = tilePlaceholder.AddComponent<SpriteRenderer>();
|
||||||
|
rend.sortingOrder = 10;
|
||||||
|
rend.sortingLayerName = "Unit";
|
||||||
|
|
||||||
|
if (tile is LevelTile)
|
||||||
|
{
|
||||||
|
rend.sprite = (tile as LevelTile).Sprite;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rend.sprite = (tile as Tile).sprite;
|
||||||
|
}
|
||||||
|
|
||||||
|
tilePlaceholder.transform.position = position + Vector3.up * Camera.main.orthographicSize * 2;
|
||||||
|
|
||||||
|
var delta = tilePlaceholder.transform.position - position;
|
||||||
|
var direction = delta.normalized;
|
||||||
|
var signY = delta.y / Mathf.Abs(delta.y);
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if (!tilePlaceholder) break;
|
||||||
|
|
||||||
|
speed += acceleration * Time.deltaTime;
|
||||||
|
tilePlaceholder.transform.position += direction * Time.deltaTime * speed;
|
||||||
|
var newDelta = tilePlaceholder.transform.position - position;
|
||||||
|
var newSign = newDelta.y / Mathf.Abs(newDelta.y);
|
||||||
|
|
||||||
|
if (newSign != signY) break;
|
||||||
|
|
||||||
|
await Task.Yield();
|
||||||
|
}
|
||||||
|
|
||||||
|
putTileOnTilemap.Invoke();
|
||||||
|
Destroy(tilePlaceholder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
81
Assets/Scripts/LoadingManager.cs
Normal file
81
Assets/Scripts/LoadingManager.cs
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// manages the logic of loading
|
||||||
|
/// </summary>
|
||||||
|
public class LoadingManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
public const string LevelToLoad = nameof(LevelToLoad);
|
||||||
|
public const string SceneToLoad = nameof(SceneToLoad);
|
||||||
|
public const int NoLevel = -1;
|
||||||
|
|
||||||
|
private LoadingScreen loadingScreen;
|
||||||
|
|
||||||
|
public float testAddedTime = 5;
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
loadingScreen = GetComponent<LoadingScreen>();
|
||||||
|
loadingScreen.ScreenActivated += StartLoadingGameScene;
|
||||||
|
loadingScreen.ShowLoadingScreen();
|
||||||
|
}
|
||||||
|
private void StartLoadingGameScene()
|
||||||
|
{
|
||||||
|
StartCoroutine(LoadSceneAfterTime());
|
||||||
|
|
||||||
|
IEnumerator LoadSceneAfterTime()
|
||||||
|
{
|
||||||
|
yield return new WaitForSeconds(testAddedTime);
|
||||||
|
|
||||||
|
loadingScreen.ScreenActivated -= StartLoadingGameScene;
|
||||||
|
SceneManager.sceneLoaded += StartHidingLoadingScreen;
|
||||||
|
|
||||||
|
var sceneToLoad = PlayerPrefs.GetString(SceneToLoad);
|
||||||
|
|
||||||
|
//unload all scenes except loading screen
|
||||||
|
for (int i = 0; i < SceneManager.sceneCount; i++)
|
||||||
|
{
|
||||||
|
var scene = SceneManager.GetSceneAt(i);
|
||||||
|
if (scene.name == gameObject.scene.name) continue;
|
||||||
|
SceneManager.UnloadSceneAsync(scene.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
SceneManager.LoadScene(sceneToLoad, LoadSceneMode.Additive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void StartHidingLoadingScreen(Scene arg0, LoadSceneMode arg1)
|
||||||
|
{
|
||||||
|
SceneManager.sceneLoaded -= StartHidingLoadingScreen;
|
||||||
|
loadingScreen.ScreenDeactivated += StartLoadingLevel;
|
||||||
|
loadingScreen.HideLoadingScreen();
|
||||||
|
}
|
||||||
|
private async void StartLoadingLevel()
|
||||||
|
{
|
||||||
|
loadingScreen.ScreenDeactivated -= StartLoadingLevel;
|
||||||
|
LevelManager.Instance.LevelLoaded += UnloadLoadingScreenScene;
|
||||||
|
|
||||||
|
var levelToLoad = PlayerPrefs.GetInt(LevelToLoad, NoLevel);
|
||||||
|
if (levelToLoad == NoLevel)
|
||||||
|
{
|
||||||
|
UnloadLoadingScreenScene(null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string lvlName = $"Level{levelToLoad}";
|
||||||
|
await LevelManager.Instance.LoadLevel(lvlName, true, LevelManagerScript.PlacementAnimation);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
private void UnloadLoadingScreenScene(GatherAndDefend.LevelEditor.Level level)
|
||||||
|
{
|
||||||
|
LevelManager.Instance.LevelLoaded -= UnloadLoadingScreenScene;
|
||||||
|
SceneManager.UnloadSceneAsync(gameObject.scene.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
11
Assets/Scripts/LoadingManager.cs.meta
Normal file
11
Assets/Scripts/LoadingManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: aef75be033508a4498fa7f546d6ebef2
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
81
Assets/Scripts/LoadingScreen.cs
Normal file
81
Assets/Scripts/LoadingScreen.cs
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
using UnityEditor;
|
||||||
|
[CustomEditor(typeof(LoadingScreen))]
|
||||||
|
public class LoadingScreenEditor : Editor
|
||||||
|
{
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
DrawDefaultInspector();
|
||||||
|
if (!Application.isPlaying) return;
|
||||||
|
if (GUILayout.Button("start"))
|
||||||
|
{
|
||||||
|
(target as LoadingScreen).ShowLoadingScreen();
|
||||||
|
}
|
||||||
|
else if (GUILayout.Button("stop"))
|
||||||
|
{
|
||||||
|
(target as LoadingScreen).HideLoadingScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// the view-model associated with the loading screen view.
|
||||||
|
/// </summary>
|
||||||
|
public class LoadingScreen : SingletonBehaviour<LoadingScreen>
|
||||||
|
{
|
||||||
|
public event System.Action ScreenActivated;
|
||||||
|
public event System.Action ScreenDeactivated;
|
||||||
|
|
||||||
|
[Header("Screen")]
|
||||||
|
public CanvasGroup blueScreen;
|
||||||
|
public float fadeInDuration = 1;
|
||||||
|
public float fadeOutDuration = 1;
|
||||||
|
|
||||||
|
public GameObject cloudPrefab;
|
||||||
|
public int maxClouds = 10;
|
||||||
|
public CloudAnimation.Properties cloudProperties;
|
||||||
|
private List<CloudAnimation> clouds = new List<CloudAnimation>();
|
||||||
|
private Coroutine screenCoroutine, cloudCoroutine;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private IEnumerator SpawnClouds()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
var randPos = Extensions.RandomInRectangle(Screen.width + 100, Screen.height - 100);
|
||||||
|
var cloudInstance = Instantiate(cloudPrefab, randPos, Quaternion.identity);
|
||||||
|
cloudInstance.transform.SetParent(transform);
|
||||||
|
var cloudComponent = cloudInstance.GetComponent<CloudAnimation>();
|
||||||
|
|
||||||
|
cloudComponent.properties = cloudProperties;
|
||||||
|
clouds.Add(cloudComponent);
|
||||||
|
yield return new WaitForSeconds(fadeInDuration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private IEnumerator EnableLoadingScreen()
|
||||||
|
{
|
||||||
|
yield return blueScreen.FadeTo(1, fadeInDuration);
|
||||||
|
ScreenActivated?.Invoke();
|
||||||
|
}
|
||||||
|
private IEnumerator DisableLoadingScreen()
|
||||||
|
{
|
||||||
|
yield return blueScreen.FadeTo(0, fadeOutDuration);
|
||||||
|
ScreenDeactivated?.Invoke();
|
||||||
|
}
|
||||||
|
public void ShowLoadingScreen()
|
||||||
|
{
|
||||||
|
screenCoroutine = StartCoroutine(EnableLoadingScreen());
|
||||||
|
cloudCoroutine = StartCoroutine(SpawnClouds());
|
||||||
|
}
|
||||||
|
public void HideLoadingScreen()
|
||||||
|
{
|
||||||
|
StopCoroutine(screenCoroutine);
|
||||||
|
StopCoroutine(cloudCoroutine);
|
||||||
|
clouds.FindAll(x => x).ForEach(x => x.Kill());
|
||||||
|
StartCoroutine(DisableLoadingScreen());
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/LoadingScreen.cs.meta
Normal file
11
Assets/Scripts/LoadingScreen.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8a9b542d59e659741b005556831a3390
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
5
Assets/Scripts/SceneAttribute.cs
Normal file
5
Assets/Scripts/SceneAttribute.cs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class SceneAttribute : PropertyAttribute
|
||||||
|
{
|
||||||
|
}
|
||||||
11
Assets/Scripts/SceneAttribute.cs.meta
Normal file
11
Assets/Scripts/SceneAttribute.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 81fe69393310ffa48ae32ee2a2d0b677
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -8,6 +8,10 @@ using UnityEditor;
|
|||||||
|
|
||||||
public class WorldMapManager : MonoBehaviour
|
public class WorldMapManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
[Scene][SerializeField]
|
||||||
|
private string _loadingScreenScene;
|
||||||
|
[Scene][SerializeField]
|
||||||
|
private string _gameScene;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private GameObject[] _buttonList;
|
private GameObject[] _buttonList;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
@ -16,8 +20,6 @@ public class WorldMapManager : MonoBehaviour
|
|||||||
private Sprite _lockedIcon;
|
private Sprite _lockedIcon;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private Sprite _savedIcon;
|
private Sprite _savedIcon;
|
||||||
[Scene][SerializeField]
|
|
||||||
private string gameScene;
|
|
||||||
|
|
||||||
private WorldMapSave _worldMapSave;
|
private WorldMapSave _worldMapSave;
|
||||||
|
|
||||||
@ -72,10 +74,12 @@ public class WorldMapManager : MonoBehaviour
|
|||||||
|
|
||||||
public void CallLevelWorld1(int levelToCall)
|
public void CallLevelWorld1(int levelToCall)
|
||||||
{
|
{
|
||||||
|
string levelToGet = "1-" + levelToCall;
|
||||||
if (_buttonList[levelToCall - 1].GetComponent<Image>().sprite.name != "worldmap_level_locked")
|
if (_buttonList[levelToCall - 1].GetComponent<Image>().sprite.name != "worldmap_level_locked")
|
||||||
{
|
{
|
||||||
PlayerPrefs.SetInt("LevelToLoad", levelToCall);
|
PlayerPrefs.SetString(LoadingManager.SceneToLoad, _gameScene);
|
||||||
SceneManager.LoadScene(gameScene);
|
PlayerPrefs.SetInt(LoadingManager.LevelToLoad, levelToCall);
|
||||||
|
SceneManager.LoadScene(_loadingScreenScene, LoadSceneMode.Additive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
Assets/bridge_cloud_1.png
Normal file
BIN
Assets/bridge_cloud_1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 211 KiB |
147
Assets/bridge_cloud_1.png.meta
Normal file
147
Assets/bridge_cloud_1.png.meta
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 73b56022ea22aa34fa14d354f2264194
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 12
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
vTOnly: 0
|
||||||
|
ignoreMasterTextureLimit: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 1
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
flipbookRows: 1
|
||||||
|
flipbookColumns: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
ignorePngGamma: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
cookieLightType: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Server
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Android
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
nameFileIdTable: {}
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -11,5 +11,8 @@ EditorBuildSettings:
|
|||||||
- enabled: 1
|
- enabled: 1
|
||||||
path: Assets/Scenes/Game.unity
|
path: Assets/Scenes/Game.unity
|
||||||
guid: 8c9cfa26abfee488c85f1582747f6a02
|
guid: 8c9cfa26abfee488c85f1582747f6a02
|
||||||
|
- enabled: 1
|
||||||
|
path: Assets/Scenes/LoadingScreen.unity
|
||||||
|
guid: 6da14f6006606f840b2df7664c50e1ec
|
||||||
m_configObjects:
|
m_configObjects:
|
||||||
com.unity.input.settings: {fileID: 11400000, guid: 2670dfbb5772b0248b8c8ccaa6470d9a, type: 2}
|
com.unity.input.settings: {fileID: 11400000, guid: 2670dfbb5772b0248b8c8ccaa6470d9a, type: 2}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user