Pull request #30: Feature/implementGameSceneConflictSolved
Merge in CGD/gather-and-defend from feature/implementGameSceneConflictSolved to main * commit '588d491b6a1bbf74cad7136d882e3f252f4abf9c': cards should be aligned top left oubli des universioned files work on game scene + fix bugs ajout placeholder pour fast forward animator de l'archer etait brisé + oublis mettre tout le stock dans la scene Game
This commit is contained in:
commit
1554bd2315
BIN
Assets/Art/Sprites/icon_card_archer.png
Normal file
BIN
Assets/Art/Sprites/icon_card_archer.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.4 KiB |
147
Assets/Art/Sprites/icon_card_archer.png.meta
Normal file
147
Assets/Art/Sprites/icon_card_archer.png.meta
Normal file
@ -0,0 +1,147 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 178d3231a9182834aa1a4394bd40b644
|
||||
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:
|
||||
53
Assets/KeepLevelAnchored.cs
Normal file
53
Assets/KeepLevelAnchored.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class KeepLevelAnchored : MonoBehaviour
|
||||
{
|
||||
Camera _camera;
|
||||
Rect _levelBound;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
LevelManager.Instance.LevelLoaded += CalculateBound;
|
||||
CalculateBound(LevelManager.Instance.CurrentLevel);
|
||||
_camera = Camera.main;
|
||||
}
|
||||
|
||||
private void CalculateBound(GatherAndDefend.LevelEditor.Level level)
|
||||
{
|
||||
_levelBound = level.CalculateBounds();
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
LevelManager.Instance.LevelLoaded -= CalculateBound;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
//move right
|
||||
var xMax = _levelBound.xMax;
|
||||
var width = _camera.ScreenToWorldPoint(Vector2.one * _camera.pixelWidth).x;
|
||||
var rightDiff = width - xMax;
|
||||
var camPos = _camera.transform.position;
|
||||
|
||||
camPos.x -= rightDiff;
|
||||
|
||||
_camera.transform.position = camPos;
|
||||
|
||||
|
||||
//resize
|
||||
var xMin = _levelBound.xMin;
|
||||
var left = _camera.ScreenToWorldPoint(Vector2.zero).x;
|
||||
var center = _camera.ScreenToWorldPoint(Vector2.one * _camera.pixelWidth / 3).x;
|
||||
|
||||
var leftDiff = xMax - xMin;
|
||||
var centerDiff = xMax - center;
|
||||
|
||||
var ratio = centerDiff / leftDiff;
|
||||
|
||||
_camera.orthographicSize /= ratio;
|
||||
}
|
||||
}
|
||||
11
Assets/KeepLevelAnchored.cs.meta
Normal file
11
Assets/KeepLevelAnchored.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64f379c3b297ed249be5c01c7947a5fe
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
222
Assets/LevelEditor/Levels/TestGame.asset
Normal file
222
Assets/LevelEditor/Levels/TestGame.asset
Normal file
@ -0,0 +1,222 @@
|
||||
%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: 2b25d284985e65e48b50826c522a5ec3, type: 3}
|
||||
m_Name: TestGame
|
||||
m_EditorClassIdentifier:
|
||||
_data:
|
||||
- _key: Background
|
||||
_tiles:
|
||||
- _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: -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: -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: -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: -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: -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: -4, y: -3, 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: -4, y: -1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_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: -3, y: -3, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -3, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -3, y: -1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -3, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -3, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -3, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -2, y: -3, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -2, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -2, y: -1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -2, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -2, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -2, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -1, y: -3, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -1, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -1, y: -1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -1, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -1, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
|
||||
_position: {x: -1, y: 2, z: 0}
|
||||
_isInvisible: 0
|
||||
_isCollidable: 0
|
||||
_isTrigger: 0
|
||||
_renderOrder: 0
|
||||
_renderLayer: Default
|
||||
_position: {x: 0, y: 0}
|
||||
_scale: {x: 1, y: 1}
|
||||
- _key: Entities
|
||||
_tiles:
|
||||
- _tile: {fileID: 11400000, guid: e0d57b3c128ba1447920637cdb289530, type: 2}
|
||||
_position: {x: -10, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e0d57b3c128ba1447920637cdb289530, type: 2}
|
||||
_position: {x: -10, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e0d57b3c128ba1447920637cdb289530, type: 2}
|
||||
_position: {x: -10, y: 2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e0b1d2d816ae5624c99b09a2bebb2a39, type: 2}
|
||||
_position: {x: -8, y: -3, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
||||
_position: {x: -7, y: -1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
||||
_position: {x: -7, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
||||
_position: {x: -7, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e0b1d2d816ae5624c99b09a2bebb2a39, type: 2}
|
||||
_position: {x: -6, y: -3, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
||||
_position: {x: -6, y: -1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
||||
_position: {x: -6, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
||||
_position: {x: -6, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
||||
_position: {x: -5, y: -1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
||||
_position: {x: -5, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
||||
_position: {x: -5, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e0b1d2d816ae5624c99b09a2bebb2a39, type: 2}
|
||||
_position: {x: -4, y: -3, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
||||
_position: {x: -4, y: -1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
||||
_position: {x: -4, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
||||
_position: {x: -4, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
||||
_position: {x: -3, y: -1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
||||
_position: {x: -3, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
||||
_position: {x: -3, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e0b1d2d816ae5624c99b09a2bebb2a39, type: 2}
|
||||
_position: {x: -2, y: -3, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
||||
_position: {x: -2, y: -1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
||||
_position: {x: -2, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
||||
_position: {x: -2, y: 1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
||||
_position: {x: -1, y: -1, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
||||
_position: {x: -1, y: 0, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
||||
_position: {x: -1, y: 1, z: 0}
|
||||
_isInvisible: 0
|
||||
_isCollidable: 0
|
||||
_isTrigger: 0
|
||||
_renderOrder: 1
|
||||
_renderLayer: Default
|
||||
_position: {x: 0, y: 0}
|
||||
_scale: {x: 1, y: 1}
|
||||
- _key: Spawners
|
||||
_tiles:
|
||||
- _tile: {fileID: 11400000, guid: 4002377ed7e87b34699f126f2b10c703, type: 2}
|
||||
_position: {x: -1, y: -2, z: 0}
|
||||
- _tile: {fileID: 11400000, guid: 4002377ed7e87b34699f126f2b10c703, type: 2}
|
||||
_position: {x: -1, y: 2, z: 0}
|
||||
_isInvisible: 1
|
||||
_isCollidable: 0
|
||||
_isTrigger: 0
|
||||
_renderOrder: 2
|
||||
_renderLayer: Default
|
||||
_position: {x: 0, y: 0}
|
||||
_scale: {x: 1, y: 1}
|
||||
8
Assets/LevelEditor/Levels/TestGame.asset.meta
Normal file
8
Assets/LevelEditor/Levels/TestGame.asset.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f5a11cb6d0d324b47b493042c7615112
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -36,7 +36,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 15, y: 15}
|
||||
m_SizeDelta: {x: 12, y: 12}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &6291074865804911655
|
||||
CanvasRenderer:
|
||||
@ -118,7 +118,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 100, y: 50}
|
||||
m_SizeDelta: {x: 80, y: 40}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &907652127959947831
|
||||
CanvasRenderer:
|
||||
@ -298,7 +298,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 50, y: 50}
|
||||
m_SizeDelta: {x: 45, y: 45}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &907652128235033335
|
||||
CanvasRenderer:
|
||||
@ -387,7 +387,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 30, y: 15}
|
||||
m_SizeDelta: {x: 24, y: 12}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &907652129260736054
|
||||
CanvasRenderer:
|
||||
@ -444,7 +444,7 @@ MonoBehaviour:
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 13.4
|
||||
m_fontSize: 10.7
|
||||
m_fontSizeBase: 36
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 1
|
||||
@ -535,7 +535,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 22.5, y: 0}
|
||||
m_AnchoredPosition: {x: 23, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &4100105604388853805
|
||||
@ -615,7 +615,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 22.5, y: 0}
|
||||
m_AnchoredPosition: {x: 23, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &4741796700644535934
|
||||
@ -695,7 +695,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 30, y: 15}
|
||||
m_SizeDelta: {x: 24, y: 12}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &8779984673163102974
|
||||
CanvasRenderer:
|
||||
@ -752,7 +752,7 @@ MonoBehaviour:
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 13.4
|
||||
m_fontSize: 10.7
|
||||
m_fontSizeBase: 36
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 1
|
||||
@ -842,7 +842,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 15, y: 15}
|
||||
m_SizeDelta: {x: 12, y: 12}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &6975577339164885956
|
||||
CanvasRenderer:
|
||||
@ -918,7 +918,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 15, y: 15}
|
||||
m_SizeDelta: {x: 12, y: 12}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &651097448331064931
|
||||
CanvasRenderer:
|
||||
@ -996,7 +996,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 50, y: 50}
|
||||
m_SizeDelta: {x: 45, y: 45}
|
||||
m_Pivot: {x: 1, y: 1}
|
||||
--- !u!114 &6181393584221671793
|
||||
MonoBehaviour:
|
||||
@ -1011,14 +1011,14 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding:
|
||||
m_Left: 0
|
||||
m_Right: 0
|
||||
m_Top: 0
|
||||
m_Bottom: 0
|
||||
m_Left: 5
|
||||
m_Right: 5
|
||||
m_Top: 5
|
||||
m_Bottom: 5
|
||||
m_ChildAlignment: 0
|
||||
m_Spacing: 0
|
||||
m_ChildForceExpandWidth: 1
|
||||
m_ChildForceExpandHeight: 1
|
||||
m_ChildForceExpandWidth: 0
|
||||
m_ChildForceExpandHeight: 0
|
||||
m_ChildControlWidth: 0
|
||||
m_ChildControlHeight: 0
|
||||
m_ChildScaleWidth: 0
|
||||
@ -1061,7 +1061,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 30, y: 15}
|
||||
m_SizeDelta: {x: 24, y: 12}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7720087843626117068
|
||||
CanvasRenderer:
|
||||
@ -1118,7 +1118,7 @@ MonoBehaviour:
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 13.4
|
||||
m_fontSize: 10.7
|
||||
m_fontSizeBase: 36
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 1
|
||||
@ -1209,7 +1209,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 22.5, y: 0}
|
||||
m_AnchoredPosition: {x: 23, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &5791630491435835906
|
||||
|
||||
@ -36,7 +36,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 15, y: 15}
|
||||
m_SizeDelta: {x: 15, y: 12}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &6291074865804911655
|
||||
CanvasRenderer:
|
||||
@ -118,7 +118,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 100, y: 50}
|
||||
m_SizeDelta: {x: 80, y: 40}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &907652127959947831
|
||||
CanvasRenderer:
|
||||
@ -298,7 +298,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 50, y: 50}
|
||||
m_SizeDelta: {x: 40, y: 40}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &907652128235033335
|
||||
CanvasRenderer:
|
||||
@ -387,7 +387,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 30, y: 15}
|
||||
m_SizeDelta: {x: 24, y: 12}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &907652129260736054
|
||||
CanvasRenderer:
|
||||
@ -444,7 +444,7 @@ MonoBehaviour:
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 13.4
|
||||
m_fontSize: 10.7
|
||||
m_fontSizeBase: 36
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 1
|
||||
@ -535,7 +535,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 22.5, y: 0}
|
||||
m_AnchoredPosition: {x: 19.5, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &4100105604388853805
|
||||
@ -615,7 +615,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 22.5, y: 0}
|
||||
m_AnchoredPosition: {x: 19.5, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &4741796700644535934
|
||||
@ -695,7 +695,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 30, y: 15}
|
||||
m_SizeDelta: {x: 24, y: 12}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &8779984673163102974
|
||||
CanvasRenderer:
|
||||
@ -752,7 +752,7 @@ MonoBehaviour:
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 13.4
|
||||
m_fontSize: 10.7
|
||||
m_fontSizeBase: 36
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 1
|
||||
@ -842,7 +842,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 15, y: 15}
|
||||
m_SizeDelta: {x: 15, y: 12}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &6975577339164885956
|
||||
CanvasRenderer:
|
||||
@ -918,7 +918,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 15, y: 15}
|
||||
m_SizeDelta: {x: 15, y: 12}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &651097448331064931
|
||||
CanvasRenderer:
|
||||
@ -996,7 +996,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 50, y: 50}
|
||||
m_SizeDelta: {x: 40, y: 40}
|
||||
m_Pivot: {x: 1, y: 1}
|
||||
--- !u!114 &6181393584221671793
|
||||
MonoBehaviour:
|
||||
@ -1061,7 +1061,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 30, y: 15}
|
||||
m_SizeDelta: {x: 24, y: 12}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &7720087843626117068
|
||||
CanvasRenderer:
|
||||
@ -1118,7 +1118,7 @@ MonoBehaviour:
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 13.4
|
||||
m_fontSize: 10.7
|
||||
m_fontSizeBase: 36
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 1
|
||||
@ -1209,7 +1209,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 22.5, y: 0}
|
||||
m_AnchoredPosition: {x: 19.5, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &5791630491435835906
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
1160
Assets/Prefabs/farmerStick.prefab
Normal file
1160
Assets/Prefabs/farmerStick.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Prefabs/farmerStick.prefab.meta
Normal file
7
Assets/Prefabs/farmerStick.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85534a2d6c2add54d864073914646192
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@ -59,9 +59,9 @@ public abstract class DraggablePlaceholder : MonoBehaviour
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
_canBePlacedHere = CanBePlacedHere();
|
||||
UpdatePosition();
|
||||
|
||||
_canBePlacedHere = CanBePlacedHere();
|
||||
ShowValidity();
|
||||
}
|
||||
|
||||
@ -75,12 +75,10 @@ public abstract class DraggablePlaceholder : MonoBehaviour
|
||||
|
||||
if (!_lvlBoundsCache.Contains(mousePos))
|
||||
{
|
||||
_canBePlacedHere = false;
|
||||
_allRenderers.ForEach(x => x.enabled = false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_canBePlacedHere = true;
|
||||
_allRenderers.ForEach(x => x.enabled = true);
|
||||
}
|
||||
transform.position = mousePos;
|
||||
@ -95,6 +93,7 @@ public abstract class DraggablePlaceholder : MonoBehaviour
|
||||
public virtual bool CanBePlacedHere()
|
||||
{
|
||||
return !LevelManager.Instance.Has<ILevelObject>(obj => obj.Position.IsContainedIn(transform.position))
|
||||
&& _lvlBoundsCache.Contains(transform.position)
|
||||
&& ResourceManager.Instance.EnoughFor(Rock, Wood, Food);
|
||||
}
|
||||
|
||||
|
||||
55
Assets/Scripts/KeepLevelAnchored.cs
Normal file
55
Assets/Scripts/KeepLevelAnchored.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class KeepLevelAnchored : MonoBehaviour
|
||||
{
|
||||
Camera _camera;
|
||||
Rect _levelBound;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
LevelManager.Instance.LevelLoaded += CalculateBound;
|
||||
CalculateBound(LevelManager.Instance.CurrentLevel);
|
||||
_camera = Camera.main;
|
||||
}
|
||||
|
||||
private void CalculateBound(GatherAndDefend.LevelEditor.Level level)
|
||||
{
|
||||
_levelBound = level.CalculateBounds();
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
LevelManager.Instance.LevelLoaded -= CalculateBound;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
//move right
|
||||
var xMax = _levelBound.xMax;
|
||||
var width = _camera.ScreenToWorldPoint(Vector2.one * _camera.pixelWidth).x;
|
||||
var rightDiff = width - xMax;
|
||||
var camPos = _camera.transform.position;
|
||||
|
||||
camPos.x -= rightDiff;
|
||||
|
||||
_camera.transform.position = camPos;
|
||||
|
||||
|
||||
//resize
|
||||
var xMin = _levelBound.xMin;
|
||||
var left = _camera.ScreenToWorldPoint(Vector2.zero).x;
|
||||
var center = _camera.ScreenToWorldPoint(Vector2.one * _camera.pixelWidth / 3).x;
|
||||
|
||||
var leftDiff = xMax - xMin;
|
||||
var centerDiff = xMax - center;
|
||||
|
||||
var ratio = centerDiff / leftDiff;
|
||||
|
||||
_camera.orthographicSize /= ratio;
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/KeepLevelAnchored.cs.meta
Normal file
11
Assets/Scripts/KeepLevelAnchored.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1e75c8792eeaf44a8afc3d3fa678c74
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -7,7 +7,8 @@ public interface ILevelObject
|
||||
{
|
||||
Tile = 0,
|
||||
Prefab = 1,
|
||||
Tilemap = 2
|
||||
Tilemap = 2,
|
||||
Other = 3,
|
||||
}
|
||||
|
||||
bool IsCollidable { get; }
|
||||
|
||||
@ -14,6 +14,9 @@ public class LevelManager : Singleton<LevelManager>
|
||||
{
|
||||
string SavePath => Application.dataPath + "/save.txt";
|
||||
|
||||
public event OnLevelLoaded LevelLoaded;
|
||||
|
||||
public delegate void OnLevelLoaded(Level level);
|
||||
public delegate void LevelAction(ILevelObject levelObject);
|
||||
public delegate bool LevelPredicate<T>(T levelObject) where T : ILevelObject;
|
||||
|
||||
@ -161,6 +164,8 @@ public class LevelManager : Singleton<LevelManager>
|
||||
tilemapData.LoadToTilemap(tilemap);
|
||||
tilemap.transform.SetParent(grid.transform);
|
||||
}
|
||||
|
||||
LevelLoaded?.Invoke(level);
|
||||
Debug.Log("level loaded successfully");
|
||||
}
|
||||
|
||||
@ -182,7 +187,6 @@ public class LevelManager : Singleton<LevelManager>
|
||||
LoadLevel(_currentLevel, shouldClear);
|
||||
}
|
||||
|
||||
|
||||
public void SaveFile()
|
||||
{
|
||||
var list = _levelObjects.Select(obj => obj.ToDictionary()).ToList();
|
||||
@ -193,15 +197,16 @@ public class LevelManager : Singleton<LevelManager>
|
||||
levelConfig[nameof(ILevelObject.ObjectType)] = nameof(ILevelObject.ObjectType.Tilemap);
|
||||
list.Add(levelConfig);
|
||||
}
|
||||
|
||||
list.Add(OtherValuesToDict());
|
||||
|
||||
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);
|
||||
|
||||
@ -216,8 +221,14 @@ public class LevelManager : Singleton<LevelManager>
|
||||
var tileDicts = dicts.FindAll(x => x[nameof(ILevelObject.ObjectType)].ToString() == nameof(ILevelObject.ObjectType.Tile));
|
||||
foreach (var tileDict in tileDicts) CreateTile(tileDict);
|
||||
|
||||
var otherDict = dicts.Find(x => x[nameof(ILevelObject.ObjectType)].ToString() == nameof(ILevelObject.ObjectType.Other));
|
||||
DictToOtherValues(otherDict);
|
||||
|
||||
|
||||
LevelLoaded?.Invoke(_currentLevel);
|
||||
Debug.Log("game loaded successfully");
|
||||
}
|
||||
|
||||
private void CreatePrefab(Dictionary<string, object> dict)
|
||||
{
|
||||
var name = dict["Name"].ToString();
|
||||
@ -239,5 +250,27 @@ public class LevelManager : Singleton<LevelManager>
|
||||
{
|
||||
TilemapData.FromDictionary(dict);
|
||||
}
|
||||
private Dictionary<string, object> OtherValuesToDict()
|
||||
{
|
||||
return new Dictionary<string, object>()
|
||||
{
|
||||
[nameof(ILevelObject.ObjectType)] = nameof(ILevelObject.ObjectType.Other),
|
||||
[nameof(_currentLevel)] = _currentLevel.name
|
||||
};
|
||||
}
|
||||
private void DictToOtherValues(Dictionary<string, object> dict)
|
||||
{
|
||||
// fetch current level
|
||||
var levelName = dict[nameof(_currentLevel)].ToString();
|
||||
var level = Database.Instance.ScriptableObjects[levelName] as Level;
|
||||
_currentLevel = level;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// align camera to the rightmost tile of the tilemap
|
||||
/// </summary>
|
||||
|
||||
#endregion
|
||||
}
|
||||
@ -1,25 +1,12 @@
|
||||
using UnityEngine;
|
||||
using GatherAndDefend.LevelEditor;
|
||||
|
||||
public class LevelManagerScript : MonoBehaviour
|
||||
public class LevelManagerScript : SingletonBehaviour<LevelManagerScript>
|
||||
{
|
||||
public Level firstLevel;
|
||||
private static LevelManagerScript _instance;
|
||||
|
||||
void Awake()
|
||||
protected override 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);
|
||||
|
||||
@ -8,6 +8,7 @@ using UnityEngine.Tilemaps;
|
||||
/// </summary>
|
||||
public abstract class LevelTile : TileBase, ILevelObject
|
||||
{
|
||||
public const string project_name = "Gather And Defend";
|
||||
[SerializeField]
|
||||
private Sprite _sprite;
|
||||
public Sprite Sprite => _sprite;
|
||||
@ -76,6 +77,7 @@ public abstract class LevelTile : TileBase, ILevelObject
|
||||
}
|
||||
public override void RefreshTile(Vector3Int position, ITilemap tilemap)
|
||||
{
|
||||
base.RefreshTile(position, tilemap);
|
||||
if (!Application.isPlaying) return;
|
||||
|
||||
//this will check if tile was removed from tilemap
|
||||
@ -83,7 +85,6 @@ public abstract class LevelTile : TileBase, ILevelObject
|
||||
{
|
||||
LevelManager.Instance.Remove(this);
|
||||
}
|
||||
base.RefreshTile(position, tilemap);
|
||||
}
|
||||
public virtual Dictionary<string, object> ToDictionary()
|
||||
{
|
||||
|
||||
6
Assets/Scripts/Tiles/ObstacleTile.cs
Normal file
6
Assets/Scripts/Tiles/ObstacleTile.cs
Normal file
@ -0,0 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(menuName = project_name + "/" + nameof(ObstacleTile))]
|
||||
public class ObstacleTile : LevelTile
|
||||
{
|
||||
}
|
||||
11
Assets/Scripts/Tiles/ObstacleTile.cs.meta
Normal file
11
Assets/Scripts/Tiles/ObstacleTile.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9ff04aa2e904a19458fd5b144c230054
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -2,7 +2,7 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using static Extensions;
|
||||
|
||||
[CreateAssetMenu(menuName = "Gather And Defend/Resource Tile")]
|
||||
[CreateAssetMenu(menuName = project_name + "/" + nameof(ResourceTile))]
|
||||
public class ResourceTile : LevelTile
|
||||
{
|
||||
[SerializeField]
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(menuName = "Gather And Defend/Spawner Tile")]
|
||||
[CreateAssetMenu(menuName = project_name + "/" + nameof(SpawnerTile))]
|
||||
public class SpawnerTile : LevelTile
|
||||
{
|
||||
[SerializeField]
|
||||
|
||||
@ -87,21 +87,51 @@ Tilemap:
|
||||
m_GameObject: {fileID: 5890485537825364348}
|
||||
m_Enabled: 1
|
||||
m_Tiles:
|
||||
- first: {x: -1, y: 0, z: 0}
|
||||
- first: {x: -1, y: -1, z: 0}
|
||||
second:
|
||||
serializedVersion: 2
|
||||
m_TileIndex: 0
|
||||
m_TileIndex: 4
|
||||
m_TileSpriteIndex: 0
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_TileObjectToInstantiateIndex: 65535
|
||||
dummyAlignment: 0
|
||||
m_AllTileFlags: 1073741825
|
||||
m_AllTileFlags: 0
|
||||
- first: {x: 0, y: -1, z: 0}
|
||||
second:
|
||||
serializedVersion: 2
|
||||
m_TileIndex: 5
|
||||
m_TileSpriteIndex: 1
|
||||
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: 6
|
||||
m_TileSpriteIndex: 2
|
||||
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: 6
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_TileObjectToInstantiateIndex: 65535
|
||||
dummyAlignment: 0
|
||||
m_AllTileFlags: 0
|
||||
- first: {x: 0, y: 0, z: 0}
|
||||
second:
|
||||
serializedVersion: 2
|
||||
m_TileIndex: 1
|
||||
m_TileSpriteIndex: 1
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_TileObjectToInstantiateIndex: 65535
|
||||
@ -111,7 +141,7 @@ Tilemap:
|
||||
second:
|
||||
serializedVersion: 2
|
||||
m_TileIndex: 2
|
||||
m_TileSpriteIndex: 2
|
||||
m_TileSpriteIndex: 4
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_TileObjectToInstantiateIndex: 65535
|
||||
@ -121,7 +151,7 @@ Tilemap:
|
||||
second:
|
||||
serializedVersion: 2
|
||||
m_TileIndex: 3
|
||||
m_TileSpriteIndex: 3
|
||||
m_TileSpriteIndex: 5
|
||||
m_TileMatrixIndex: 0
|
||||
m_TileColorIndex: 0
|
||||
m_TileObjectToInstantiateIndex: 65535
|
||||
@ -130,14 +160,24 @@ Tilemap:
|
||||
m_AnimatedTiles: {}
|
||||
m_TileAssetArray:
|
||||
- m_RefCount: 1
|
||||
m_Data: {fileID: 11400000, guid: a387250a316b97e43be83b85980101e1, type: 2}
|
||||
m_Data: {fileID: 11400000, guid: e74655ccbd41a2b46b1ec9615aba0301, type: 2}
|
||||
- m_RefCount: 1
|
||||
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_RefCount: 1
|
||||
m_Data: {fileID: 11400000, guid: e0b1d2d816ae5624c99b09a2bebb2a39, type: 2}
|
||||
- m_RefCount: 1
|
||||
m_Data: {fileID: 11400000, guid: e0d57b3c128ba1447920637cdb289530, type: 2}
|
||||
- m_RefCount: 1
|
||||
m_Data: {fileID: 11400000, guid: 7568f730b2ba3754297a7612452482e2, type: 2}
|
||||
m_TileSpriteArray:
|
||||
- m_RefCount: 1
|
||||
m_Data: {fileID: 21300000, guid: 5c630d8b4d37f5d4f974d38f670ad5c1, type: 3}
|
||||
- m_RefCount: 1
|
||||
m_Data: {fileID: 21300000, guid: f67e7f54162405141b42d32ef8df76ad, type: 3}
|
||||
- m_RefCount: 1
|
||||
m_Data: {fileID: 21300000, guid: ccca3e050cb082b45af0a099790463f6, type: 3}
|
||||
- m_RefCount: 1
|
||||
@ -146,8 +186,10 @@ Tilemap:
|
||||
m_Data: {fileID: 21300000, guid: 77a39e873655d3c4b93d0b7696397b83, type: 3}
|
||||
- m_RefCount: 1
|
||||
m_Data: {fileID: 21300000, guid: b85a4b2ec6433d04895612d791edc260, type: 3}
|
||||
- m_RefCount: 1
|
||||
m_Data: {fileID: 21300000, guid: 6298844400e212d40bce870425ac2a5b, type: 3}
|
||||
m_TileMatrixArray:
|
||||
- m_RefCount: 4
|
||||
- m_RefCount: 7
|
||||
m_Data:
|
||||
e00: 1
|
||||
e01: 0
|
||||
@ -166,13 +208,13 @@ Tilemap:
|
||||
e32: 0
|
||||
e33: 1
|
||||
m_TileColorArray:
|
||||
- m_RefCount: 4
|
||||
- m_RefCount: 7
|
||||
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: -1, y: 0, z: 0}
|
||||
m_Size: {x: 2, y: 2, z: 1}
|
||||
m_Origin: {x: -1, y: -1, z: 0}
|
||||
m_Size: {x: 3, y: 3, z: 1}
|
||||
m_TileAnchor: {x: 0.5, y: 0.5, z: 0}
|
||||
m_TileOrientation: 0
|
||||
m_TileOrientationMatrix:
|
||||
@ -241,7 +283,7 @@ TilemapRenderer:
|
||||
m_Mode: 0
|
||||
m_DetectChunkCullingBounds: 0
|
||||
m_MaskInteraction: 0
|
||||
--- !u!114 &2473294596980876743
|
||||
--- !u!114 &5180442264077207259
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
|
||||
@ -13,6 +13,7 @@ MonoBehaviour:
|
||||
m_Name: Forest
|
||||
m_EditorClassIdentifier:
|
||||
_sprite: {fileID: 21300000, guid: 5c630d8b4d37f5d4f974d38f670ad5c1, type: 3}
|
||||
_isCollidable: 0
|
||||
_yieldPrefab: {fileID: 6962989255644195630, guid: f20569b5452c2b341a95d656b7534b7e, type: 3}
|
||||
_yieldSpeed: 0.5
|
||||
_yieldSpeed: 0.1
|
||||
_randomPositionConfig: 0.5
|
||||
|
||||
19
Assets/Tiles/Meat.asset
Normal file
19
Assets/Tiles/Meat.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: 84b05f2a26f63da46a1028488482d079, type: 3}
|
||||
m_Name: Meat
|
||||
m_EditorClassIdentifier:
|
||||
_sprite: {fileID: 21300000, guid: b1e6b8ebeb2e25f4f8c5de93a31dd6a2, type: 3}
|
||||
_isCollidable: 0
|
||||
_yieldPrefab: {fileID: 6962989255644195630, guid: a2dc5d9672c10074fa9c35c12f6339c1, type: 3}
|
||||
_yieldSpeed: 0.1
|
||||
_randomPositionConfig: 0.5
|
||||
8
Assets/Tiles/Meat.asset.meta
Normal file
8
Assets/Tiles/Meat.asset.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a19b3b6859986b449aac7484e064097a
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -9,10 +9,8 @@ MonoBehaviour:
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 84b05f2a26f63da46a1028488482d079, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: 9ff04aa2e904a19458fd5b144c230054, type: 3}
|
||||
m_Name: Mountain
|
||||
m_EditorClassIdentifier:
|
||||
_sprite: {fileID: 21300000, guid: 6298844400e212d40bce870425ac2a5b, type: 3}
|
||||
_yieldPrefab: {fileID: 6962989255644195630, guid: 484f0eca1c74ae34694692de56a36739, type: 3}
|
||||
_yieldSpeed: 0.5
|
||||
_randomPositionConfig: 0.5
|
||||
_isCollidable: 1
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e0d57b3c128ba1447920637cdb289530
|
||||
guid: e74655ccbd41a2b46b1ec9615aba0301
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
19
Assets/Tiles/RockNode.asset
Normal file
19
Assets/Tiles/RockNode.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: 84b05f2a26f63da46a1028488482d079, type: 3}
|
||||
m_Name: RockNode
|
||||
m_EditorClassIdentifier:
|
||||
_sprite: {fileID: 21300000, guid: f67e7f54162405141b42d32ef8df76ad, type: 3}
|
||||
_isCollidable: 0
|
||||
_yieldPrefab: {fileID: 6962989255644195630, guid: 484f0eca1c74ae34694692de56a36739, type: 3}
|
||||
_yieldSpeed: 0.1
|
||||
_randomPositionConfig: 0.5
|
||||
8
Assets/Tiles/RockNode.asset.meta
Normal file
8
Assets/Tiles/RockNode.asset.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e0d57b3c128ba1447920637cdb289530
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -14,7 +14,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
_sprite: {fileID: 21300000, guid: 77a39e873655d3c4b93d0b7696397b83, type: 3}
|
||||
_isCollidable: 1
|
||||
_prefab: {fileID: 6962989255644195630, guid: 6cd87b398e7a0e94580f4fcbe2fd310a, type: 3}
|
||||
_prefab: {fileID: 5531237550998824024, guid: 6cd87b398e7a0e94580f4fcbe2fd310a, type: 3}
|
||||
_spawnOnStart: 1
|
||||
_spawnSpeed: 0
|
||||
_spawnCounter: 0
|
||||
|
||||
@ -41,6 +41,9 @@ TagManager:
|
||||
-
|
||||
-
|
||||
m_SortingLayers:
|
||||
- name: paysage
|
||||
uniqueID: 436725303
|
||||
locked: 0
|
||||
- name: Default
|
||||
uniqueID: 0
|
||||
locked: 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user