work on game scene + fix bugs

problems :

- game scene was not as shown in the GDD
- problem when moving tilemap (the placeholders didn't follow)
- possible to place units outside the game area

solutions :

- try to make the game scene as close to the gdd as possible
- don't move the tilemap : move the camera instead (this keeps the world position of tilemap intact)
- there was a logic bug in the DraggablePlaceholder. It ain't anymore
This commit is contained in:
Felix Boucher 2023-07-09 13:50:04 -04:00
parent 920356d706
commit e05cf77b75
16 changed files with 1262 additions and 2313 deletions

File diff suppressed because it is too large Load Diff

View File

@ -15,8 +15,6 @@ MonoBehaviour:
_data:
- _key: Background
_tiles:
- _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}
@ -29,8 +27,6 @@ MonoBehaviour:
_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}
@ -43,8 +39,6 @@ MonoBehaviour:
_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}
_position: {x: -8, y: -3, z: 0}
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
@ -57,8 +51,6 @@ MonoBehaviour:
_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: -4, z: 0}
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
_position: {x: -7, y: -3, z: 0}
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
@ -71,8 +63,6 @@ MonoBehaviour:
_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: -4, z: 0}
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
_position: {x: -6, y: -3, z: 0}
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
@ -85,8 +75,6 @@ MonoBehaviour:
_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: -4, z: 0}
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
_position: {x: -5, y: -3, z: 0}
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
@ -99,8 +87,6 @@ MonoBehaviour:
_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: -4, z: 0}
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
_position: {x: -4, y: -3, z: 0}
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
@ -113,8 +99,6 @@ MonoBehaviour:
_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: -4, z: 0}
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
_position: {x: -3, y: -3, z: 0}
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
@ -127,8 +111,6 @@ MonoBehaviour:
_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: -4, z: 0}
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
_position: {x: -2, y: -3, z: 0}
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
@ -141,8 +123,6 @@ MonoBehaviour:
_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: -4, z: 0}
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
_position: {x: -1, y: -3, z: 0}
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
@ -155,160 +135,6 @@ MonoBehaviour:
_position: {x: -1, y: 1, 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: 0, y: -4, z: 0}
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
_position: {x: 0, y: -3, z: 0}
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
_position: {x: 0, y: -2, z: 0}
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
_position: {x: 0, y: -1, z: 0}
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
_position: {x: 0, y: 0, z: 0}
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
_position: {x: 0, y: 1, z: 0}
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
_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}
_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}
- _tile: {fileID: 11400000, guid: ef5a154519b23a34aaded32e86bf7f2f, type: 2}
_position: {x: 2, y: -4, 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: 3, y: -4, 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: 4, y: -4, 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: 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
@ -318,24 +144,62 @@ MonoBehaviour:
_scale: {x: 1, y: 1}
- _key: Entities
_tiles:
- _tile: {fileID: 11400000, guid: e0b1d2d816ae5624c99b09a2bebb2a39, type: 2}
_position: {x: -7, y: -2, z: 0}
- _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: e0d57b3c128ba1447920637cdb289530, type: 2}
_position: {x: -4, y: -2, 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: -2, y: -4, z: 0}
- _tile: {fileID: 11400000, guid: e0d57b3c128ba1447920637cdb289530, 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: e0d57b3c128ba1447920637cdb289530, type: 2}
_position: {x: 1, y: -3, z: 0}
- _tile: {fileID: 11400000, guid: e0b1d2d816ae5624c99b09a2bebb2a39, type: 2}
_position: {x: 1, y: 1, z: 0}
- _tile: {fileID: 11400000, guid: e0d57b3c128ba1447920637cdb289530, type: 2}
_position: {x: 3, y: 1, 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
@ -345,22 +209,10 @@ MonoBehaviour:
_scale: {x: 1, y: 1}
- _key: Spawners
_tiles:
- _tile: {fileID: 11400000, guid: 4aaf448680c7f8a438a9a5861c622a55, type: 2}
_position: {x: -10, y: -4, z: 0}
- _tile: {fileID: 11400000, guid: 4aaf448680c7f8a438a9a5861c622a55, type: 2}
_position: {x: -10, y: -2, z: 0}
- _tile: {fileID: 11400000, guid: 4aaf448680c7f8a438a9a5861c622a55, type: 2}
_position: {x: -10, y: 0, z: 0}
- _tile: {fileID: 11400000, guid: 4aaf448680c7f8a438a9a5861c622a55, type: 2}
_position: {x: -10, y: 2, z: 0}
- _tile: {fileID: 11400000, guid: 4002377ed7e87b34699f126f2b10c703, type: 2}
_position: {x: 10, y: -4, z: 0}
_position: {x: -1, y: -2, 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}
_position: {x: -1, y: 2, z: 0}
_isInvisible: 1
_isCollidable: 0
_isTrigger: 0

View File

@ -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: 40, y: 40}
m_SizeDelta: {x: 45, y: 45}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &907652128235033335
CanvasRenderer:
@ -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: 18, 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: 18, 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
@ -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: 40, y: 40}
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
@ -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: 18, 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

