Pull request #10: Feature/LoadSave
Merge in CGD/gather-and-defend from feature/LoadSave to main * commit 'ec94ccfc145829cf329792d9e66188da7663b54b': ajout de doc xml pour la classe database manage when tiles or objects are removed tidied up + addressed issue with non-LevelTiles save / load dans un fichier working save / load functions travail sur le save et le load some tidying up made LevelObject and Tile methods virtual finish to hijack update loop + serialization tweaks to LevelManager
This commit is contained in:
commit
92ffe56009
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6642a2a073009cf448c580a617557cb1
|
||||
guid: 8a15f4b90f65f61489693e72dc43b1bd
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
BIN
Assets/Docu/LevelManager class diagram.png
Normal file
BIN
Assets/Docu/LevelManager class diagram.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 110 KiB |
147
Assets/Docu/LevelManager class diagram.png.meta
Normal file
147
Assets/Docu/LevelManager class diagram.png.meta
Normal file
@ -0,0 +1,147 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 692cbdef9f1490b4b85ea6fc032ca4a8
|
||||
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:
|
||||
51
Assets/Editor/DatabaseEditor.cs
Normal file
51
Assets/Editor/DatabaseEditor.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
||||
[CustomEditor(typeof(Database))]
|
||||
public class DatabaseEditor : Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
DrawDefaultInspector();
|
||||
|
||||
if (GUILayout.Button("fetch assets"))
|
||||
{
|
||||
var targ = target as Database;
|
||||
|
||||
|
||||
|
||||
foreach (var folder in targ.Folders)
|
||||
{
|
||||
var path = AssetDatabase.GetAssetPath(folder);
|
||||
foreach (var file in GetAllPaths(path))
|
||||
{
|
||||
var scriptableObject = AssetDatabase.LoadAssetAtPath<ScriptableObject>(file);
|
||||
if (scriptableObject && !targ.ScriptableObjects.Contains(scriptableObject))
|
||||
{
|
||||
targ.ScriptableObjects.Add(scriptableObject);
|
||||
}
|
||||
|
||||
var prefab = AssetDatabase.LoadAssetAtPath<GameObject>(file);
|
||||
if (prefab && !targ.Prefabs.Contains(prefab))
|
||||
{
|
||||
targ.Prefabs.Add(prefab);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string[] GetAllPaths(string target)
|
||||
{
|
||||
var files = Directory.GetFiles(target).ToList();
|
||||
foreach (var dir in Directory.GetDirectories(target))
|
||||
{
|
||||
files.AddRange(GetAllPaths(dir));
|
||||
}
|
||||
return files.ToArray();
|
||||
}
|
||||
}
|
||||
11
Assets/Editor/DatabaseEditor.cs.meta
Normal file
11
Assets/Editor/DatabaseEditor.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca089e7bfdaf2a943aebf7ce03bbd2e6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -2,7 +2,6 @@
|
||||
using UnityEngine.Tilemaps;
|
||||
using UnityEngine;
|
||||
using System.IO;
|
||||
using static UnityEngine.GraphicsBuffer;
|
||||
using UnityEditor.SceneManagement;
|
||||
|
||||
namespace GatherAndDefend.LevelEditor
|
||||
@ -121,7 +120,7 @@ Important considerations :
|
||||
foreach (TilemapData tilemapData in targ.Level)
|
||||
{
|
||||
var tilemap = new GameObject(tilemapData.Key).AddComponent<Tilemap>();
|
||||
var rend = tilemap.gameObject.AddComponent<TilemapRenderer>();
|
||||
tilemap.gameObject.AddComponent<TilemapRenderer>();
|
||||
tilemapData.LoadToTilemap(tilemap);
|
||||
tilemap.transform.SetParent(targ.transform);
|
||||
}
|
||||
|
||||
19
Assets/Editor/LevelManagerEditor.cs
Normal file
19
Assets/Editor/LevelManagerEditor.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
[CustomEditor(typeof(LevelManagerScript))]
|
||||
public class LevelManagerEditor : Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
DrawDefaultInspector();
|
||||
if (GUILayout.Button("Save"))
|
||||
{
|
||||
LevelManager.Instance.SaveFile();
|
||||
}
|
||||
if (GUILayout.Button("Load"))
|
||||
{
|
||||
LevelManager.Instance.LoadFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Editor/LevelManagerEditor.cs.meta
Normal file
11
Assets/Editor/LevelManagerEditor.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c34c07f45297c74ca25240700f7903d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@ -14,9 +14,35 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
_data:
|
||||
- _key: Background
|
||||
tiles:
|
||||
_tiles:
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -8, y: -5, z: 0}
|
||||
_position: {x: -10, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -10, y: -3, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -10, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -10, y: -1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -10, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -10, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -10, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -9, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -9, y: -3, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -9, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -9, y: -1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -9, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -9, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -9, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -8, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
@ -30,7 +56,7 @@ MonoBehaviour:
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -8, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -7, y: -5, z: 0}
|
||||
_position: {x: -8, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -7, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
@ -44,7 +70,7 @@ MonoBehaviour:
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -7, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -6, y: -5, z: 0}
|
||||
_position: {x: -7, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -6, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
@ -58,7 +84,7 @@ MonoBehaviour:
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -6, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -5, y: -5, z: 0}
|
||||
_position: {x: -6, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -5, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
@ -72,7 +98,7 @@ MonoBehaviour:
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -5, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -4, y: -5, z: 0}
|
||||
_position: {x: -5, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -4, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
@ -86,7 +112,7 @@ MonoBehaviour:
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -4, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -3, y: -5, z: 0}
|
||||
_position: {x: -4, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -3, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
@ -100,7 +126,7 @@ MonoBehaviour:
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -3, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -2, y: -5, z: 0}
|
||||
_position: {x: -3, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -2, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
@ -114,7 +140,7 @@ MonoBehaviour:
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -2, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -1, y: -5, z: 0}
|
||||
_position: {x: -2, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -1, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
@ -128,7 +154,7 @@ MonoBehaviour:
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -1, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 0, y: -5, z: 0}
|
||||
_position: {x: -1, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 0, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
@ -142,7 +168,7 @@ MonoBehaviour:
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 0, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 1, y: -5, z: 0}
|
||||
_position: {x: 0, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 1, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
@ -156,7 +182,7 @@ MonoBehaviour:
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 1, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 2, y: -5, z: 0}
|
||||
_position: {x: 1, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 2, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
@ -170,7 +196,7 @@ MonoBehaviour:
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 2, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 3, y: -5, z: 0}
|
||||
_position: {x: 2, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 3, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
@ -184,7 +210,7 @@ MonoBehaviour:
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 3, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 4, y: -5, z: 0}
|
||||
_position: {x: 3, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 4, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
@ -197,71 +223,212 @@ MonoBehaviour:
|
||||
_position: {x: 4, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 4, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 4, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 5, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 5, y: -3, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 5, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 5, y: -1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 5, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 5, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 5, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 6, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 6, y: -3, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 6, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 6, y: -1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 6, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 6, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 6, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 7, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 7, y: -3, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 7, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 7, y: -1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 7, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 7, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 7, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 8, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 8, y: -3, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 8, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 8, y: -1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 8, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 8, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 8, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 9, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 9, y: -3, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 9, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 9, y: -1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 9, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 9, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 9, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 10, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 10, y: -3, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 10, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 10, y: -1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 10, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 10, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: 10, y: 2, z: 0}
|
||||
_isInvisible: 0
|
||||
_isCollidable: 0
|
||||
_isTrigger: 0
|
||||
_renderOrder: 0
|
||||
_renderLayer: Default
|
||||
- _key: Entities
|
||||
tiles:
|
||||
_tiles:
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: -8, y: -5, z: 0}
|
||||
_position: {x: -10, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: -8, y: -3, z: 0}
|
||||
_position: {x: -10, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: -8, y: -1, z: 0}
|
||||
_position: {x: -10, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: -8, y: 1, z: 0}
|
||||
_position: {x: -10, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: -6, y: -5, z: 0}
|
||||
_position: {x: -8, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: -6, y: -3, z: 0}
|
||||
_position: {x: -8, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: -6, y: -1, z: 0}
|
||||
_position: {x: -8, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: -6, y: 1, z: 0}
|
||||
_position: {x: -8, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: -4, y: -5, z: 0}
|
||||
_position: {x: -6, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: -4, y: -3, z: 0}
|
||||
_position: {x: -6, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: -4, y: -1, z: 0}
|
||||
_position: {x: -6, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: -4, y: 1, z: 0}
|
||||
_position: {x: -6, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: -2, y: -5, z: 0}
|
||||
_position: {x: -4, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: -2, y: -3, z: 0}
|
||||
_position: {x: -4, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: -2, y: -1, z: 0}
|
||||
_position: {x: -4, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: -2, y: 1, z: 0}
|
||||
_position: {x: -4, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 0, y: -5, z: 0}
|
||||
_position: {x: -2, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 0, y: -3, z: 0}
|
||||
_position: {x: -2, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 0, y: -1, z: 0}
|
||||
_position: {x: -2, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 0, y: 1, z: 0}
|
||||
_position: {x: -2, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 2, y: -5, z: 0}
|
||||
_position: {x: 0, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 2, y: -3, z: 0}
|
||||
_position: {x: 0, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 2, y: -1, z: 0}
|
||||
_position: {x: 0, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 2, y: 1, z: 0}
|
||||
_position: {x: 0, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 4, y: -5, z: 0}
|
||||
_position: {x: 2, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 4, y: -3, z: 0}
|
||||
_position: {x: 2, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 4, y: -1, z: 0}
|
||||
_position: {x: 2, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 4, y: 1, z: 0}
|
||||
_position: {x: 2, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 4, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 4, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 4, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 4, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 6, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 6, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 6, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 6, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 8, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 8, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 8, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 8, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 10, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 10, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 10, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
_position: {x: 10, y: 2, z: 0}
|
||||
_isInvisible: 0
|
||||
_isCollidable: 0
|
||||
_isTrigger: 0
|
||||
_renderOrder: 1
|
||||
_renderLayer: Default
|
||||
- _key: Spawners
|
||||
tiles:
|
||||
_tiles:
|
||||
- _tile: {fileID: 11400000, guid: 4aaf448680c7f8a438a9a5861c622a55, type: 2}
|
||||
_position: {x: -8, y: -5, z: 0}
|
||||
_position: {x: -10, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: 4aaf448680c7f8a438a9a5861c622a55, type: 2}
|
||||
_position: {x: -8, y: -3, z: 0}
|
||||
_position: {x: -10, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: 4aaf448680c7f8a438a9a5861c622a55, type: 2}
|
||||
_position: {x: -8, y: -1, z: 0}
|
||||
_position: {x: -10, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: 4aaf448680c7f8a438a9a5861c622a55, type: 2}
|
||||
_position: {x: -8, y: 1, z: 0}
|
||||
_position: {x: -10, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: 4002377ed7e87b34699f126f2b10c703, type: 2}
|
||||
_position: {x: 10, y: -4, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: 4002377ed7e87b34699f126f2b10c703, type: 2}
|
||||
_position: {x: 10, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: 4002377ed7e87b34699f126f2b10c703, type: 2}
|
||||
_position: {x: 10, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: 4002377ed7e87b34699f126f2b10c703, type: 2}
|
||||
_position: {x: 10, y: 2, z: 0}
|
||||
_isInvisible: 1
|
||||
_isCollidable: 0
|
||||
_isTrigger: 0
|
||||
_renderOrder: 2
|
||||
_renderLayer: Default
|
||||
|
||||
BIN
Assets/Newtonsoft.Json.dll
Normal file
BIN
Assets/Newtonsoft.Json.dll
Normal file
Binary file not shown.
33
Assets/Newtonsoft.Json.dll.meta
Normal file
33
Assets/Newtonsoft.Json.dll.meta
Normal file
@ -0,0 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 175b6e9751ccac44b94d94c793bec2d8
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
80
Assets/Prefabs/LevelManager.prefab
Normal file
80
Assets/Prefabs/LevelManager.prefab
Normal file
@ -0,0 +1,80 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &3028288566889208744
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 3028288566889208751}
|
||||
- component: {fileID: 3028288566889208750}
|
||||
- component: {fileID: 3028288566889208749}
|
||||
m_Layer: 0
|
||||
m_Name: LevelManager
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &3028288566889208751
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3028288566889208744}
|
||||
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}
|
||||
--- !u!114 &3028288566889208750
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3028288566889208744}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: c8f415d45fd9659408ac8c5ce2e96aba, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
firstLevel: {fileID: 11400000, guid: e715669e1ed4b294c82d07ac011e89bb, type: 2}
|
||||
--- !u!114 &3028288566889208749
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3028288566889208744}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: edb1aa3d6230b1e4c9a50056da756015, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_folders:
|
||||
- {fileID: 102900000, guid: f3dee7994db941e47b9445cb464c69a9, type: 3}
|
||||
- {fileID: 102900000, guid: 4f8284570682f8f4c954e446b35ea0ae, type: 3}
|
||||
- {fileID: 102900000, guid: 0ca30b5ca281be24bb62d7e48cc2bec8, type: 3}
|
||||
- {fileID: 102900000, guid: 73ca1afa7b0f7dd4ea39f69cf74f8370, type: 3}
|
||||
_prefabs:
|
||||
- {fileID: 6962989255644195630, guid: 6cd87b398e7a0e94580f4fcbe2fd310a, type: 3}
|
||||
- {fileID: 6962989255644195630, guid: 377c7275c0001cc47a6b8926ac57d573, type: 3}
|
||||
- {fileID: 6962989255644195630, guid: 869a03bba705e8d4485aa73daad773dc, type: 3}
|
||||
- {fileID: 6962989255644195630, guid: 9b40c232eddfd1b469bea688e3c970c0, type: 3}
|
||||
- {fileID: 4052934186652138539, guid: 8560e1f66d452b543a705c8a0f3e22fa, type: 3}
|
||||
- {fileID: 3814095509541806390, guid: 9527f3a1482b90a48bb6c62acc70f986, type: 3}
|
||||
_scriptableObjects:
|
||||
- {fileID: 11400000, guid: a6e34739c9325da4cac4fbaea30d052c, type: 2}
|
||||
- {fileID: 11400000, guid: d37561e153d6a6448a03839488fdec5e, type: 2}
|
||||
- {fileID: 11400000, guid: 4002377ed7e87b34699f126f2b10c703, type: 2}
|
||||
- {fileID: 11400000, guid: 4aaf448680c7f8a438a9a5861c622a55, type: 2}
|
||||
- {fileID: 11400000, guid: e715669e1ed4b294c82d07ac011e89bb, type: 2}
|
||||
- {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
- {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
7
Assets/Prefabs/LevelManager.prefab.meta
Normal file
7
Assets/Prefabs/LevelManager.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02daecb0115395844b4932445d039051
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1,10 +1,10 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using static Extensions;
|
||||
|
||||
public class Entity : MonoBehaviour
|
||||
public class Entity : LevelObject
|
||||
{
|
||||
|
||||
//Attribut
|
||||
[SerializeField]
|
||||
private int _hp;
|
||||
@ -64,15 +64,38 @@ public class Entity : MonoBehaviour
|
||||
set { _enemy = value; }
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
void Start()
|
||||
#region [LevelManager code]
|
||||
public override bool Equals(ILevelObject other)
|
||||
{
|
||||
|
||||
return other is Entity otherEntity
|
||||
&& base.Equals(otherEntity)
|
||||
&& otherEntity._hp == _hp
|
||||
&& otherEntity._speed == _speed
|
||||
&& otherEntity._attack_speed == _attack_speed
|
||||
&& otherEntity._attack_damage == _attack_damage;
|
||||
}
|
||||
|
||||
void Update()
|
||||
public override Dictionary<string, object> ToDictionary()
|
||||
{
|
||||
var dict = base.ToDictionary();
|
||||
|
||||
}*/
|
||||
dict[nameof(_hp)] = _hp;
|
||||
dict[nameof(_speed)] = _speed;
|
||||
dict[nameof(_attack_speed)] = _attack_speed;
|
||||
dict[nameof(_attack_damage)] = _attack_damage;
|
||||
dict[nameof(_attack_speed_wait)] = _attack_speed_wait;
|
||||
|
||||
return dict;
|
||||
}
|
||||
public override void LoadDictionary(Dictionary<string, object> dict)
|
||||
{
|
||||
base.LoadDictionary(dict);
|
||||
|
||||
_hp = dict[nameof(_hp)].ToInt();
|
||||
_speed = dict[nameof(_speed)].ToFloat();
|
||||
_attack_speed = dict[nameof(_attack_speed)].ToFloat();
|
||||
_attack_damage = dict[nameof(_attack_damage)].ToInt();
|
||||
_attack_speed_wait = dict[nameof(_attack_speed_wait)].ToFloat();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
8
Assets/Scripts/General.meta
Normal file
8
Assets/Scripts/General.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 42075bdb90181b04aa9d554efb39270e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
69
Assets/Scripts/General/Database.cs
Normal file
69
Assets/Scripts/General/Database.cs
Normal file
@ -0,0 +1,69 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// cette classe sert à réunir les prefabs et les scriptable objects importants. <br/>
|
||||
/// Elle permet d'éviter de devoir mettre tous nos prefabs et scriptable objects dans le dossier Resources <br/>
|
||||
/// et permet d'accéder aux éléments qu'on cherche par leur nom directement
|
||||
/// </summary>
|
||||
public class Database : SingletonBehaviour<Database>
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
[Header("Editor section")]
|
||||
[SerializeField]
|
||||
private List<DefaultAsset> _folders;
|
||||
|
||||
public List<DefaultAsset> Folders => _folders;
|
||||
#endif
|
||||
|
||||
public const string TYPE = nameof(TYPE);
|
||||
[Serializable]
|
||||
public class DataList<T> : IEnumerable<T> where T : UnityEngine.Object
|
||||
{
|
||||
[SerializeField]
|
||||
private List<T> elements;
|
||||
public DataList() => elements = new List<T>();
|
||||
|
||||
public T this[string key] => elements.Find(x => x.name == key);
|
||||
|
||||
public void Add(T element) => elements.Add(element);
|
||||
|
||||
|
||||
public IEnumerator<T> GetEnumerator()
|
||||
{
|
||||
return elements.GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return elements.GetEnumerator();
|
||||
}
|
||||
|
||||
public static implicit operator DataList<T>(List<T> list) => new DataList<T>() { elements = list };
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private List<GameObject> _prefabs;
|
||||
[SerializeField]
|
||||
private List<ScriptableObject> _scriptableObjects;
|
||||
|
||||
public DataList<GameObject> Prefabs => _prefabs;
|
||||
public DataList<ScriptableObject> ScriptableObjects => _scriptableObjects;
|
||||
|
||||
public Database()
|
||||
{
|
||||
_prefabs = new List<GameObject>();
|
||||
_scriptableObjects = new List<ScriptableObject>();
|
||||
}
|
||||
#if UNITY_EDITOR
|
||||
|
||||
#endif
|
||||
}
|
||||
11
Assets/Scripts/General/Database.cs.meta
Normal file
11
Assets/Scripts/General/Database.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: edb1aa3d6230b1e4c9a50056da756015
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: -1
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
54
Assets/Scripts/General/Extensions.cs
Normal file
54
Assets/Scripts/General/Extensions.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BindingFlags = System.Reflection.BindingFlags;
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public static class Extensions
|
||||
{
|
||||
public static int ToInt(this object jobj)
|
||||
{
|
||||
return int.Parse(jobj.ToString());
|
||||
}
|
||||
public static float ToFloat(this object jobj)
|
||||
{
|
||||
return float.Parse(jobj.ToString());
|
||||
}
|
||||
public static Vector3 ToVector3(this object jobj)
|
||||
{
|
||||
var p_enum = (jobj as IEnumerable).GetEnumerator();
|
||||
float[] p_array = new float[3];
|
||||
|
||||
p_enum.MoveNext();
|
||||
p_array[0] = float.Parse(p_enum.Current.ToString());
|
||||
p_enum.MoveNext();
|
||||
p_array[1] = float.Parse(p_enum.Current.ToString());
|
||||
p_enum.MoveNext();
|
||||
p_array[2] = float.Parse(p_enum.Current.ToString());
|
||||
|
||||
return new Vector3(p_array[0], p_array[1], p_array[2]);
|
||||
}
|
||||
public static bool ToBool(this object jobj) => bool.Parse(jobj.ToString());
|
||||
public static GameObject Create(this GameObject prefab, Vector3 position, Quaternion rotation = default, Transform parent = null)
|
||||
{
|
||||
if (rotation == default) rotation = Quaternion.identity;
|
||||
var instance = GameObject.Instantiate(prefab, position, rotation);
|
||||
instance.transform.SetParent(parent);
|
||||
instance.name = prefab.name;
|
||||
return instance;
|
||||
|
||||
}
|
||||
public static T GetComponentInChildren<T>(this Component obj, string name) where T : Component
|
||||
{
|
||||
foreach (var comp in obj.GetComponentsInChildren<T>())
|
||||
{
|
||||
if (comp.name == name) return comp;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public enum LevelObjectType { GameObject, Tile }
|
||||
public static bool Approximately(this Vector3 vect, Vector3 other)
|
||||
{
|
||||
return Mathf.Approximately(Vector3.Distance(vect, other), 0);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/General/Extensions.cs.meta
Normal file
11
Assets/Scripts/General/Extensions.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc70649308eb8914c847e075e85e0e28
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
20
Assets/Scripts/General/SingletonBehaviour.cs
Normal file
20
Assets/Scripts/General/SingletonBehaviour.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// a singleton but as a MonoBehaviour
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class SingletonBehaviour<T> : MonoBehaviour where T : SingletonBehaviour<T>
|
||||
{
|
||||
public static T Instance
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
protected virtual void Awake()
|
||||
{
|
||||
if (!Instance) Instance = this as T;
|
||||
else Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/General/SingletonBehaviour.cs.meta
Normal file
11
Assets/Scripts/General/SingletonBehaviour.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a27e0ff408916844d82fcbdf5b332589
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1,4 +1,8 @@
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace GatherAndDefend.LevelEditor
|
||||
@ -6,8 +10,16 @@ namespace GatherAndDefend.LevelEditor
|
||||
[RequireComponent(typeof(Grid))]
|
||||
public class LevelEditor : MonoBehaviour
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
[SerializeField]
|
||||
private DefaultAsset _path;
|
||||
public DefaultAsset Path
|
||||
{
|
||||
get => _path;
|
||||
set => _path = value;
|
||||
}
|
||||
#endif
|
||||
|
||||
[SerializeField]
|
||||
private Level _level;
|
||||
public Level Level
|
||||
@ -15,10 +27,6 @@ namespace GatherAndDefend.LevelEditor
|
||||
get => _level;
|
||||
set => _level = value;
|
||||
}
|
||||
public DefaultAsset Path
|
||||
{
|
||||
get => _path;
|
||||
set => _path = value;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Tilemaps;
|
||||
|
||||
[CreateAssetMenu(menuName = "Gather And Defend/Spawner Tile")]
|
||||
public class SpawnerTile : TileBase
|
||||
{
|
||||
[SerializeField]
|
||||
private Sprite _sprite;
|
||||
[SerializeField]
|
||||
private GameObject _prefab;
|
||||
|
||||
public override void GetTileData(Vector3Int position, ITilemap tilemap, ref TileData tileData)
|
||||
{
|
||||
tileData.sprite = _sprite;
|
||||
tileData.transform.SetTRS(Vector3.zero, Quaternion.identity, Vector3.one);
|
||||
tileData.color = Color.white;
|
||||
}
|
||||
public override bool StartUp(Vector3Int position, ITilemap tilemap, GameObject go)
|
||||
{
|
||||
if (!Application.isPlaying) return base.StartUp(position, tilemap, go);
|
||||
Instantiate(_prefab, new Vector3(0.5f, 0.5f) + position, Quaternion.identity);
|
||||
return base.StartUp(position, tilemap, go);
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,8 @@ using UnityEngine.Tilemaps;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace GatherAndDefend.LevelEditor
|
||||
{
|
||||
@ -75,6 +77,83 @@ namespace GatherAndDefend.LevelEditor
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// returns a dictionary representation of the tilemap
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Dictionary<string, object> ToDictionary()
|
||||
{
|
||||
return new Dictionary<string, object>()
|
||||
{
|
||||
{nameof(_key), _key },
|
||||
{nameof(_isInvisible), _isInvisible },
|
||||
{nameof(_isCollidable), _isCollidable },
|
||||
{nameof(_isTrigger), _isTrigger },
|
||||
{nameof(_renderOrder), _renderOrder },
|
||||
{nameof(_renderLayer), _renderLayer },
|
||||
{nameof(_tiles), _tiles.FindAll(x => !(x.Tile is LevelTile))
|
||||
.Select(x => new Dictionary<string, object>() {
|
||||
{nameof(x.Position), new float[] { x.Position.x, x.Position.y, x.Position.z } },
|
||||
{nameof(x.Tile), x.Tile.name } }).ToArray() }
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// builds a tilemap from a dictionary representation (from the save file)
|
||||
/// </summary>
|
||||
/// <param name="dict"></param>
|
||||
/// <returns></returns>
|
||||
public static Tilemap FromDictionary(Dictionary<string, object> dict)
|
||||
{
|
||||
//get all tilemap data
|
||||
var key = dict[nameof(_key)].ToString();
|
||||
var invisible = dict[nameof(_isInvisible)].ToBool();
|
||||
var collidable = dict[nameof(_isCollidable)].ToBool();
|
||||
var trigger = dict[nameof(_isTrigger)].ToBool();
|
||||
var renderOrder = dict[nameof(_renderOrder)].ToInt();
|
||||
var renderLayer = dict[nameof(_renderLayer)].ToString();
|
||||
var tiles = dict[nameof(_tiles)];
|
||||
|
||||
//get grid
|
||||
var grid = GameObject.FindObjectOfType<Grid>();
|
||||
if (!grid) grid = new GameObject("Grid").AddComponent<Grid>();
|
||||
|
||||
//get tilemap by name
|
||||
var tilemap = grid.GetComponentInChildren<Tilemap>(key);
|
||||
TilemapRenderer renderer;
|
||||
if (!tilemap)
|
||||
{
|
||||
tilemap = new GameObject(key).AddComponent<Tilemap>();
|
||||
tilemap.gameObject.AddComponent<TilemapRenderer>();
|
||||
tilemap.transform.SetParent(grid.transform);
|
||||
}
|
||||
renderer = tilemap.GetComponent<TilemapRenderer>();
|
||||
|
||||
//populate tilemap according to specs
|
||||
renderer.sortingOrder = renderOrder;
|
||||
renderer.sortingLayerName = renderLayer;
|
||||
|
||||
if (invisible) tilemap.gameObject.layer = INVISIBLE_LAYER;
|
||||
if (collidable)
|
||||
{
|
||||
tilemap.gameObject.AddComponent<TilemapCollider2D>().isTrigger = trigger;
|
||||
}
|
||||
|
||||
//populate tilemaps with non-LevelTile tiles
|
||||
foreach (var tileObj in tiles as IEnumerable)
|
||||
{
|
||||
var tileDict = JsonConvert.DeserializeObject<Dictionary<string, object>>(tileObj.ToString());
|
||||
var tileName = tileDict["Tile"].ToString();
|
||||
var tile = Database.Instance.ScriptableObjects[tileName];
|
||||
|
||||
var tilePos = tileDict["Position"].ToVector3();
|
||||
|
||||
tilemap.SetTile(Vector3Int.RoundToInt(tilePos), tile as TileBase);
|
||||
}
|
||||
|
||||
return tilemap;
|
||||
}
|
||||
|
||||
public IEnumerator<TileData> GetEnumerator()
|
||||
{
|
||||
return _tiles.GetEnumerator();
|
||||
|
||||
@ -1,3 +1,22 @@
|
||||
public interface ILevelObject
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public interface ILevelObject
|
||||
{
|
||||
public enum ObjectType
|
||||
{
|
||||
Tile = 0,
|
||||
Prefab = 1,
|
||||
Tilemap = 2
|
||||
}
|
||||
|
||||
string Name { get; }
|
||||
Vector3 Position { get; }
|
||||
void LevelUpdate();
|
||||
void LevelStart();
|
||||
void LevelDestroy();
|
||||
bool Equals(ILevelObject other);
|
||||
Dictionary<string, object> ToDictionary();
|
||||
void LoadDictionary(Dictionary<string, object> dict);
|
||||
void RemoveFromLevel();
|
||||
}
|
||||
@ -1,58 +1,226 @@
|
||||
using System;
|
||||
using GatherAndDefend.LevelEditor;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using UnityEngine.Tilemaps;
|
||||
using UnityEngine;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using System.IO;
|
||||
|
||||
/// <summary>
|
||||
/// data class for containing everything level related
|
||||
/// </summary>
|
||||
public class LevelManager : Singleton<LevelManager>
|
||||
{
|
||||
public event System.Action<ILevelObject> Added;
|
||||
public event System.Action<ILevelObject> Removed;
|
||||
string SavePath => Application.dataPath + "/save.txt";
|
||||
|
||||
private List<ILevelObject> levelObjects;
|
||||
public delegate void LevelAction(ILevelObject levelObject);
|
||||
public delegate bool LevelPredicate<T>(T levelObject) where T : ILevelObject;
|
||||
|
||||
private readonly List<ILevelObject> _toAdd;
|
||||
private readonly List<ILevelObject> _toRemove;
|
||||
private readonly List<ILevelObject> _levelObjects;
|
||||
|
||||
public Level _currentLevel;
|
||||
|
||||
public Transform LevelTransform
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
public LevelManager()
|
||||
{
|
||||
levelObjects = new List<ILevelObject>();
|
||||
_toAdd = new List<ILevelObject>();
|
||||
_toRemove = new List<ILevelObject>();
|
||||
_levelObjects = new List<ILevelObject>();
|
||||
|
||||
var mgrScript = Object.FindObjectOfType<LevelManagerScript>();
|
||||
if (!mgrScript) mgrScript = new GameObject(nameof(LevelManager)).AddComponent<LevelManagerScript>();
|
||||
LevelTransform = mgrScript.transform;
|
||||
}
|
||||
|
||||
#region [~CRUD~]
|
||||
public void Add(ILevelObject levelObject)
|
||||
{
|
||||
if (levelObjects.Contains(levelObject)) return;
|
||||
levelObjects.Add(levelObject);
|
||||
Added?.Invoke(levelObject);
|
||||
_toAdd.Add(levelObject);
|
||||
}
|
||||
public void Remove(ILevelObject levelObject)
|
||||
{
|
||||
if (!levelObjects.Contains(levelObject)) return;
|
||||
levelObjects.Remove(levelObject);
|
||||
Removed?.Invoke(levelObject);
|
||||
_toRemove.Add(levelObject);
|
||||
}
|
||||
public void Clear()
|
||||
{
|
||||
levelObjects.RemoveAll(obj =>
|
||||
{
|
||||
Removed?.Invoke(obj);
|
||||
return true;
|
||||
});
|
||||
_toAdd.Clear();
|
||||
_toRemove.Clear();
|
||||
_levelObjects.Clear();
|
||||
}
|
||||
public T Get<T>(System.Func<T, bool> predicate = default) where T : ILevelObject
|
||||
public T Get<T>(LevelPredicate<T> predicate = null) where T : ILevelObject
|
||||
{
|
||||
if (predicate == default) predicate = (t) => true;
|
||||
return (T)levelObjects.Find(t => t is T t1 && predicate(t1));
|
||||
if (predicate == null) predicate = (generic) => true;
|
||||
return (T)_levelObjects.Find(levelObject => levelObject is T generic && predicate(generic));
|
||||
}
|
||||
public List<T> GetAll<T>(System.Func<T, bool> predicate = default) where T : ILevelObject
|
||||
public List<T> GetAll<T>(LevelPredicate<T> predicate = null) where T : ILevelObject
|
||||
{
|
||||
if (predicate == default) predicate = (t) => true;
|
||||
List<T> ret = new List<T>();
|
||||
foreach (var t in levelObjects) if (t is T t1 && predicate(t1)) ret.Add(t1);
|
||||
if (predicate == null) predicate = (generic) => true;
|
||||
List<T> ret = new();
|
||||
foreach (var levelObject in _levelObjects) if (levelObject is T generic && predicate(generic)) ret.Add(generic);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public int Count<T>(Func<T, bool> predicate = default) where T : ILevelObject
|
||||
public int Count<T>(LevelPredicate<T> predicate = null) where T : ILevelObject
|
||||
{
|
||||
return GetAll(predicate).Count;
|
||||
}
|
||||
|
||||
public bool Has<T>(System.Func<T, bool> predicate = default)
|
||||
public bool Has<T>(LevelPredicate<T> predicate = null) where T : ILevelObject
|
||||
{
|
||||
if (predicate == default) predicate = (t) => true;
|
||||
return levelObjects.Exists(t => t is T && predicate((T)t));
|
||||
if (predicate == null) predicate = (generic) => true;
|
||||
return _levelObjects.Exists(levelObject => levelObject is T generic && predicate(generic));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region [Level management]
|
||||
public void UpdateLevel()
|
||||
{
|
||||
_levelObjects.ForEach(levelObject => levelObject.LevelUpdate());
|
||||
|
||||
var toAdd = new List<ILevelObject>(_toAdd);
|
||||
toAdd.ForEach(addedObject =>
|
||||
{
|
||||
_toAdd.Remove(addedObject);
|
||||
_levelObjects.Add(addedObject);
|
||||
addedObject.LevelStart();
|
||||
});
|
||||
|
||||
var toRemove = new List<ILevelObject>(_toRemove);
|
||||
toRemove.ForEach(removedObject =>
|
||||
{
|
||||
_toRemove.Remove(removedObject);
|
||||
_levelObjects.Remove(removedObject);
|
||||
removedObject.LevelDestroy();
|
||||
});
|
||||
toRemove.Clear();
|
||||
}
|
||||
|
||||
public void ClearLevel()
|
||||
{
|
||||
foreach (var obj in _levelObjects)
|
||||
{
|
||||
obj.RemoveFromLevel();
|
||||
}
|
||||
Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// permet de loader un scriptable object de niveau
|
||||
/// </summary>
|
||||
/// <param name="level">le niveau à loader</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)
|
||||
{
|
||||
if (shouldClear)
|
||||
{
|
||||
ClearLevel();
|
||||
}
|
||||
|
||||
_currentLevel = level;
|
||||
Grid grid = Object.FindObjectOfType<Grid>();
|
||||
//create new grid if there is none
|
||||
if (!grid)
|
||||
{
|
||||
grid = new GameObject("Grid").AddComponent<Grid>();
|
||||
}
|
||||
//remove all tilemaps if there is a grid
|
||||
else
|
||||
{
|
||||
foreach (Transform child in grid.transform)
|
||||
{
|
||||
Object.Destroy(child.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
//generate all tilemaps
|
||||
foreach (TilemapData tilemapData in _currentLevel)
|
||||
{
|
||||
var tilemap = new GameObject(tilemapData.Key).AddComponent<Tilemap>();
|
||||
tilemap.gameObject.AddComponent<TilemapRenderer>();
|
||||
tilemapData.LoadToTilemap(tilemap);
|
||||
tilemap.transform.SetParent(grid.transform);
|
||||
}
|
||||
Debug.Log("level loaded successfully");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// permet de loader un scriptable object de niveau
|
||||
/// </summary>
|
||||
/// <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>
|
||||
public void LoadLevel(string levelName, bool shouldClear = false)
|
||||
{
|
||||
if (shouldClear)
|
||||
{
|
||||
ClearLevel();
|
||||
}
|
||||
|
||||
//fetch level from database
|
||||
_currentLevel = Database.Instance.ScriptableObjects[levelName] as Level;
|
||||
|
||||
LoadLevel(_currentLevel, shouldClear);
|
||||
}
|
||||
|
||||
|
||||
public void SaveFile()
|
||||
{
|
||||
var list = _levelObjects.Select(obj => obj.ToDictionary()).ToList();
|
||||
|
||||
foreach (var tilemapData in _currentLevel)
|
||||
{
|
||||
var levelConfig = tilemapData.ToDictionary();
|
||||
levelConfig[nameof(ILevelObject.ObjectType)] = nameof(ILevelObject.ObjectType.Tilemap);
|
||||
list.Add(levelConfig);
|
||||
}
|
||||
string saved = JsonConvert.SerializeObject(list);
|
||||
|
||||
File.WriteAllText(SavePath, saved, Encoding.UTF8);
|
||||
Debug.Log("game saved successfully");
|
||||
}
|
||||
|
||||
public void LoadFile()
|
||||
{
|
||||
|
||||
string saved = File.ReadAllText(SavePath, Encoding.UTF8);
|
||||
var dicts = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(saved);
|
||||
|
||||
ClearLevel();
|
||||
|
||||
var tilemapDicts = dicts.FindAll(x => x[nameof(ILevelObject.ObjectType)].ToString() == nameof(ILevelObject.ObjectType.Tilemap));
|
||||
foreach (var tilemapDict in tilemapDicts) CreateTilemap(tilemapDict);
|
||||
|
||||
var prefabDicts = dicts.FindAll(x => x[nameof(ILevelObject.ObjectType)].ToString() == nameof(ILevelObject.ObjectType.Prefab));
|
||||
foreach (var prefabDict in prefabDicts) CreatePrefab(prefabDict);
|
||||
|
||||
var tileDicts = dicts.FindAll(x => x[nameof(ILevelObject.ObjectType)].ToString() == nameof(ILevelObject.ObjectType.Tile));
|
||||
foreach (var tileDict in tileDicts) CreateTile(tileDict);
|
||||
|
||||
Debug.Log("game loaded successfully");
|
||||
}
|
||||
private void CreatePrefab(Dictionary<string, object> dict)
|
||||
{
|
||||
var name = dict["Name"].ToString();
|
||||
var prefab = Database.Instance.Prefabs[name];
|
||||
var instance = prefab.Create(Vector3.zero, parent: LevelTransform);
|
||||
var comp = instance.GetComponent<LevelObject>();
|
||||
comp.LoadDictionary(dict);
|
||||
}
|
||||
private void CreateTile(Dictionary<string, object> dict)
|
||||
{
|
||||
var name = dict["Name"].ToString();
|
||||
|
||||
var tile = Object.Instantiate(Database.Instance.ScriptableObjects[name]) as LevelTile;
|
||||
tile.Instantiated = true;
|
||||
tile.LoadDictionary(dict);
|
||||
tile.AddToLevel();
|
||||
}
|
||||
private void CreateTilemap(Dictionary<string, object> dict)
|
||||
{
|
||||
TilemapData.FromDictionary(dict);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1af43055ac165604e992f071c5520910
|
||||
guid: e3bef4a71d706874fb7500a47d3f4f1d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
||||
31
Assets/Scripts/LevelManager/LevelManagerScript.cs
Normal file
31
Assets/Scripts/LevelManager/LevelManagerScript.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using UnityEngine;
|
||||
using GatherAndDefend.LevelEditor;
|
||||
|
||||
public class LevelManagerScript : MonoBehaviour
|
||||
{
|
||||
public Level firstLevel;
|
||||
private static LevelManagerScript _instance;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
//we don't want to ever have two LevelManagerScript at the same time in the game.
|
||||
//We prevent that by erasing any instances that are not registered as our main instance.
|
||||
if (!_instance)
|
||||
{
|
||||
_instance = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
|
||||
DontDestroyOnLoad(gameObject);
|
||||
if (!firstLevel) throw new System.Exception("there is no first level set in the level manager script");
|
||||
LevelManager.Instance.LoadLevel(firstLevel, true);
|
||||
}
|
||||
void Update()
|
||||
{
|
||||
LevelManager.Instance.UpdateLevel();
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/LevelManager/LevelManagerScript.cs.meta
Normal file
11
Assets/Scripts/LevelManager/LevelManagerScript.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c8f415d45fd9659408ac8c5ce2e96aba
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
60
Assets/Scripts/LevelManager/LevelObject.cs
Normal file
60
Assets/Scripts/LevelManager/LevelObject.cs
Normal file
@ -0,0 +1,60 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using static Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// can be inherited by MonoBehaviours in order to be added to the level manager
|
||||
/// </summary>
|
||||
public abstract class LevelObject : MonoBehaviour, ILevelObject
|
||||
{
|
||||
public Vector3 Position { get => transform.position; protected set => transform.position = value; }
|
||||
public string Name { get => name; protected set => name = value; }
|
||||
|
||||
void Awake()
|
||||
{
|
||||
if (LevelManager.Instance.Has<LevelObject>(obj => obj.Equals(this))) return;
|
||||
LevelManager.Instance.Add(this);
|
||||
}
|
||||
void OnDestroy()
|
||||
{
|
||||
LevelManager.Instance.Remove(this);
|
||||
}
|
||||
public virtual void LevelStart()
|
||||
{
|
||||
}
|
||||
public virtual void LevelDestroy()
|
||||
{
|
||||
}
|
||||
public virtual void LevelUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual bool Equals(ILevelObject other)
|
||||
{
|
||||
return other is LevelObject otherObject
|
||||
&& otherObject.Name == Name
|
||||
&& otherObject.Position == Position;
|
||||
}
|
||||
public virtual Dictionary<string, object> ToDictionary()
|
||||
{
|
||||
return new Dictionary<string, object>()
|
||||
{
|
||||
{nameof(Name), Name },
|
||||
{nameof(Position), new float[]{Position.x, Position.y, Position.z } },
|
||||
{nameof(ILevelObject.ObjectType), nameof(ILevelObject.ObjectType.Prefab) }
|
||||
};
|
||||
}
|
||||
public virtual void LoadDictionary(Dictionary<string, object> dict)
|
||||
{
|
||||
Name = dict[nameof(Name)].ToString();
|
||||
Position = dict[nameof(Position)].ToVector3();
|
||||
}
|
||||
|
||||
public void RemoveFromLevel()
|
||||
{
|
||||
//checks if go is still in scene before removing it
|
||||
if (!this) return;
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/LevelManager/LevelObject.cs.meta
Normal file
11
Assets/Scripts/LevelManager/LevelObject.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b25405eece6b19547806a7eca9f8ce85
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
115
Assets/Scripts/LevelManager/LevelTile.cs
Normal file
115
Assets/Scripts/LevelManager/LevelTile.cs
Normal file
@ -0,0 +1,115 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Tilemaps;
|
||||
|
||||
/// <summary>
|
||||
/// can be inherited by tiles in order to be added to the level manager
|
||||
/// </summary>
|
||||
public abstract class LevelTile : TileBase, ILevelObject
|
||||
{
|
||||
[SerializeField]
|
||||
private Sprite _sprite;
|
||||
|
||||
public bool Instantiated { get; set; }
|
||||
|
||||
public Vector3 Position { get; protected set; }
|
||||
|
||||
private Tilemap _tilemap;
|
||||
public Tilemap Tilemap => _tilemap;
|
||||
public string TilemapName
|
||||
{
|
||||
get => _tilemap.name;
|
||||
}
|
||||
public string Name { get => name; protected set => name = value; }
|
||||
|
||||
public virtual void LevelStart() { }
|
||||
public virtual void LevelDestroy() { }
|
||||
public virtual void LevelUpdate() { }
|
||||
public virtual bool Equals(ILevelObject other)
|
||||
{
|
||||
return other is LevelTile otherTile
|
||||
&& Name == otherTile.Name
|
||||
&& Position == otherTile.Position
|
||||
&& TilemapName == otherTile.TilemapName;
|
||||
}
|
||||
public override bool StartUp(Vector3Int position, ITilemap tilemap, GameObject go)
|
||||
{
|
||||
//only execute if application is in play mode
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
return base.StartUp(position, tilemap, go);
|
||||
}
|
||||
|
||||
//if it was created from the level manager, then it is already instantiated, and we shouldn't do it again
|
||||
if (Instantiated)
|
||||
{
|
||||
return base.StartUp(position, tilemap, go);
|
||||
}
|
||||
|
||||
var comp = tilemap.GetComponent<Tilemap>();
|
||||
|
||||
//need to create an instance of the tile, otherwise the position will change for all tiles instead of only this one.
|
||||
var instance = Instantiate(this);
|
||||
instance.name = name;
|
||||
instance.Position = position;
|
||||
instance._tilemap = comp;
|
||||
|
||||
//if tile already exists, dont add to level manager
|
||||
if (LevelManager.Instance.Has<LevelTile>(tile => tile.Equals(instance)))
|
||||
{
|
||||
return base.StartUp(position, tilemap, go);
|
||||
}
|
||||
|
||||
LevelManager.Instance.Add(instance);
|
||||
return base.StartUp(position, tilemap, go);
|
||||
}
|
||||
public override void GetTileData(Vector3Int position, ITilemap tilemap, ref TileData tileData)
|
||||
{
|
||||
tileData.sprite = _sprite;
|
||||
tileData.transform.SetTRS(Vector3.zero, Quaternion.identity, Vector3.one);
|
||||
tileData.color = Color.white;
|
||||
}
|
||||
public override void RefreshTile(Vector3Int position, ITilemap tilemap)
|
||||
{
|
||||
if (!Application.isPlaying) return;
|
||||
|
||||
//this will check if tile was removed from tilemap
|
||||
if (tilemap.GetTile(position) == null)
|
||||
{
|
||||
LevelManager.Instance.Remove(this);
|
||||
}
|
||||
base.RefreshTile(position, tilemap);
|
||||
}
|
||||
public virtual Dictionary<string, object> ToDictionary()
|
||||
{
|
||||
return new Dictionary<string, object>()
|
||||
{
|
||||
{nameof(Name), Name },
|
||||
{nameof(Position), new float[]{Position.x, Position.y, Position.z } },
|
||||
{nameof(TilemapName), TilemapName },
|
||||
{nameof(ILevelObject.ObjectType), nameof(ILevelObject.ObjectType.Tile) }
|
||||
};
|
||||
}
|
||||
|
||||
public virtual void LoadDictionary(Dictionary<string, object> dict)
|
||||
{
|
||||
Name = dict[nameof(Name)].ToString();
|
||||
Position = dict[nameof(Position)].ToVector3();
|
||||
var tilemapName = dict[nameof(TilemapName)].ToString();
|
||||
|
||||
_tilemap = FindObjectOfType<Grid>().GetComponentInChildren<Tilemap>(tilemapName);
|
||||
}
|
||||
|
||||
public void AddToLevel()
|
||||
{
|
||||
if (!_tilemap) return;
|
||||
_tilemap.SetTile(Vector3Int.RoundToInt(Position), this);
|
||||
}
|
||||
|
||||
public void RemoveFromLevel()
|
||||
{
|
||||
if (!_tilemap) return;
|
||||
_tilemap.SetTile(Vector3Int.RoundToInt(Position), null);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/LevelManager/LevelTile.cs.meta
Normal file
11
Assets/Scripts/LevelManager/LevelTile.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 758530b8a0ef486448757813ce1eef67
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -29,8 +29,8 @@ public class Opponent : Entity
|
||||
|
||||
void AttackEnemy() {
|
||||
//Attack Cooldown
|
||||
if(AttackSpeed < AttackSpeedWait) {
|
||||
|
||||
if(AttackSpeed < AttackSpeedWait)
|
||||
{
|
||||
Enemy.Hp-=AttackDamage;
|
||||
Debug.Log("Ally Hp = " + Enemy.Hp);
|
||||
|
||||
|
||||
@ -1,34 +1,57 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Tilemaps;
|
||||
|
||||
using static Extensions;
|
||||
|
||||
[CreateAssetMenu(menuName = "Gather And Defend/Resource Tile")]
|
||||
public class ResourceTile : TileBase, ILevelObject
|
||||
public class ResourceTile : LevelTile
|
||||
{
|
||||
[SerializeField]
|
||||
[Tooltip("the prefab of the currency that will be spawned when mining this resource")]
|
||||
private GameObject _yieldPrefab;
|
||||
|
||||
private string YieldPrefabName => _yieldPrefab.name;
|
||||
|
||||
[SerializeField]
|
||||
private Sprite _sprite;
|
||||
public Vector3 Position { get; private set; }
|
||||
private float _yieldSpeed = 1; //resource per second
|
||||
private float _yieldCounter = 0;
|
||||
public bool Occupied { get; set; }
|
||||
|
||||
public Sprite Sprite { get => _sprite; set => _sprite = value; }
|
||||
public override bool StartUp(Vector3Int position, ITilemap tilemap, GameObject go)
|
||||
public override void LevelUpdate()
|
||||
{
|
||||
if (!Application.isPlaying) return base.StartUp(position, tilemap, go);
|
||||
if (!Occupied) return;
|
||||
|
||||
//need to create an instance of the tile, otherwise the position will change for all tiles instead of only this one.
|
||||
var instance = Instantiate(this);
|
||||
instance.Position = position;
|
||||
LevelManager.Instance.Add(instance);
|
||||
return base.StartUp(position, tilemap, go);
|
||||
|
||||
_yieldCounter += Time.deltaTime * _yieldSpeed;
|
||||
if (_yieldCounter < 1) return;
|
||||
|
||||
_yieldCounter = 0;
|
||||
var yielded = Instantiate(_yieldPrefab, Position, Quaternion.identity);
|
||||
yielded.transform.SetParent(LevelManager.Instance.LevelTransform);
|
||||
}
|
||||
public override void GetTileData(Vector3Int position, ITilemap tilemap, ref TileData tileData)
|
||||
public override bool Equals(ILevelObject other)
|
||||
{
|
||||
tileData.sprite = _sprite;
|
||||
tileData.transform.SetTRS(Vector3.zero, Quaternion.identity, Vector3.one);
|
||||
tileData.color = Color.white;
|
||||
return other is ResourceTile otherRes
|
||||
&& base.Equals(otherRes)
|
||||
&& _yieldPrefab == otherRes._yieldPrefab
|
||||
&& _yieldSpeed == otherRes._yieldSpeed
|
||||
&& Occupied == otherRes.Occupied;
|
||||
}
|
||||
public override Dictionary<string, object> ToDictionary()
|
||||
{
|
||||
var dict = base.ToDictionary();
|
||||
|
||||
dict[nameof(YieldPrefabName)] = YieldPrefabName;
|
||||
dict[nameof(_yieldSpeed)] = _yieldSpeed;
|
||||
dict[nameof(Occupied)] = Occupied;
|
||||
return dict;
|
||||
}
|
||||
public override void LoadDictionary(Dictionary<string, object> dict)
|
||||
{
|
||||
base.LoadDictionary(dict);
|
||||
var prefabName = dict[nameof(YieldPrefabName)].ToString();
|
||||
_yieldPrefab = Database.Instance.Prefabs[prefabName];
|
||||
_yieldSpeed = dict[nameof(_yieldSpeed)].ToFloat();
|
||||
_yieldCounter = dict[nameof(_yieldCounter)].ToFloat();
|
||||
Occupied = dict[nameof(Occupied)].ToBool();
|
||||
}
|
||||
}
|
||||
64
Assets/Scripts/Tiles/SpawnerTile.cs
Normal file
64
Assets/Scripts/Tiles/SpawnerTile.cs
Normal file
@ -0,0 +1,64 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(menuName = "Gather And Defend/Spawner Tile")]
|
||||
public class SpawnerTile : LevelTile
|
||||
{
|
||||
[SerializeField]
|
||||
private GameObject _prefab;
|
||||
[SerializeField]
|
||||
private bool _spawnOnStart;
|
||||
private float _lifetime;
|
||||
[SerializeField]
|
||||
private float _spawnSpeed = 0;
|
||||
[SerializeField, Range(0, 1.001f)]
|
||||
private float _spawnCounter = 0;
|
||||
|
||||
|
||||
public override void LevelStart()
|
||||
{
|
||||
if (_spawnOnStart && _lifetime <= 0)
|
||||
{
|
||||
_prefab.Create(Position, parent: LevelManager.Instance.LevelTransform);
|
||||
}
|
||||
}
|
||||
|
||||
public override void LevelUpdate()
|
||||
{
|
||||
_lifetime += Time.deltaTime;
|
||||
_spawnCounter += Time.deltaTime * _spawnSpeed;
|
||||
if (_spawnCounter < 1) return;
|
||||
|
||||
_spawnCounter = 0;
|
||||
_prefab.Create(Position, parent: LevelManager.Instance.LevelTransform);
|
||||
}
|
||||
public override bool Equals(ILevelObject other)
|
||||
{
|
||||
return other is SpawnerTile spawner
|
||||
&& base.Equals(spawner)
|
||||
&& spawner._prefab == _prefab
|
||||
&& spawner._spawnSpeed == _spawnSpeed;
|
||||
}
|
||||
public override Dictionary<string, object> ToDictionary()
|
||||
{
|
||||
var dict = base.ToDictionary();
|
||||
|
||||
dict[nameof(_prefab)] = _prefab.name;
|
||||
dict[nameof(_spawnSpeed)] = _spawnSpeed;
|
||||
dict[nameof(_spawnCounter)] = _spawnCounter;
|
||||
dict[nameof(_lifetime)] = _lifetime;
|
||||
dict[nameof(_spawnOnStart)] = _spawnOnStart;
|
||||
return dict;
|
||||
}
|
||||
public override void LoadDictionary(Dictionary<string, object> dict)
|
||||
{
|
||||
base.LoadDictionary(dict);
|
||||
|
||||
var prefabName = dict[nameof(_prefab)].ToString();
|
||||
_prefab = Database.Instance.Prefabs[prefabName];
|
||||
_spawnSpeed = dict[nameof(_spawnSpeed)].ToFloat();
|
||||
_spawnCounter = dict[nameof(_spawnCounter)].ToFloat();
|
||||
_lifetime = dict[nameof(_lifetime)].ToFloat();
|
||||
_spawnOnStart = dict[nameof(_spawnOnStart)].ToBool();
|
||||
}
|
||||
}
|
||||
@ -16,6 +16,7 @@ public class TestLevelManager
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
new GameObject("LevelManager").AddComponent<LevelManagerScript>();
|
||||
_farm = ScriptableObject.CreateInstance<ResourceTile>();
|
||||
_farm.name = nameof(_farm);
|
||||
|
||||
|
||||
@ -117,6 +117,16 @@ Tilemap:
|
||||
m_TileObjectToInstantiateIndex: 65535
|
||||
dummyAlignment: 0
|
||||
m_AllTileFlags: 0
|
||||
- first: {x: 0, 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
|
||||
m_AnimatedTiles: {}
|
||||
m_TileAssetArray:
|
||||
- m_RefCount: 1
|
||||
@ -125,6 +135,8 @@ Tilemap:
|
||||
m_Data: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
- m_RefCount: 1
|
||||
m_Data: {fileID: 11400000, guid: 4aaf448680c7f8a438a9a5861c622a55, type: 2}
|
||||
- m_RefCount: 1
|
||||
m_Data: {fileID: 11400000, guid: 4002377ed7e87b34699f126f2b10c703, type: 2}
|
||||
m_TileSpriteArray:
|
||||
- m_RefCount: 1
|
||||
m_Data: {fileID: 21300000, guid: ccca3e050cb082b45af0a099790463f6, type: 3}
|
||||
@ -132,8 +144,10 @@ Tilemap:
|
||||
m_Data: {fileID: 21300000, guid: 1f8a7d27b012449499d5316045662e1e, type: 3}
|
||||
- m_RefCount: 1
|
||||
m_Data: {fileID: 21300000, guid: 77a39e873655d3c4b93d0b7696397b83, type: 3}
|
||||
- m_RefCount: 1
|
||||
m_Data: {fileID: 21300000, guid: b85a4b2ec6433d04895612d791edc260, type: 3}
|
||||
m_TileMatrixArray:
|
||||
- m_RefCount: 3
|
||||
- m_RefCount: 4
|
||||
m_Data:
|
||||
e00: 1
|
||||
e01: 0
|
||||
@ -152,7 +166,7 @@ Tilemap:
|
||||
e32: 0
|
||||
e33: 1
|
||||
m_TileColorArray:
|
||||
- m_RefCount: 3
|
||||
- m_RefCount: 4
|
||||
m_Data: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_TileObjectToInstantiateArray: []
|
||||
m_AnimationFrameRate: 1
|
||||
@ -227,7 +241,7 @@ TilemapRenderer:
|
||||
m_Mode: 0
|
||||
m_DetectChunkCullingBounds: 0
|
||||
m_MaskInteraction: 0
|
||||
--- !u!114 &5479319524895914250
|
||||
--- !u!114 &2473294596980876743
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
|
||||
19
Assets/Tiles/EnemySpawner.asset
Normal file
19
Assets/Tiles/EnemySpawner.asset
Normal file
@ -0,0 +1,19 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: b28b3004abb3723498a355747c7cd899, type: 3}
|
||||
m_Name: EnemySpawner
|
||||
m_EditorClassIdentifier:
|
||||
_sprite: {fileID: 21300000, guid: b85a4b2ec6433d04895612d791edc260, type: 3}
|
||||
_prefab: {fileID: 6962989255644195630, guid: 377c7275c0001cc47a6b8926ac57d573, type: 3}
|
||||
_spawnOnStart: 1
|
||||
_spawnSpeed: 0
|
||||
_spawnCounter: 0
|
||||
8
Assets/Tiles/EnemySpawner.asset.meta
Normal file
8
Assets/Tiles/EnemySpawner.asset.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4002377ed7e87b34699f126f2b10c703
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -13,5 +13,7 @@ MonoBehaviour:
|
||||
m_Name: StickSpawner
|
||||
m_EditorClassIdentifier:
|
||||
_sprite: {fileID: 21300000, guid: 77a39e873655d3c4b93d0b7696397b83, type: 3}
|
||||
_prefab: {fileID: 6962989255644195630, guid: 9b40c232eddfd1b469bea688e3c970c0, type: 3}
|
||||
_repeat: 0
|
||||
_prefab: {fileID: 6962989255644195630, guid: 6cd87b398e7a0e94580f4fcbe2fd310a, type: 3}
|
||||
_spawnOnStart: 1
|
||||
_spawnSpeed: 0
|
||||
_spawnCounter: 0
|
||||
|
||||
1
Assets/save.txt
Normal file
1
Assets/save.txt
Normal file
File diff suppressed because one or more lines are too long
7
Assets/save.txt.meta
Normal file
7
Assets/save.txt.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e12fc9910d378cd4b913db867d6c3018
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
17
ProjectSettings/BurstAotSettings_StandaloneWindows.json
Normal file
17
ProjectSettings/BurstAotSettings_StandaloneWindows.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"MonoBehaviour": {
|
||||
"Version": 4,
|
||||
"EnableBurstCompilation": true,
|
||||
"EnableOptimisations": true,
|
||||
"EnableSafetyChecks": false,
|
||||
"EnableDebugInAllBuilds": false,
|
||||
"EnableArmv9SecurityFeatures": false,
|
||||
"CpuMinTargetX32": 0,
|
||||
"CpuMaxTargetX32": 0,
|
||||
"CpuMinTargetX64": 0,
|
||||
"CpuMaxTargetX64": 0,
|
||||
"CpuTargetsX32": 6,
|
||||
"CpuTargetsX64": 72,
|
||||
"OptimizeFor": 0
|
||||
}
|
||||
}
|
||||
6
ProjectSettings/CommonBurstAotSettings.json
Normal file
6
ProjectSettings/CommonBurstAotSettings.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"MonoBehaviour": {
|
||||
"Version": 4,
|
||||
"DisabledWarnings": ""
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user