make transition fool proof
problème : Il y avait plusieurs manières de faire planter le loading screen en appuyant sur des boutons changements: - turn off buttons when loading screen is active - turn on buttons when loading screen is not active - add event aggregator class to project and migrate every event to it - fix bugs and regressions
This commit is contained in:
parent
f9a54513cd
commit
8adc563d47
@ -103,7 +103,7 @@ Important considerations :
|
|||||||
targ.Level = map;
|
targ.Level = map;
|
||||||
_infoText = string.Empty;
|
_infoText = string.Empty;
|
||||||
}
|
}
|
||||||
private async void Load()
|
private 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);
|
||||||
await tilemapData.LoadToTilemap(tilemap);
|
tilemapData.LoadToTilemapEditor(tilemap);
|
||||||
}
|
}
|
||||||
_infoText = string.Empty;
|
_infoText = string.Empty;
|
||||||
EditorSceneManager.MarkAllScenesDirty();
|
EditorSceneManager.MarkAllScenesDirty();
|
||||||
|
|||||||
@ -188,4 +188,4 @@ MonoBehaviour:
|
|||||||
_renderLayer: Default
|
_renderLayer: Default
|
||||||
_position: {x: 0, y: 0}
|
_position: {x: 0, y: 0}
|
||||||
_scale: {x: 1, y: 1}
|
_scale: {x: 1, y: 1}
|
||||||
_waveConfig: {fileID: 11400000, guid: 21b0f85f7c746974db1e72f2df646f5d, type: 2}
|
_waveConfig: {fileID: 0}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 8c9cfa26abfee488c85f1582747f6a02
|
guid: 435ced5e4c7807f409bbc420fc6b95ad
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
|
|||||||
@ -241,7 +241,7 @@ Transform:
|
|||||||
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}
|
||||||
--- !u!1 &857764657
|
--- !u!1 &492460954
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
@ -249,9 +249,9 @@ GameObject:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 857764658}
|
- component: {fileID: 492460955}
|
||||||
- component: {fileID: 857764660}
|
- component: {fileID: 492460957}
|
||||||
- component: {fileID: 857764659}
|
- component: {fileID: 492460956}
|
||||||
m_Layer: 6
|
m_Layer: 6
|
||||||
m_Name: Spawners
|
m_Name: Spawners
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -259,13 +259,13 @@ GameObject:
|
|||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 1
|
||||||
--- !u!4 &857764658
|
--- !u!4 &492460955
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 857764657}
|
m_GameObject: {fileID: 492460954}
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 0}
|
m_LocalScale: {x: 1, y: 1, z: 0}
|
||||||
@ -274,13 +274,13 @@ Transform:
|
|||||||
m_Father: {fileID: 1827197199}
|
m_Father: {fileID: 1827197199}
|
||||||
m_RootOrder: 2
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!483693784 &857764659
|
--- !u!483693784 &492460956
|
||||||
TilemapRenderer:
|
TilemapRenderer:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 857764657}
|
m_GameObject: {fileID: 492460954}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_CastShadows: 0
|
m_CastShadows: 0
|
||||||
m_ReceiveShadows: 0
|
m_ReceiveShadows: 0
|
||||||
@ -316,22 +316,32 @@ TilemapRenderer:
|
|||||||
m_SortingLayer: 0
|
m_SortingLayer: 0
|
||||||
m_SortingOrder: 2
|
m_SortingOrder: 2
|
||||||
m_ChunkSize: {x: 32, y: 32, z: 32}
|
m_ChunkSize: {x: 32, y: 32, z: 32}
|
||||||
m_ChunkCullingBounds: {x: 0, y: 0, z: 0}
|
m_ChunkCullingBounds: {x: 0.22500002, y: 0.22500002, z: 0}
|
||||||
m_MaxChunkCount: 16
|
m_MaxChunkCount: 16
|
||||||
m_MaxFrameAge: 16
|
m_MaxFrameAge: 16
|
||||||
m_SortOrder: 0
|
m_SortOrder: 0
|
||||||
m_Mode: 0
|
m_Mode: 0
|
||||||
m_DetectChunkCullingBounds: 0
|
m_DetectChunkCullingBounds: 0
|
||||||
m_MaskInteraction: 0
|
m_MaskInteraction: 0
|
||||||
--- !u!1839735485 &857764660
|
--- !u!1839735485 &492460957
|
||||||
Tilemap:
|
Tilemap:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 857764657}
|
m_GameObject: {fileID: 492460954}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_Tiles:
|
m_Tiles:
|
||||||
|
- first: {x: -1, y: -3, z: 0}
|
||||||
|
second:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_TileIndex: 0
|
||||||
|
m_TileSpriteIndex: 0
|
||||||
|
m_TileMatrixIndex: 0
|
||||||
|
m_TileColorIndex: 0
|
||||||
|
m_TileObjectToInstantiateIndex: 65535
|
||||||
|
dummyAlignment: 0
|
||||||
|
m_AllTileFlags: 0
|
||||||
- first: {x: -1, y: -2, z: 0}
|
- first: {x: -1, y: -2, z: 0}
|
||||||
second:
|
second:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
@ -342,11 +352,41 @@ Tilemap:
|
|||||||
m_TileObjectToInstantiateIndex: 65535
|
m_TileObjectToInstantiateIndex: 65535
|
||||||
dummyAlignment: 0
|
dummyAlignment: 0
|
||||||
m_AllTileFlags: 0
|
m_AllTileFlags: 0
|
||||||
|
- first: {x: -1, y: -1, z: 0}
|
||||||
|
second:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_TileIndex: 0
|
||||||
|
m_TileSpriteIndex: 0
|
||||||
|
m_TileMatrixIndex: 0
|
||||||
|
m_TileColorIndex: 0
|
||||||
|
m_TileObjectToInstantiateIndex: 65535
|
||||||
|
dummyAlignment: 0
|
||||||
|
m_AllTileFlags: 0
|
||||||
|
- first: {x: -1, y: 0, z: 0}
|
||||||
|
second:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_TileIndex: 0
|
||||||
|
m_TileSpriteIndex: 0
|
||||||
|
m_TileMatrixIndex: 0
|
||||||
|
m_TileColorIndex: 0
|
||||||
|
m_TileObjectToInstantiateIndex: 65535
|
||||||
|
dummyAlignment: 0
|
||||||
|
m_AllTileFlags: 0
|
||||||
|
- first: {x: -1, y: 1, z: 0}
|
||||||
|
second:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_TileIndex: 0
|
||||||
|
m_TileSpriteIndex: 0
|
||||||
|
m_TileMatrixIndex: 0
|
||||||
|
m_TileColorIndex: 0
|
||||||
|
m_TileObjectToInstantiateIndex: 65535
|
||||||
|
dummyAlignment: 0
|
||||||
|
m_AllTileFlags: 0
|
||||||
- first: {x: -1, y: 2, z: 0}
|
- first: {x: -1, y: 2, z: 0}
|
||||||
second:
|
second:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_TileIndex: 1
|
m_TileIndex: 0
|
||||||
m_TileSpriteIndex: 1
|
m_TileSpriteIndex: 0
|
||||||
m_TileMatrixIndex: 0
|
m_TileMatrixIndex: 0
|
||||||
m_TileColorIndex: 0
|
m_TileColorIndex: 0
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
m_TileObjectToInstantiateIndex: 65535
|
||||||
@ -354,17 +394,17 @@ Tilemap:
|
|||||||
m_AllTileFlags: 0
|
m_AllTileFlags: 0
|
||||||
m_AnimatedTiles: {}
|
m_AnimatedTiles: {}
|
||||||
m_TileAssetArray:
|
m_TileAssetArray:
|
||||||
- m_RefCount: 0
|
- m_RefCount: 5
|
||||||
m_Data: {fileID: 0}
|
|
||||||
- m_RefCount: 2
|
|
||||||
m_Data: {fileID: 11400000, guid: 4002377ed7e87b34699f126f2b10c703, type: 2}
|
m_Data: {fileID: 11400000, guid: 4002377ed7e87b34699f126f2b10c703, type: 2}
|
||||||
|
- m_RefCount: 1
|
||||||
|
m_Data: {fileID: 11400000, guid: 15606c8c503e8164fb69178aa7016f58, type: 2}
|
||||||
m_TileSpriteArray:
|
m_TileSpriteArray:
|
||||||
- m_RefCount: 0
|
- m_RefCount: 5
|
||||||
m_Data: {fileID: 0}
|
|
||||||
- m_RefCount: 2
|
|
||||||
m_Data: {fileID: 21300000, guid: b85a4b2ec6433d04895612d791edc260, type: 3}
|
m_Data: {fileID: 21300000, guid: b85a4b2ec6433d04895612d791edc260, type: 3}
|
||||||
|
- m_RefCount: 1
|
||||||
|
m_Data: {fileID: 21300000, guid: 8354a544f4ca3514e87d40d2de9afaee, type: 3}
|
||||||
m_TileMatrixArray:
|
m_TileMatrixArray:
|
||||||
- m_RefCount: 2
|
- m_RefCount: 6
|
||||||
m_Data:
|
m_Data:
|
||||||
e00: 1
|
e00: 1
|
||||||
e01: 0
|
e01: 0
|
||||||
@ -383,13 +423,13 @@ Tilemap:
|
|||||||
e32: 0
|
e32: 0
|
||||||
e33: 1
|
e33: 1
|
||||||
m_TileColorArray:
|
m_TileColorArray:
|
||||||
- m_RefCount: 2
|
- m_RefCount: 6
|
||||||
m_Data: {r: 1, g: 1, b: 1, a: 1}
|
m_Data: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_TileObjectToInstantiateArray: []
|
m_TileObjectToInstantiateArray: []
|
||||||
m_AnimationFrameRate: 1
|
m_AnimationFrameRate: 1
|
||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_Origin: {x: -10, y: -4, z: 0}
|
m_Origin: {x: -1, y: -3, z: 0}
|
||||||
m_Size: {x: 21, y: 7, z: 1}
|
m_Size: {x: 1, y: 6, z: 1}
|
||||||
m_TileAnchor: {x: 0, y: 0, z: 0}
|
m_TileAnchor: {x: 0, y: 0, z: 0}
|
||||||
m_TileOrientation: 0
|
m_TileOrientation: 0
|
||||||
m_TileOrientationMatrix:
|
m_TileOrientationMatrix:
|
||||||
@ -409,7 +449,7 @@ Tilemap:
|
|||||||
e31: 0
|
e31: 0
|
||||||
e32: 0
|
e32: 0
|
||||||
e33: 1
|
e33: 1
|
||||||
--- !u!1 &1078808412
|
--- !u!1 &783540099
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
@ -417,9 +457,9 @@ GameObject:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 1078808413}
|
- component: {fileID: 783540100}
|
||||||
- component: {fileID: 1078808415}
|
- component: {fileID: 783540102}
|
||||||
- component: {fileID: 1078808414}
|
- component: {fileID: 783540101}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Background
|
m_Name: Background
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -427,13 +467,13 @@ GameObject:
|
|||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 1
|
||||||
--- !u!4 &1078808413
|
--- !u!4 &783540100
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1078808412}
|
m_GameObject: {fileID: 783540099}
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 0}
|
m_LocalScale: {x: 1, y: 1, z: 0}
|
||||||
@ -442,13 +482,13 @@ Transform:
|
|||||||
m_Father: {fileID: 1827197199}
|
m_Father: {fileID: 1827197199}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!483693784 &1078808414
|
--- !u!483693784 &783540101
|
||||||
TilemapRenderer:
|
TilemapRenderer:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1078808412}
|
m_GameObject: {fileID: 783540099}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_CastShadows: 0
|
m_CastShadows: 0
|
||||||
m_ReceiveShadows: 0
|
m_ReceiveShadows: 0
|
||||||
@ -491,13 +531,13 @@ TilemapRenderer:
|
|||||||
m_Mode: 0
|
m_Mode: 0
|
||||||
m_DetectChunkCullingBounds: 0
|
m_DetectChunkCullingBounds: 0
|
||||||
m_MaskInteraction: 0
|
m_MaskInteraction: 0
|
||||||
--- !u!1839735485 &1078808415
|
--- !u!1839735485 &783540102
|
||||||
Tilemap:
|
Tilemap:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1078808412}
|
m_GameObject: {fileID: 783540099}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_Tiles:
|
m_Tiles:
|
||||||
- first: {x: -10, y: -3, z: 0}
|
- first: {x: -10, y: -3, z: 0}
|
||||||
@ -1132,444 +1172,8 @@ Tilemap:
|
|||||||
m_TileObjectToInstantiateArray: []
|
m_TileObjectToInstantiateArray: []
|
||||||
m_AnimationFrameRate: 1
|
m_AnimationFrameRate: 1
|
||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_Origin: {x: -10, y: -4, z: 0}
|
m_Origin: {x: -10, y: -3, z: 0}
|
||||||
m_Size: {x: 21, y: 7, z: 1}
|
m_Size: {x: 10, y: 6, z: 1}
|
||||||
m_TileAnchor: {x: 0, y: 0, z: 0}
|
|
||||||
m_TileOrientation: 0
|
|
||||||
m_TileOrientationMatrix:
|
|
||||||
e00: 1
|
|
||||||
e01: 0
|
|
||||||
e02: 0
|
|
||||||
e03: 0
|
|
||||||
e10: 0
|
|
||||||
e11: 1
|
|
||||||
e12: 0
|
|
||||||
e13: 0
|
|
||||||
e20: 0
|
|
||||||
e21: 0
|
|
||||||
e22: 1
|
|
||||||
e23: 0
|
|
||||||
e30: 0
|
|
||||||
e31: 0
|
|
||||||
e32: 0
|
|
||||||
e33: 1
|
|
||||||
--- !u!1 &1408727360
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 1408727361}
|
|
||||||
- component: {fileID: 1408727363}
|
|
||||||
- component: {fileID: 1408727362}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Entities
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!4 &1408727361
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1408727360}
|
|
||||||
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: 0}
|
|
||||||
m_ConstrainProportionsScale: 0
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 1827197199}
|
|
||||||
m_RootOrder: 1
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!483693784 &1408727362
|
|
||||||
TilemapRenderer:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1408727360}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_CastShadows: 0
|
|
||||||
m_ReceiveShadows: 0
|
|
||||||
m_DynamicOccludee: 1
|
|
||||||
m_StaticShadowCaster: 0
|
|
||||||
m_MotionVectors: 1
|
|
||||||
m_LightProbeUsage: 0
|
|
||||||
m_ReflectionProbeUsage: 0
|
|
||||||
m_RayTracingMode: 0
|
|
||||||
m_RayTraceProcedural: 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_SortingLayerID: 0
|
|
||||||
m_SortingLayer: 0
|
|
||||||
m_SortingOrder: 1
|
|
||||||
m_ChunkSize: {x: 32, y: 32, z: 32}
|
|
||||||
m_ChunkCullingBounds: {x: 0, y: 0, z: 0}
|
|
||||||
m_MaxChunkCount: 16
|
|
||||||
m_MaxFrameAge: 16
|
|
||||||
m_SortOrder: 0
|
|
||||||
m_Mode: 0
|
|
||||||
m_DetectChunkCullingBounds: 0
|
|
||||||
m_MaskInteraction: 0
|
|
||||||
--- !u!1839735485 &1408727363
|
|
||||||
Tilemap:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1408727360}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_Tiles:
|
|
||||||
- first: {x: -8, y: -3, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 2
|
|
||||||
m_TileSpriteIndex: 2
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -6, y: -3, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 2
|
|
||||||
m_TileSpriteIndex: 2
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -4, y: -3, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 2
|
|
||||||
m_TileSpriteIndex: 2
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -2, y: -3, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 2
|
|
||||||
m_TileSpriteIndex: 2
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -10, y: -2, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 1
|
|
||||||
m_TileSpriteIndex: 1
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -7, y: -1, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 3
|
|
||||||
m_TileSpriteIndex: 3
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -6, y: -1, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 3
|
|
||||||
m_TileSpriteIndex: 3
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -5, y: -1, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 3
|
|
||||||
m_TileSpriteIndex: 3
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -4, y: -1, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 3
|
|
||||||
m_TileSpriteIndex: 3
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -3, y: -1, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 3
|
|
||||||
m_TileSpriteIndex: 3
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -2, y: -1, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 3
|
|
||||||
m_TileSpriteIndex: 3
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -1, y: -1, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 3
|
|
||||||
m_TileSpriteIndex: 3
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -10, y: 0, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 1
|
|
||||||
m_TileSpriteIndex: 1
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -7, y: 0, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 3
|
|
||||||
m_TileSpriteIndex: 3
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -6, y: 0, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 3
|
|
||||||
m_TileSpriteIndex: 3
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -5, y: 0, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 3
|
|
||||||
m_TileSpriteIndex: 3
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -4, y: 0, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 3
|
|
||||||
m_TileSpriteIndex: 3
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -3, y: 0, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 3
|
|
||||||
m_TileSpriteIndex: 3
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -2, y: 0, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 3
|
|
||||||
m_TileSpriteIndex: 3
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -1, y: 0, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 3
|
|
||||||
m_TileSpriteIndex: 3
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -7, y: 1, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 3
|
|
||||||
m_TileSpriteIndex: 3
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -6, y: 1, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 3
|
|
||||||
m_TileSpriteIndex: 3
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -5, y: 1, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 3
|
|
||||||
m_TileSpriteIndex: 3
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -4, y: 1, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 3
|
|
||||||
m_TileSpriteIndex: 3
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -3, y: 1, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 3
|
|
||||||
m_TileSpriteIndex: 3
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -2, y: 1, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 3
|
|
||||||
m_TileSpriteIndex: 3
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -1, y: 1, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 3
|
|
||||||
m_TileSpriteIndex: 3
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
- first: {x: -10, y: 2, z: 0}
|
|
||||||
second:
|
|
||||||
serializedVersion: 2
|
|
||||||
m_TileIndex: 1
|
|
||||||
m_TileSpriteIndex: 1
|
|
||||||
m_TileMatrixIndex: 0
|
|
||||||
m_TileColorIndex: 0
|
|
||||||
m_TileObjectToInstantiateIndex: 65535
|
|
||||||
dummyAlignment: 0
|
|
||||||
m_AllTileFlags: 0
|
|
||||||
m_AnimatedTiles: {}
|
|
||||||
m_TileAssetArray:
|
|
||||||
- m_RefCount: 0
|
|
||||||
m_Data: {fileID: 0}
|
|
||||||
- m_RefCount: 3
|
|
||||||
m_Data: {fileID: 11400000, guid: e0d57b3c128ba1447920637cdb289530, type: 2}
|
|
||||||
- m_RefCount: 4
|
|
||||||
m_Data: {fileID: 11400000, guid: e0b1d2d816ae5624c99b09a2bebb2a39, type: 2}
|
|
||||||
- m_RefCount: 21
|
|
||||||
m_Data: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
|
||||||
m_TileSpriteArray:
|
|
||||||
- m_RefCount: 0
|
|
||||||
m_Data: {fileID: 0}
|
|
||||||
- m_RefCount: 3
|
|
||||||
m_Data: {fileID: 21300000, guid: f67e7f54162405141b42d32ef8df76ad, type: 3}
|
|
||||||
- m_RefCount: 4
|
|
||||||
m_Data: {fileID: 21300000, guid: 5c630d8b4d37f5d4f974d38f670ad5c1, type: 3}
|
|
||||||
- m_RefCount: 21
|
|
||||||
m_Data: {fileID: 21300000, guid: 6298844400e212d40bce870425ac2a5b, type: 3}
|
|
||||||
m_TileMatrixArray:
|
|
||||||
- m_RefCount: 28
|
|
||||||
m_Data:
|
|
||||||
e00: 1
|
|
||||||
e01: 0
|
|
||||||
e02: 0
|
|
||||||
e03: 0
|
|
||||||
e10: 0
|
|
||||||
e11: 1
|
|
||||||
e12: 0
|
|
||||||
e13: 0
|
|
||||||
e20: 0
|
|
||||||
e21: 0
|
|
||||||
e22: 1
|
|
||||||
e23: 0
|
|
||||||
e30: 0
|
|
||||||
e31: 0
|
|
||||||
e32: 0
|
|
||||||
e33: 1
|
|
||||||
m_TileColorArray:
|
|
||||||
- m_RefCount: 28
|
|
||||||
m_Data: {r: 1, g: 1, b: 1, a: 1}
|
|
||||||
m_TileObjectToInstantiateArray: []
|
|
||||||
m_AnimationFrameRate: 1
|
|
||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
|
||||||
m_Origin: {x: -11, y: -4, z: 0}
|
|
||||||
m_Size: {x: 15, y: 7, z: 1}
|
|
||||||
m_TileAnchor: {x: 0, y: 0, z: 0}
|
m_TileAnchor: {x: 0, y: 0, z: 0}
|
||||||
m_TileOrientation: 0
|
m_TileOrientation: 0
|
||||||
m_TileOrientationMatrix:
|
m_TileOrientationMatrix:
|
||||||
@ -1603,7 +1207,7 @@ PrefabInstance:
|
|||||||
- target: {fileID: 3028288566889208750, guid: 02daecb0115395844b4932445d039051, type: 3}
|
- target: {fileID: 3028288566889208750, guid: 02daecb0115395844b4932445d039051, type: 3}
|
||||||
propertyPath: firstLevel
|
propertyPath: firstLevel
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 11400000, guid: f5a11cb6d0d324b47b493042c7615112, type: 2}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 3028288566889208751, guid: 02daecb0115395844b4932445d039051, type: 3}
|
- target: {fileID: 3028288566889208751, guid: 02daecb0115395844b4932445d039051, type: 3}
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 2
|
value: 2
|
||||||
@ -1692,9 +1296,9 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 1078808413}
|
- {fileID: 783540100}
|
||||||
- {fileID: 1408727361}
|
- {fileID: 2034898634}
|
||||||
- {fileID: 857764658}
|
- {fileID: 492460955}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
@ -1712,3 +1316,231 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_path: {fileID: 102900000, guid: c9341b1bdc1103b4e832cf62d29e5471, type: 3}
|
_path: {fileID: 102900000, guid: c9341b1bdc1103b4e832cf62d29e5471, type: 3}
|
||||||
_level: {fileID: 11400000, guid: f5a11cb6d0d324b47b493042c7615112, type: 2}
|
_level: {fileID: 11400000, guid: f5a11cb6d0d324b47b493042c7615112, type: 2}
|
||||||
|
--- !u!1 &2034898633
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 2034898634}
|
||||||
|
- component: {fileID: 2034898636}
|
||||||
|
- component: {fileID: 2034898635}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Entities
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &2034898634
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2034898633}
|
||||||
|
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: 0}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 1827197199}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!483693784 &2034898635
|
||||||
|
TilemapRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2034898633}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 0
|
||||||
|
m_ReceiveShadows: 0
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_StaticShadowCaster: 0
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 0
|
||||||
|
m_ReflectionProbeUsage: 0
|
||||||
|
m_RayTracingMode: 0
|
||||||
|
m_RayTraceProcedural: 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_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 1
|
||||||
|
m_ChunkSize: {x: 32, y: 32, z: 32}
|
||||||
|
m_ChunkCullingBounds: {x: 0.13499999, y: 0.19, z: 0}
|
||||||
|
m_MaxChunkCount: 16
|
||||||
|
m_MaxFrameAge: 16
|
||||||
|
m_SortOrder: 0
|
||||||
|
m_Mode: 0
|
||||||
|
m_DetectChunkCullingBounds: 0
|
||||||
|
m_MaskInteraction: 0
|
||||||
|
--- !u!1839735485 &2034898636
|
||||||
|
Tilemap:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2034898633}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_Tiles:
|
||||||
|
- first: {x: -10, y: -3, z: 0}
|
||||||
|
second:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_TileIndex: 0
|
||||||
|
m_TileSpriteIndex: 0
|
||||||
|
m_TileMatrixIndex: 0
|
||||||
|
m_TileColorIndex: 0
|
||||||
|
m_TileObjectToInstantiateIndex: 65535
|
||||||
|
dummyAlignment: 0
|
||||||
|
m_AllTileFlags: 0
|
||||||
|
- first: {x: -9, y: -3, z: 0}
|
||||||
|
second:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_TileIndex: 0
|
||||||
|
m_TileSpriteIndex: 0
|
||||||
|
m_TileMatrixIndex: 0
|
||||||
|
m_TileColorIndex: 0
|
||||||
|
m_TileObjectToInstantiateIndex: 65535
|
||||||
|
dummyAlignment: 0
|
||||||
|
m_AllTileFlags: 0
|
||||||
|
- first: {x: -10, y: -2, z: 0}
|
||||||
|
second:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_TileIndex: 0
|
||||||
|
m_TileSpriteIndex: 0
|
||||||
|
m_TileMatrixIndex: 0
|
||||||
|
m_TileColorIndex: 0
|
||||||
|
m_TileObjectToInstantiateIndex: 65535
|
||||||
|
dummyAlignment: 0
|
||||||
|
m_AllTileFlags: 0
|
||||||
|
- first: {x: -9, y: -2, z: 0}
|
||||||
|
second:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_TileIndex: 0
|
||||||
|
m_TileSpriteIndex: 0
|
||||||
|
m_TileMatrixIndex: 0
|
||||||
|
m_TileColorIndex: 0
|
||||||
|
m_TileObjectToInstantiateIndex: 65535
|
||||||
|
dummyAlignment: 0
|
||||||
|
m_AllTileFlags: 0
|
||||||
|
- first: {x: -10, y: -1, z: 0}
|
||||||
|
second:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_TileIndex: 0
|
||||||
|
m_TileSpriteIndex: 0
|
||||||
|
m_TileMatrixIndex: 0
|
||||||
|
m_TileColorIndex: 0
|
||||||
|
m_TileObjectToInstantiateIndex: 65535
|
||||||
|
dummyAlignment: 0
|
||||||
|
m_AllTileFlags: 0
|
||||||
|
- first: {x: -9, y: -1, z: 0}
|
||||||
|
second:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_TileIndex: 0
|
||||||
|
m_TileSpriteIndex: 0
|
||||||
|
m_TileMatrixIndex: 0
|
||||||
|
m_TileColorIndex: 0
|
||||||
|
m_TileObjectToInstantiateIndex: 65535
|
||||||
|
dummyAlignment: 0
|
||||||
|
m_AllTileFlags: 0
|
||||||
|
- first: {x: -6, y: 2, z: 0}
|
||||||
|
second:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_TileIndex: 1
|
||||||
|
m_TileSpriteIndex: 1
|
||||||
|
m_TileMatrixIndex: 0
|
||||||
|
m_TileColorIndex: 0
|
||||||
|
m_TileObjectToInstantiateIndex: 65535
|
||||||
|
dummyAlignment: 0
|
||||||
|
m_AllTileFlags: 0
|
||||||
|
- first: {x: -5, y: 2, z: 0}
|
||||||
|
second:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_TileIndex: 1
|
||||||
|
m_TileSpriteIndex: 1
|
||||||
|
m_TileMatrixIndex: 0
|
||||||
|
m_TileColorIndex: 0
|
||||||
|
m_TileObjectToInstantiateIndex: 65535
|
||||||
|
dummyAlignment: 0
|
||||||
|
m_AllTileFlags: 0
|
||||||
|
m_AnimatedTiles: {}
|
||||||
|
m_TileAssetArray:
|
||||||
|
- m_RefCount: 6
|
||||||
|
m_Data: {fileID: 11400000, guid: e0b1d2d816ae5624c99b09a2bebb2a39, type: 2}
|
||||||
|
- m_RefCount: 2
|
||||||
|
m_Data: {fileID: 11400000, guid: e0d57b3c128ba1447920637cdb289530, type: 2}
|
||||||
|
m_TileSpriteArray:
|
||||||
|
- m_RefCount: 6
|
||||||
|
m_Data: {fileID: 21300000, guid: 43582b3c6b60fd144bc56d8ab3b14349, type: 3}
|
||||||
|
- m_RefCount: 2
|
||||||
|
m_Data: {fileID: 21300000, guid: 6298844400e212d40bce870425ac2a5b, type: 3}
|
||||||
|
m_TileMatrixArray:
|
||||||
|
- m_RefCount: 8
|
||||||
|
m_Data:
|
||||||
|
e00: 1
|
||||||
|
e01: 0
|
||||||
|
e02: 0
|
||||||
|
e03: 0
|
||||||
|
e10: 0
|
||||||
|
e11: 1
|
||||||
|
e12: 0
|
||||||
|
e13: 0
|
||||||
|
e20: 0
|
||||||
|
e21: 0
|
||||||
|
e22: 1
|
||||||
|
e23: 0
|
||||||
|
e30: 0
|
||||||
|
e31: 0
|
||||||
|
e32: 0
|
||||||
|
e33: 1
|
||||||
|
m_TileColorArray:
|
||||||
|
- m_RefCount: 8
|
||||||
|
m_Data: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
m_TileObjectToInstantiateArray: []
|
||||||
|
m_AnimationFrameRate: 1
|
||||||
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
m_Origin: {x: -10, y: -3, z: 0}
|
||||||
|
m_Size: {x: 10, y: 6, z: 1}
|
||||||
|
m_TileAnchor: {x: 0, y: 0, z: 0}
|
||||||
|
m_TileOrientation: 0
|
||||||
|
m_TileOrientationMatrix:
|
||||||
|
e00: 1
|
||||||
|
e01: 0
|
||||||
|
e02: 0
|
||||||
|
e03: 0
|
||||||
|
e10: 0
|
||||||
|
e11: 1
|
||||||
|
e12: 0
|
||||||
|
e13: 0
|
||||||
|
e20: 0
|
||||||
|
e21: 0
|
||||||
|
e22: 1
|
||||||
|
e23: 0
|
||||||
|
e30: 0
|
||||||
|
e31: 0
|
||||||
|
e32: 0
|
||||||
|
e33: 1
|
||||||
@ -251,7 +251,7 @@ RectTransform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 444904903}
|
m_GameObject: {fileID: 444904903}
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 8.84}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
@ -273,7 +273,7 @@ CanvasGroup:
|
|||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_Alpha: 0
|
m_Alpha: 0
|
||||||
m_Interactable: 0
|
m_Interactable: 0
|
||||||
m_BlocksRaycasts: 0
|
m_BlocksRaycasts: 1
|
||||||
m_IgnoreParentGroups: 1
|
m_IgnoreParentGroups: 1
|
||||||
--- !u!114 &444904906
|
--- !u!114 &444904906
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -339,7 +339,7 @@ RectTransform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1991489725}
|
m_GameObject: {fileID: 1991489725}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 5}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
@ -386,5 +386,3 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: aef75be033508a4498fa7f546d6ebef2, type: 3}
|
m_Script: {fileID: 11500000, guid: aef75be033508a4498fa7f546d6ebef2, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_gameScene: Game
|
|
||||||
_sceneSelection: LevelSelect
|
|
||||||
|
|||||||
@ -4,6 +4,8 @@ using TMPro;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using GatherAndDefend.Events;
|
||||||
|
using static LevelManager;
|
||||||
|
|
||||||
[RequireComponent(typeof(Button))]
|
[RequireComponent(typeof(Button))]
|
||||||
public abstract class UnitPlacementButton : MonoBehaviour, IPointerDownHandler
|
public abstract class UnitPlacementButton : MonoBehaviour, IPointerDownHandler
|
||||||
@ -28,13 +30,30 @@ public abstract class UnitPlacementButton : MonoBehaviour, IPointerDownHandler
|
|||||||
[SerializeField]
|
[SerializeField]
|
||||||
private TMP_Text _rockLabel;
|
private TMP_Text _rockLabel;
|
||||||
|
|
||||||
|
private bool _canSpawn = false;
|
||||||
|
|
||||||
protected virtual void Start()
|
protected virtual void Start()
|
||||||
{
|
{
|
||||||
_button = GetComponent<Button>();
|
_button = GetComponent<Button>();
|
||||||
|
|
||||||
|
_button.enabled = false;
|
||||||
|
EventAggregator.Instance.GetEvent<LevelLoadedEvent>().Attach(OnLevelLoaded);
|
||||||
|
EventAggregator.Instance.GetEvent<ExitingLevelEvent>().Attach(DeactivateButton);
|
||||||
|
}
|
||||||
|
private void OnLevelLoaded(GatherAndDefend.LevelEditor.Level level)
|
||||||
|
{
|
||||||
|
_canSpawn = true;
|
||||||
|
EventAggregator.Instance.GetEvent<LevelLoadedEvent>().Detach(OnLevelLoaded);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeactivateButton()
|
||||||
|
{
|
||||||
|
EventAggregator.Instance.GetEvent<ExitingLevelEvent>().Detach(DeactivateButton);
|
||||||
|
_canSpawn = false;
|
||||||
}
|
}
|
||||||
protected virtual void Update()
|
protected virtual void Update()
|
||||||
{
|
{
|
||||||
_button.interactable = ResourceManager.Instance.EnoughFor(_rock, _wood, _food);
|
_button.interactable = ResourceManager.Instance.EnoughFor(_rock, _wood, _food) && _button.enabled && _canSpawn;
|
||||||
SetTextFor(_foodLabel, _food);
|
SetTextFor(_foodLabel, _food);
|
||||||
SetTextFor(_rockLabel, _rock);
|
SetTextFor(_rockLabel, _rock);
|
||||||
SetTextFor(_woodLabel, _wood);
|
SetTextFor(_woodLabel, _wood);
|
||||||
|
|||||||
8
Assets/Scripts/Events.meta
Normal file
8
Assets/Scripts/Events.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b232aec3472e8a7408e34c6ae8608d4a
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
28
Assets/Scripts/Events/EventAggregator.cs
Normal file
28
Assets/Scripts/Events/EventAggregator.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace GatherAndDefend.Events
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// makes it possible to add custom and centralized event observables<br/>
|
||||||
|
/// </summary>
|
||||||
|
public class EventAggregator : Singleton<EventAggregator>
|
||||||
|
{
|
||||||
|
private List<EventBase> events = new List<EventBase>();
|
||||||
|
/// <summary>
|
||||||
|
/// returns an event observable of given type. Creates it if non-existent
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">the type of the event</typeparam>
|
||||||
|
/// <returns></returns>
|
||||||
|
public T GetEvent<T>() where T : EventBase, new()
|
||||||
|
{
|
||||||
|
var evt = events.Find(x => x is T);
|
||||||
|
if (evt == null)
|
||||||
|
{
|
||||||
|
evt = new T();
|
||||||
|
events.Add(evt);
|
||||||
|
}
|
||||||
|
return evt as T;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Events/EventAggregator.cs.meta
Normal file
11
Assets/Scripts/Events/EventAggregator.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2ac29c6e09760dc45a27054e159f1240
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
34
Assets/Scripts/Events/EventBase.cs
Normal file
34
Assets/Scripts/Events/EventBase.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
namespace GatherAndDefend.Events
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// lets you create custom events for the event aggregator
|
||||||
|
/// </summary>
|
||||||
|
public abstract class EventBase
|
||||||
|
{
|
||||||
|
private event System.Action innerEvent;
|
||||||
|
public void Invoke()
|
||||||
|
{
|
||||||
|
innerEvent?.Invoke();
|
||||||
|
}
|
||||||
|
public void Attach(System.Action handler)
|
||||||
|
{
|
||||||
|
innerEvent += handler;
|
||||||
|
}
|
||||||
|
public void Detach(System.Action handler)
|
||||||
|
{
|
||||||
|
innerEvent -= handler;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// lets you create custom event with given parameter for the event aggregator
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
public abstract class EventBase<T> : EventBase
|
||||||
|
{
|
||||||
|
private event System.Action<T> innerEvent;
|
||||||
|
public void Invoke(T value) => innerEvent?.Invoke(value);
|
||||||
|
public void Attach(System.Action<T> handler) => innerEvent += handler;
|
||||||
|
public void Detach(System.Action<T> handler) => innerEvent -= handler;
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Events/EventBase.cs.meta
Normal file
11
Assets/Scripts/Events/EventBase.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 515b3ee1c144baa4abe1951ad6039ae4
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
3
Assets/Scripts/Events/ExitingLevelEvent.cs
Normal file
3
Assets/Scripts/Events/ExitingLevelEvent.cs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
using GatherAndDefend.Events;
|
||||||
|
|
||||||
|
public class ExitingLevelEvent : EventBase { }
|
||||||
11
Assets/Scripts/Events/ExitingLevelEvent.cs.meta
Normal file
11
Assets/Scripts/Events/ExitingLevelEvent.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ac71e91f163c3c446850b85d7b6a59c4
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
7
Assets/Scripts/Events/LevelLoadedEvent.cs
Normal file
7
Assets/Scripts/Events/LevelLoadedEvent.cs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
using GatherAndDefend.Events;
|
||||||
|
using GatherAndDefend.LevelEditor;
|
||||||
|
|
||||||
|
public class LevelLoadedEvent : EventBase<Level>
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
11
Assets/Scripts/Events/LevelLoadedEvent.cs.meta
Normal file
11
Assets/Scripts/Events/LevelLoadedEvent.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ccf2a9d05b59e0947b1f327a8cb970f7
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
5
Assets/Scripts/Events/ScreenActivatedEvent.cs
Normal file
5
Assets/Scripts/Events/ScreenActivatedEvent.cs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
using GatherAndDefend.Events;
|
||||||
|
|
||||||
|
public class ScreenActivatedEvent : EventBase
|
||||||
|
{
|
||||||
|
}
|
||||||
11
Assets/Scripts/Events/ScreenActivatedEvent.cs.meta
Normal file
11
Assets/Scripts/Events/ScreenActivatedEvent.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c2b6c01fae276b7448d4ed179443af4e
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
5
Assets/Scripts/Events/ScreenDeactivatedEvent.cs
Normal file
5
Assets/Scripts/Events/ScreenDeactivatedEvent.cs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
using GatherAndDefend.Events;
|
||||||
|
|
||||||
|
public class ScreenDeactivatedEvent : EventBase
|
||||||
|
{
|
||||||
|
}
|
||||||
11
Assets/Scripts/Events/ScreenDeactivatedEvent.cs.meta
Normal file
11
Assets/Scripts/Events/ScreenDeactivatedEvent.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 864c47f40960dde46b92c49f90bd812c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
using GatherAndDefend.Events;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -25,5 +26,7 @@ public class GoToScene : MonoBehaviour
|
|||||||
{
|
{
|
||||||
SceneManager.LoadScene(_sceneToLoad);
|
SceneManager.LoadScene(_sceneToLoad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EventAggregator.Instance.GetEvent<ExitingLevelEvent>().Invoke();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
|
using GatherAndDefend.Events;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using static LevelManager;
|
||||||
|
|
||||||
public class KeepLevelAnchored : MonoBehaviour
|
public class KeepLevelAnchored : MonoBehaviour
|
||||||
{
|
{
|
||||||
@ -11,7 +13,7 @@ public class KeepLevelAnchored : MonoBehaviour
|
|||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
_camera = Camera.main;
|
_camera = Camera.main;
|
||||||
LevelManager.Instance.LevelLoaded += CalculateBound;
|
EventAggregator.Instance.GetEvent<LevelLoadedEvent>().Attach(CalculateBound);
|
||||||
|
|
||||||
if (!LevelManager.Instance.CurrentLevel) return;
|
if (!LevelManager.Instance.CurrentLevel) return;
|
||||||
CalculateBound(LevelManager.Instance.CurrentLevel);
|
CalculateBound(LevelManager.Instance.CurrentLevel);
|
||||||
@ -26,7 +28,7 @@ public class KeepLevelAnchored : MonoBehaviour
|
|||||||
|
|
||||||
void OnDestroy()
|
void OnDestroy()
|
||||||
{
|
{
|
||||||
LevelManager.Instance.LevelLoaded -= CalculateBound;
|
EventAggregator.Instance.GetEvent<LevelLoadedEvent>().Attach(CalculateBound);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
|||||||
@ -19,13 +19,7 @@ namespace GatherAndDefend.LevelEditor
|
|||||||
data.SaveFromTilemap(tilemap);
|
data.SaveFromTilemap(tilemap);
|
||||||
_data.Add(data);
|
_data.Add(data);
|
||||||
}
|
}
|
||||||
public async void LoadToTilemap(Tilemap tilemap)
|
|
||||||
{
|
|
||||||
var data = _data.Find(x => x.Key == tilemap.name);
|
|
||||||
if (data == null) return;
|
|
||||||
|
|
||||||
await data.LoadToTilemap(tilemap);
|
|
||||||
}
|
|
||||||
public WaveConfig WaveConfig { get { return _waveConfig; } }
|
public WaveConfig WaveConfig { get { return _waveConfig; } }
|
||||||
|
|
||||||
public IEnumerator<TilemapData> GetEnumerator()
|
public IEnumerator<TilemapData> GetEnumerator()
|
||||||
|
|||||||
@ -38,17 +38,10 @@ namespace GatherAndDefend.LevelEditor
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="reference">the current tilemap</param>
|
/// <param name="reference">the current tilemap</param>
|
||||||
/// <param name="placementAnimation">the tiles falling on the tilemap</param>
|
|
||||||
/// <param name="allTilesSpawned">a reference value that is used in caller method to detect when all tiles have been spawned</param>
|
|
||||||
/// <param name="tileSpawnAcceleration">a delegate which speeds up the spawning of the tiles over time</param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task LoadToTilemap(Tilemap reference, PlacementAnimationHandler placementAnimation = null, Action allTilesSpawned = default, Func<float> tileSpawnAcceleration = default)
|
public void LoadToTilemapEditor(Tilemap reference)
|
||||||
{
|
{
|
||||||
// if the function we receive is null, we just make it constant 1
|
var tilesPerSecond = Application.isPlaying ? GlobalConfig.Instance.Current.baseTileSpawnSpeed : float.Epsilon;
|
||||||
if (tileSpawnAcceleration == default) tileSpawnAcceleration = () => 1;
|
|
||||||
|
|
||||||
var tilesPerSecond = GlobalConfig.Instance.Current.baseTileSpawnSpeed;
|
|
||||||
|
|
||||||
reference.transform.localPosition = _position;
|
reference.transform.localPosition = _position;
|
||||||
reference.transform.localScale = _scale;
|
reference.transform.localScale = _scale;
|
||||||
|
|
||||||
@ -66,10 +59,58 @@ namespace GatherAndDefend.LevelEditor
|
|||||||
var tasks = new List<Task>();
|
var tasks = new List<Task>();
|
||||||
foreach (TileData data in _tiles)
|
foreach (TileData data in _tiles)
|
||||||
{
|
{
|
||||||
tasks.Add(placementAnimation(data.Position, data.Tile, () => reference.SetTile(data.Position, data.Tile)));
|
reference.SetTile(data.Position, data.Tile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="reference">the current tilemap</param>
|
||||||
|
/// <param name="placementAnimation">the tiles falling on the tilemap</param>
|
||||||
|
/// <param name="allTilesSpawned">a reference value that is used in caller method to detect when all tiles have been spawned</param>
|
||||||
|
/// <param name="tileSpawnAcceleration">a delegate which speeds up the spawning of the tiles over time</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task LoadToTilemap(Tilemap reference, Func<bool> shouldKillTask, PlacementAnimationHandler placementAnimation = null, Action allTilesSpawned = default, Func<float> tileSpawnAcceleration = default)
|
||||||
|
{
|
||||||
|
// if the function we receive is null, we just make it constant 1
|
||||||
|
if (tileSpawnAcceleration == default) tileSpawnAcceleration = () => 1;
|
||||||
|
if (placementAnimation == null) placementAnimation = (tileData, placer, killer) =>
|
||||||
|
{
|
||||||
|
reference.SetTile(tileData.Position, tileData.Tile);
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var tilesPerSecond = Application.isPlaying ? GlobalConfig.Instance.Current.baseTileSpawnSpeed : float.Epsilon;
|
||||||
|
reference.transform.localPosition = _position;
|
||||||
|
reference.transform.localScale = _scale;
|
||||||
|
|
||||||
|
var rend = reference.GetComponent<TilemapRenderer>();
|
||||||
|
rend.sortingOrder = _renderOrder;
|
||||||
|
rend.sortingLayerName = _renderLayer;
|
||||||
|
if (_isInvisible) rend.gameObject.layer = INVISIBLE_LAYER;
|
||||||
|
if (_isCollidable)
|
||||||
|
{
|
||||||
|
var collision = rend.gameObject.AddComponent<TilemapCollider2D>();
|
||||||
|
collision.isTrigger = _isTrigger;
|
||||||
|
}
|
||||||
|
|
||||||
|
//all tiles are loaded after their animation is over. use a task to asyncroneously load them and keep control over the flow
|
||||||
|
var tasks = new List<Task>();
|
||||||
|
foreach (TileData data in _tiles)
|
||||||
|
{
|
||||||
|
tasks.Add(placementAnimation(data, () => reference.SetTile(data.Position, data.Tile), shouldKillTask));
|
||||||
|
if (shouldKillTask())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
await Task.Delay((int)(1000f / (tilesPerSecond * tileSpawnAcceleration())));
|
await Task.Delay((int)(1000f / (tilesPerSecond * tileSpawnAcceleration())));
|
||||||
}
|
}
|
||||||
allTilesSpawned?.Invoke();
|
allTilesSpawned?.Invoke();
|
||||||
|
if (shouldKillTask())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
await Task.WhenAll(tasks);
|
await Task.WhenAll(tasks);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -8,6 +8,7 @@ using Newtonsoft.Json;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using GatherAndDefend.Events;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// data class for containing everything level related
|
/// data class for containing everything level related
|
||||||
@ -16,8 +17,6 @@ public class LevelManager : Singleton<LevelManager>
|
|||||||
{
|
{
|
||||||
string SavePath => Application.dataPath + "/save.txt";
|
string SavePath => Application.dataPath + "/save.txt";
|
||||||
|
|
||||||
public event OnLevelLoaded LevelLoaded;
|
|
||||||
|
|
||||||
public delegate void OnLevelLoaded(Level level);
|
public delegate void OnLevelLoaded(Level level);
|
||||||
public delegate void LevelAction(ILevelObject levelObject);
|
public delegate void LevelAction(ILevelObject levelObject);
|
||||||
public delegate bool LevelPredicate<T>(T levelObject) where T : ILevelObject;
|
public delegate bool LevelPredicate<T>(T levelObject) where T : ILevelObject;
|
||||||
@ -26,6 +25,8 @@ public class LevelManager : Singleton<LevelManager>
|
|||||||
private readonly List<ILevelObject> _toRemove;
|
private readonly List<ILevelObject> _toRemove;
|
||||||
private readonly List<ILevelObject> _levelObjects;
|
private readonly List<ILevelObject> _levelObjects;
|
||||||
private WaveObserver _waveObserver;
|
private WaveObserver _waveObserver;
|
||||||
|
private bool _isLoading = true;
|
||||||
|
private bool _shouldKillTask = false;
|
||||||
|
|
||||||
private Tilemap _dynamicTilemap;
|
private Tilemap _dynamicTilemap;
|
||||||
public Tilemap DynamicTilemap
|
public Tilemap DynamicTilemap
|
||||||
@ -101,7 +102,7 @@ public class LevelManager : Singleton<LevelManager>
|
|||||||
|
|
||||||
#region [Level management]
|
#region [Level management]
|
||||||
|
|
||||||
public void AddAndRemoveObjects()
|
void AddAndRemoveObjects()
|
||||||
{
|
{
|
||||||
//add and remove
|
//add and remove
|
||||||
var toAdd = new List<ILevelObject>(_toAdd);
|
var toAdd = new List<ILevelObject>(_toAdd);
|
||||||
@ -123,6 +124,7 @@ public class LevelManager : Singleton<LevelManager>
|
|||||||
|
|
||||||
public void UpdateLevel()
|
public void UpdateLevel()
|
||||||
{
|
{
|
||||||
|
if (_isLoading) return;
|
||||||
AddAndRemoveObjects();
|
AddAndRemoveObjects();
|
||||||
|
|
||||||
_levelObjects.ForEach(levelObject =>
|
_levelObjects.ForEach(levelObject =>
|
||||||
@ -142,22 +144,25 @@ public class LevelManager : Singleton<LevelManager>
|
|||||||
Clear();
|
Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void KillLoading()
|
||||||
|
{
|
||||||
|
_shouldKillTask = true;
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// loads a Level scriptable object
|
/// loads a Level scriptable object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="level">the level to load</param>
|
/// <param name="level">the level to load</param>
|
||||||
/// <param name="shouldClear">do we want to clear what's already there before loading?</param>
|
/// <param name="shouldClear">do we want to clear what's already there before loading?</param>
|
||||||
/// <param name="placementAnimation">the tiles falling from the top of the screen</param>
|
/// <param name="placementAnimation">the tiles falling from the top of the screen</param>
|
||||||
public async Task LoadLevel(Level level, bool shouldClear = false, PlacementAnimationHandler placementAnimation = null)
|
public async Task LoadLevel(Level level, PlacementAnimationHandler placementAnimation = null)
|
||||||
{
|
{
|
||||||
|
_isLoading = true;
|
||||||
|
_shouldKillTask = false;
|
||||||
float accelerationOfAcceleration = GlobalConfig.Instance.Current.tileSpawnAcceleration;
|
float accelerationOfAcceleration = GlobalConfig.Instance.Current.tileSpawnAcceleration;
|
||||||
float tileCurrentAcceleration = 1;
|
float tileCurrentAcceleration = 1;
|
||||||
float tileSpawnAccelerationFunc() => (tileCurrentAcceleration += accelerationOfAcceleration * Time.deltaTime);
|
float tileSpawnAccelerationFunc() => (tileCurrentAcceleration += accelerationOfAcceleration * Time.deltaTime);
|
||||||
|
|
||||||
if (shouldClear)
|
ClearLevel();
|
||||||
{
|
|
||||||
ClearLevel();
|
|
||||||
}
|
|
||||||
|
|
||||||
_currentLevel = level;
|
_currentLevel = level;
|
||||||
_waveObserver = WaveObserver.Instance;
|
_waveObserver = WaveObserver.Instance;
|
||||||
@ -190,12 +195,23 @@ public class LevelManager : Singleton<LevelManager>
|
|||||||
tilemap.gameObject.AddComponent<TilemapRenderer>();
|
tilemap.gameObject.AddComponent<TilemapRenderer>();
|
||||||
tilemap.transform.SetParent(grid.transform);
|
tilemap.transform.SetParent(grid.transform);
|
||||||
|
|
||||||
tasks.Add(tilemapData.LoadToTilemap(tilemap, placementAnimation, OnAllTilesSpawned, tileSpawnAccelerationFunc));
|
tasks.Add(tilemapData.LoadToTilemap(tilemap, () => _shouldKillTask, placementAnimation, OnAllTilesSpawned, tileSpawnAccelerationFunc));
|
||||||
|
|
||||||
|
if (_shouldKillTask)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
await Extensions.WaitWhile(() => !allTilesSpawned);
|
await Extensions.WaitWhile(() => !allTilesSpawned);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_shouldKillTask)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
await Task.WhenAll(tasks);
|
await Task.WhenAll(tasks);
|
||||||
LevelLoaded?.Invoke(level);
|
|
||||||
|
EventAggregator.Instance.GetEvent<LevelLoadedEvent>().Invoke(level);
|
||||||
|
_isLoading = false;
|
||||||
Debug.Log("level loaded successfully");
|
Debug.Log("level loaded successfully");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,17 +221,12 @@ public class LevelManager : Singleton<LevelManager>
|
|||||||
/// <param name="levelName">the name of the loaded Level</param>
|
/// <param name="levelName">the name of the loaded Level</param>
|
||||||
/// <param name="shouldClear">should we clear what's already there?</param>
|
/// <param name="shouldClear">should we clear what's already there?</param>
|
||||||
/// <param name="placementAnimation">the tiles falling animation</param>
|
/// <param name="placementAnimation">the tiles falling animation</param>
|
||||||
public async Task LoadLevel(string levelName, bool shouldClear = false, PlacementAnimationHandler placementAnimation = null)
|
public async Task LoadLevel(string levelName, PlacementAnimationHandler placementAnimation = null)
|
||||||
{
|
{
|
||||||
if (shouldClear)
|
|
||||||
{
|
|
||||||
ClearLevel();
|
|
||||||
}
|
|
||||||
|
|
||||||
//fetch level from database
|
//fetch level from database
|
||||||
_currentLevel = Database.Instance.ScriptableObjects[levelName] as Level;
|
_currentLevel = Database.Instance.ScriptableObjects[levelName] as Level;
|
||||||
|
|
||||||
await LoadLevel(_currentLevel, shouldClear, placementAnimation);
|
await LoadLevel(_currentLevel, placementAnimation).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveFile()
|
public void SaveFile()
|
||||||
@ -255,8 +266,7 @@ public class LevelManager : Singleton<LevelManager>
|
|||||||
var otherDict = dicts.Find(x => x[nameof(ILevelObject.ObjectType)].ToString() == nameof(ILevelObject.ObjectType.Other));
|
var otherDict = dicts.Find(x => x[nameof(ILevelObject.ObjectType)].ToString() == nameof(ILevelObject.ObjectType.Other));
|
||||||
DictToOtherValues(otherDict);
|
DictToOtherValues(otherDict);
|
||||||
|
|
||||||
|
EventAggregator.Instance.GetEvent<LevelLoadedEvent>().Invoke(_currentLevel);
|
||||||
LevelLoaded?.Invoke(_currentLevel);
|
|
||||||
Debug.Log("game loaded successfully");
|
Debug.Log("game loaded successfully");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,12 +4,14 @@ using System.Collections;
|
|||||||
using UnityEngine.Tilemaps;
|
using UnityEngine.Tilemaps;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System;
|
using System;
|
||||||
|
using GatherAndDefend.Events;
|
||||||
|
using static LevelManager;
|
||||||
|
|
||||||
/// <param name="position">The position the tile should be placed on</param>
|
/// <param name="position">The position the tile should be placed on</param>
|
||||||
/// <param name="tile">the tile we should place</param>
|
/// <param name="tile">the tile we should place</param>
|
||||||
/// <param name="tilePlacement">the action of placing the tile on the tilemap</param>
|
/// <param name="tilePlacement">the action of placing the tile on the tilemap</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public delegate Task PlacementAnimationHandler(Vector3 position, TileBase tile, Action tilePlacement);
|
public delegate Task PlacementAnimationHandler(GatherAndDefend.LevelEditor.TileData tileData, Action tilePlacement, Func<bool> shouldKillTask);
|
||||||
public class LevelManagerScript : SingletonBehaviour<LevelManagerScript>
|
public class LevelManagerScript : SingletonBehaviour<LevelManagerScript>
|
||||||
{
|
{
|
||||||
private Action updateAction = null;
|
private Action updateAction = null;
|
||||||
@ -18,15 +20,18 @@ public class LevelManagerScript : SingletonBehaviour<LevelManagerScript>
|
|||||||
async void Start()
|
async void Start()
|
||||||
{
|
{
|
||||||
//only when the level is loaded do we start updating
|
//only when the level is loaded do we start updating
|
||||||
LevelManager.Instance.LevelLoaded += Instance_LevelLoaded;
|
EventAggregator.Instance.GetEvent<LevelLoadedEvent>().Attach(Instance_LevelLoaded);
|
||||||
|
EventAggregator.Instance.GetEvent<ExitingLevelEvent>().Attach(KillLoading);
|
||||||
if (loadOnStart && firstLevel)
|
if (loadOnStart && firstLevel)
|
||||||
{
|
{
|
||||||
await LevelManager.Instance.LoadLevel(firstLevel, placementAnimation: PlacementAnimation);
|
await LevelManager.Instance.LoadLevel(firstLevel, PlacementAnimation);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDestroy()
|
void OnDestroy()
|
||||||
{
|
{
|
||||||
|
EventAggregator.Instance.GetEvent<ExitingLevelEvent>().Detach(KillLoading);
|
||||||
updateAction = null;
|
updateAction = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,7 +53,7 @@ public class LevelManagerScript : SingletonBehaviour<LevelManagerScript>
|
|||||||
/// <param name="tile">what the tile represents</param>
|
/// <param name="tile">what the tile represents</param>
|
||||||
/// <param name="putTileOnTilemap">the action of actually placing the tile</param>
|
/// <param name="putTileOnTilemap">the action of actually placing the tile</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static async Task PlacementAnimation(Vector3 position, TileBase tile, System.Action putTileOnTilemap)
|
public static async Task PlacementAnimation(GatherAndDefend.LevelEditor.TileData tile, Action putTileOnTilemap, Func<bool> shouldKillTask)
|
||||||
{
|
{
|
||||||
const string layer = "Unit";
|
const string layer = "Unit";
|
||||||
float speed = 0;
|
float speed = 0;
|
||||||
@ -56,23 +61,24 @@ public class LevelManagerScript : SingletonBehaviour<LevelManagerScript>
|
|||||||
|
|
||||||
//create the falling GameObject that will placehold for the tile
|
//create the falling GameObject that will placehold for the tile
|
||||||
var tilePlaceholder = new GameObject("tile");
|
var tilePlaceholder = new GameObject("tile");
|
||||||
|
tilePlaceholder.transform.SetParent(Instance.transform);
|
||||||
var rend = tilePlaceholder.AddComponent<SpriteRenderer>();
|
var rend = tilePlaceholder.AddComponent<SpriteRenderer>();
|
||||||
rend.sortingOrder = 10;
|
rend.sortingOrder = 10;
|
||||||
rend.sortingLayerName = layer;
|
rend.sortingLayerName = layer;
|
||||||
|
|
||||||
if (tile is LevelTile)
|
if (tile.Tile is LevelTile)
|
||||||
{
|
{
|
||||||
rend.sprite = (tile as LevelTile).Sprite;
|
rend.sprite = (tile.Tile as LevelTile).Sprite;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rend.sprite = (tile as Tile).sprite;
|
rend.sprite = (tile.Tile as Tile).sprite;
|
||||||
}
|
}
|
||||||
|
|
||||||
//position the tile over the board (past the camera's FOV)
|
//position the tile over the board (past the camera's FOV)
|
||||||
tilePlaceholder.transform.position = position + Vector3.up * Camera.main.orthographicSize * 2;
|
tilePlaceholder.transform.position = tile.Position + Vector3.up * Camera.main.orthographicSize * 2;
|
||||||
|
|
||||||
var delta = tilePlaceholder.transform.position - position;
|
var delta = tilePlaceholder.transform.position - tile.Position;
|
||||||
var direction = delta.normalized;
|
var direction = delta.normalized;
|
||||||
var signY = delta.y / Mathf.Abs(delta.y);
|
var signY = delta.y / Mathf.Abs(delta.y);
|
||||||
|
|
||||||
@ -84,11 +90,15 @@ public class LevelManagerScript : SingletonBehaviour<LevelManagerScript>
|
|||||||
//make the placeholder fall and check if we went past the target position
|
//make the placeholder fall and check if we went past the target position
|
||||||
speed += acceleration * Time.deltaTime;
|
speed += acceleration * Time.deltaTime;
|
||||||
tilePlaceholder.transform.position += speed * Time.deltaTime * direction;
|
tilePlaceholder.transform.position += speed * Time.deltaTime * direction;
|
||||||
var newDelta = tilePlaceholder.transform.position - position;
|
var newDelta = tilePlaceholder.transform.position - tile.Position;
|
||||||
var newSign = newDelta.y / Mathf.Abs(newDelta.y);
|
var newSign = newDelta.y / Mathf.Abs(newDelta.y);
|
||||||
|
|
||||||
if (newSign != signY) break;
|
if (newSign != signY) break;
|
||||||
|
|
||||||
|
if (shouldKillTask())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
await Task.Yield();
|
await Task.Yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,4 +106,8 @@ public class LevelManagerScript : SingletonBehaviour<LevelManagerScript>
|
|||||||
putTileOnTilemap.Invoke();
|
putTileOnTilemap.Invoke();
|
||||||
Destroy(tilePlaceholder);
|
Destroy(tilePlaceholder);
|
||||||
}
|
}
|
||||||
|
void KillLoading()
|
||||||
|
{
|
||||||
|
LevelManager.Instance.KillLoading();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,7 +1,9 @@
|
|||||||
using System.Collections;
|
using GatherAndDefend.Events;
|
||||||
|
using System.Collections;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// manages the logic of loading
|
/// manages the logic of loading
|
||||||
@ -17,9 +19,23 @@ public class LoadingManager : MonoBehaviour
|
|||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
loadingScreen = GetComponent<LoadingScreen>();
|
loadingScreen = GetComponent<LoadingScreen>();
|
||||||
loadingScreen.ScreenActivated += LoadTargetSceneAndCloseOthers;
|
EventAggregator.Instance.GetEvent<ScreenActivatedEvent>().Attach(LoadTargetSceneAndCloseOthers);
|
||||||
loadingScreen.ShowLoadingScreen();
|
loadingScreen.ShowLoadingScreen();
|
||||||
}
|
}
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
foreach (var button in FindObjectsOfType<Button>())
|
||||||
|
{
|
||||||
|
button.enabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void OnDestroy()
|
||||||
|
{
|
||||||
|
foreach (var button in FindObjectsOfType<Button>())
|
||||||
|
{
|
||||||
|
button.enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// loads the target scene after given time
|
/// loads the target scene after given time
|
||||||
@ -32,7 +48,7 @@ public class LoadingManager : MonoBehaviour
|
|||||||
{
|
{
|
||||||
yield return new WaitForSeconds(GlobalConfig.Instance.Current.loadingAddedTime);
|
yield return new WaitForSeconds(GlobalConfig.Instance.Current.loadingAddedTime);
|
||||||
|
|
||||||
loadingScreen.ScreenActivated -= LoadTargetSceneAndCloseOthers;
|
EventAggregator.Instance.GetEvent<ScreenActivatedEvent>().Detach(LoadTargetSceneAndCloseOthers);
|
||||||
SceneManager.sceneLoaded += StartHidingLoadingScreen;
|
SceneManager.sceneLoaded += StartHidingLoadingScreen;
|
||||||
|
|
||||||
var sceneToLoad = PlayerPrefs.GetString(SceneToLoad);
|
var sceneToLoad = PlayerPrefs.GetString(SceneToLoad);
|
||||||
@ -57,38 +73,32 @@ public class LoadingManager : MonoBehaviour
|
|||||||
private void StartHidingLoadingScreen(Scene arg0, LoadSceneMode arg1)
|
private void StartHidingLoadingScreen(Scene arg0, LoadSceneMode arg1)
|
||||||
{
|
{
|
||||||
SceneManager.sceneLoaded -= StartHidingLoadingScreen;
|
SceneManager.sceneLoaded -= StartHidingLoadingScreen;
|
||||||
loadingScreen.ScreenDeactivated += StartLoadingLevel;
|
EventAggregator.Instance.GetEvent<ScreenDeactivatedEvent>().Attach(StartLoadingLevel);
|
||||||
loadingScreen.HideLoadingScreen();
|
loadingScreen.HideLoadingScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// when loading screen is hidden, we load the level if we have a level to load (might not, if we have loaded another scene than the Game scene)
|
/// when loading screen is hidden, we load the level if we have a level to load (might not, if we have loaded another scene than the Game scene)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private async void StartLoadingLevel()
|
private void StartLoadingLevel()
|
||||||
{
|
{
|
||||||
loadingScreen.ScreenDeactivated -= StartLoadingLevel;
|
EventAggregator.Instance.GetEvent<ScreenDeactivatedEvent>().Detach(StartLoadingLevel);
|
||||||
LevelManager.Instance.LevelLoaded += UnloadLoadingScreenScene;
|
|
||||||
|
|
||||||
var levelToLoad = PlayerPrefs.GetInt(LevelToLoad, NoLevel);
|
var levelToLoad = PlayerPrefs.GetInt(LevelToLoad, NoLevel);
|
||||||
if (levelToLoad == NoLevel)
|
if(levelToLoad != NoLevel)
|
||||||
{
|
|
||||||
UnloadLoadingScreenScene(null);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
string lvlName = $"Level{levelToLoad}";
|
string lvlName = $"Level{levelToLoad}";
|
||||||
await LevelManager.Instance.LoadLevel(lvlName, true, LevelManagerScript.PlacementAnimation);
|
_ = LevelManager.Instance.LoadLevel(lvlName, LevelManagerScript.PlacementAnimation);
|
||||||
}
|
}
|
||||||
|
UnloadLoadingScreenScene();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// close the loading screen scene and start playing! w00t w00t
|
/// close the loading screen scene and start playing! w00t w00t
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="level"></param>
|
/// <param name="level"></param>
|
||||||
private void UnloadLoadingScreenScene(GatherAndDefend.LevelEditor.Level level)
|
private void UnloadLoadingScreenScene()
|
||||||
{
|
{
|
||||||
LevelManager.Instance.LevelLoaded -= UnloadLoadingScreenScene;
|
|
||||||
SceneManager.UnloadSceneAsync(gameObject.scene.name);
|
SceneManager.UnloadSceneAsync(gameObject.scene.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,8 @@ using System.Collections.Generic;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
using GatherAndDefend.Events;
|
||||||
|
|
||||||
[CustomEditor(typeof(LoadingScreen))]
|
[CustomEditor(typeof(LoadingScreen))]
|
||||||
public class LoadingScreenEditor : Editor
|
public class LoadingScreenEditor : Editor
|
||||||
{
|
{
|
||||||
@ -26,9 +28,6 @@ public class LoadingScreenEditor : Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class LoadingScreen : SingletonBehaviour<LoadingScreen>
|
public class LoadingScreen : SingletonBehaviour<LoadingScreen>
|
||||||
{
|
{
|
||||||
public event System.Action ScreenActivated;
|
|
||||||
public event System.Action ScreenDeactivated;
|
|
||||||
|
|
||||||
[Header("Screen")]
|
[Header("Screen")]
|
||||||
public CanvasGroup blueScreen;
|
public CanvasGroup blueScreen;
|
||||||
public float fadeInDuration = 1;
|
public float fadeInDuration = 1;
|
||||||
@ -59,12 +58,12 @@ public class LoadingScreen : SingletonBehaviour<LoadingScreen>
|
|||||||
private IEnumerator EnableLoadingScreen()
|
private IEnumerator EnableLoadingScreen()
|
||||||
{
|
{
|
||||||
yield return blueScreen.FadeTo(1, fadeInDuration);
|
yield return blueScreen.FadeTo(1, fadeInDuration);
|
||||||
ScreenActivated?.Invoke();
|
EventAggregator.Instance.GetEvent<ScreenActivatedEvent>().Invoke();
|
||||||
}
|
}
|
||||||
private IEnumerator DisableLoadingScreen()
|
private IEnumerator DisableLoadingScreen()
|
||||||
{
|
{
|
||||||
yield return blueScreen.FadeTo(0, fadeOutDuration);
|
yield return blueScreen.FadeTo(0, fadeOutDuration);
|
||||||
ScreenDeactivated?.Invoke();
|
EventAggregator.Instance.GetEvent<ScreenDeactivatedEvent>().Invoke();
|
||||||
}
|
}
|
||||||
public void ShowLoadingScreen()
|
public void ShowLoadingScreen()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -68,6 +68,7 @@ public class ResourceMaker : MonoBehaviour
|
|||||||
|
|
||||||
public void GenerateResource()
|
public void GenerateResource()
|
||||||
{
|
{
|
||||||
|
if (!_rigidbody) return;
|
||||||
_isPlaying = true;
|
_isPlaying = true;
|
||||||
_rigidbody.gravityScale = 0.0f;
|
_rigidbody.gravityScale = 0.0f;
|
||||||
_rigidbody.velocity = Vector2.zero;
|
_rigidbody.velocity = Vector2.zero;
|
||||||
|
|||||||
@ -24,6 +24,8 @@ public class Root : MonoBehaviour
|
|||||||
Rigidbody2D _rigidbodyAlly;
|
Rigidbody2D _rigidbodyAlly;
|
||||||
Rigidbody2D _rigidbodyOpponent;
|
Rigidbody2D _rigidbodyOpponent;
|
||||||
_rigidbodyAlly = _entity.GetComponent<Rigidbody2D>();
|
_rigidbodyAlly = _entity.GetComponent<Rigidbody2D>();
|
||||||
|
|
||||||
|
if (!_entity.Enemy) return;
|
||||||
_rigidbodyOpponent = _entity.Enemy.GetComponent<Rigidbody2D>();
|
_rigidbodyOpponent = _entity.Enemy.GetComponent<Rigidbody2D>();
|
||||||
|
|
||||||
Vector3 spawnPos = (_projectileSpawn == null) ? _rigidbodyAlly.position : _projectileSpawn.position;
|
Vector3 spawnPos = (_projectileSpawn == null) ? _rigidbodyAlly.position : _projectileSpawn.position;
|
||||||
|
|||||||
@ -1,10 +1,6 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using System;
|
|
||||||
using UnityEditor;
|
|
||||||
|
|
||||||
public class WorldMapManager : MonoBehaviour
|
public class WorldMapManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|||||||
@ -8,11 +8,11 @@ EditorBuildSettings:
|
|||||||
- enabled: 1
|
- enabled: 1
|
||||||
path: Assets/Scenes/LevelSelect.unity
|
path: Assets/Scenes/LevelSelect.unity
|
||||||
guid: c1efd9104a876984eb669c4bd54598d1
|
guid: c1efd9104a876984eb669c4bd54598d1
|
||||||
- enabled: 1
|
|
||||||
path: Assets/Scenes/Game.unity
|
|
||||||
guid: 8c9cfa26abfee488c85f1582747f6a02
|
|
||||||
- enabled: 1
|
- enabled: 1
|
||||||
path: Assets/Scenes/LoadingScreen.unity
|
path: Assets/Scenes/LoadingScreen.unity
|
||||||
guid: 6da14f6006606f840b2df7664c50e1ec
|
guid: 6da14f6006606f840b2df7664c50e1ec
|
||||||
|
- enabled: 1
|
||||||
|
path: Assets/Scenes/Game.unity
|
||||||
|
guid: 435ced5e4c7807f409bbc420fc6b95ad
|
||||||
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