File diff suppressed because it is too large Load Diff

View File

@ -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);
}

View File

@ -7,7 +7,8 @@ public interface ILevelObject
{
Tile = 0,
Prefab = 1,
Tilemap = 2
Tilemap = 2,
Other = 3,
}
bool IsCollidable { get; }

View File

@ -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
}

View File

@ -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);

View File

@ -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;

View File

@ -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]

View File

@ -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]

View File

@ -107,16 +107,26 @@ Tilemap:
m_TileObjectToInstantiateIndex: 65535
dummyAlignment: 0
m_AllTileFlags: 0
- first: {x: -1, y: 0, z: 0}
- first: {x: 1, y: -1, z: 0}
second:
serializedVersion: 2
m_TileIndex: 0
m_TileIndex: 6
m_TileSpriteIndex: 2
m_TileMatrixIndex: 0
m_TileColorIndex: 0
m_TileObjectToInstantiateIndex: 65535
dummyAlignment: 0
m_AllTileFlags: 1073741825
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
@ -147,20 +157,10 @@ Tilemap:
m_TileObjectToInstantiateIndex: 65535
dummyAlignment: 0
m_AllTileFlags: 0
- first: {x: 1, y: 1, z: 0}
second:
serializedVersion: 2
m_TileIndex: 6
m_TileSpriteIndex: 4294967295
m_TileMatrixIndex: 0
m_TileColorIndex: 0
m_TileObjectToInstantiateIndex: 65535
dummyAlignment: 0
m_AllTileFlags: 0
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
@ -177,7 +177,7 @@ Tilemap:
- m_RefCount: 1
m_Data: {fileID: 21300000, guid: 5c630d8b4d37f5d4f974d38f670ad5c1, type: 3}
- m_RefCount: 1
m_Data: {fileID: 21300000, guid: 6298844400e212d40bce870425ac2a5b, type: 3}
m_Data: {fileID: 21300000, guid: f67e7f54162405141b42d32ef8df76ad, type: 3}
- m_RefCount: 1
m_Data: {fileID: 21300000, guid: ccca3e050cb082b45af0a099790463f6, type: 3}
- m_RefCount: 1
@ -186,6 +186,8 @@ 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: 7
m_Data:
@ -281,7 +283,7 @@ TilemapRenderer:
m_Mode: 0
m_DetectChunkCullingBounds: 0
m_MaskInteraction: 0
--- !u!114 &4236727698057346379
--- !u!114 &5180442264077207259
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}

View File

@ -9,11 +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}
_isCollidable: 0
_yieldPrefab: {fileID: 6962989255644195630, guid: 484f0eca1c74ae34694692de56a36739, type: 3}
_yieldSpeed: 0.1
_randomPositionConfig: 0.5
_isCollidable: 1

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: e0d57b3c128ba1447920637cdb289530
guid: e74655ccbd41a2b46b1ec9615aba0301
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

View File

@ -1,147 +0,0 @@
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: