Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
d93381aae2
18 changed files with 324 additions and 268 deletions
|
@ -24,7 +24,7 @@ GameObject:
|
|||
- component: {fileID: 114053119853995034}
|
||||
- component: {fileID: 61243635969098510}
|
||||
m_Layer: 0
|
||||
m_Name: door
|
||||
m_Name: doorInner
|
||||
m_TagString: door
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
|
@ -59,8 +59,8 @@ BoxCollider2D:
|
|||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
oldSize: {x: 1, y: 1}
|
||||
newSize: {x: 1, y: 1}
|
||||
oldSize: {x: 10, y: 10}
|
||||
newSize: {x: 10, y: 10}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
|
@ -84,8 +84,8 @@ BoxCollider2D:
|
|||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
oldSize: {x: 1, y: 1}
|
||||
newSize: {x: 1, y: 1}
|
||||
oldSize: {x: 10, y: 10}
|
||||
newSize: {x: 10, y: 10}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
|
@ -140,12 +140,12 @@ SpriteRenderer:
|
|||
m_SortingLayerID: 1310459315
|
||||
m_SortingLayer: -1
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 21300000, guid: 6e7545b35610da243b692db13fb3c380, type: 3}
|
||||
m_Sprite: {fileID: 21300000, guid: c859997db2d488d42a8189791f73e0fb, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_Size: {x: 10, y: 10}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
152
Assets/Prefabs/Tiles/doorOuter.prefab
Normal file
152
Assets/Prefabs/Tiles/doorOuter.prefab
Normal file
|
@ -0,0 +1,152 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1001 &100100000
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 1
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications: []
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 0}
|
||||
m_RootGameObject: {fileID: 1575370008060226}
|
||||
m_IsPrefabParent: 1
|
||||
--- !u!1 &1575370008060226
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 4538083943145114}
|
||||
- component: {fileID: 212928732135609004}
|
||||
- component: {fileID: 61252126965124090}
|
||||
- component: {fileID: 114203808595097248}
|
||||
- component: {fileID: 61597103562615806}
|
||||
m_Layer: 0
|
||||
m_Name: doorOuter
|
||||
m_TagString: door
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4538083943145114
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1575370008060226}
|
||||
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_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!61 &61252126965124090
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1575370008060226}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
oldSize: {x: 10, y: 10}
|
||||
newSize: {x: 10, y: 10}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!61 &61597103562615806
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1575370008060226}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 1
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
oldSize: {x: 10, y: 10}
|
||||
newSize: {x: 10, y: 10}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!114 &114203808595097248
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1575370008060226}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 8b8cc30ac6e59724bba6536a17fbf027, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
parent: {fileID: 0}
|
||||
--- !u!212 &212928732135609004
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1575370008060226}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RenderingLayerMask: 4294967295
|
||||
m_Materials:
|
||||
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 1310459315
|
||||
m_SortingLayer: -1
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 21300000, guid: d9380a46a795012449f336288fbd1854, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 10, y: 10}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
8
Assets/Prefabs/Tiles/doorOuter.prefab.meta
Normal file
8
Assets/Prefabs/Tiles/doorOuter.prefab.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 70bf9bb227285e74383db2dc84cc6c50
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 100100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1276,7 +1276,8 @@ MonoBehaviour:
|
|||
BorderSingle: {fileID: 1277252496101342, guid: ed9537580662f6046a1514a4c5bfdd98,
|
||||
type: 2}
|
||||
Ground: {fileID: 1487413182883822, guid: bc8a58beb0459094483211a5c7933959, type: 2}
|
||||
Door: {fileID: 1065161683117842, guid: 06aa81f4fbf9a3a4a8f9fdadafcbf7fa, type: 2}
|
||||
DoorInner: {fileID: 1065161683117842, guid: 06aa81f4fbf9a3a4a8f9fdadafcbf7fa, type: 2}
|
||||
DoorOuter: {fileID: 1575370008060226, guid: 70bf9bb227285e74383db2dc84cc6c50, type: 2}
|
||||
Rock: {fileID: 1373919933116942, guid: 5f26192f79d542e49ad24fadc39f5654, type: 2}
|
||||
RockL: {fileID: 1411303269485816, guid: 92068b1ee4568d045b60c249ba57c186, type: 2}
|
||||
RockU: {fileID: 1990883489100502, guid: c44f475306efef3438b85a84f91fcf81, type: 2}
|
||||
|
|
|
@ -7,26 +7,25 @@ public class CameraControl : MonoBehaviour {
|
|||
[SerializeField]
|
||||
private GameObject followThis;
|
||||
|
||||
private Vector3 offset;
|
||||
|
||||
void Start() {
|
||||
Camera.main.orthographicSize = 5;
|
||||
if ( followThis == null )
|
||||
return;
|
||||
offset = transform.position - followThis.transform.position;
|
||||
}
|
||||
|
||||
void LateUpdate() {
|
||||
if ( followThis == null )
|
||||
return;
|
||||
var target = followThis.transform.position; // + offset;
|
||||
var target = followThis.transform.position;
|
||||
var targetVec = target - transform.position;
|
||||
targetVec.Scale(new Vector3(0.05f, 0.05f, 0));
|
||||
|
||||
targetVec.Scale(new Vector3(0.05f, 0.05f, 0));
|
||||
transform.position = transform.position + targetVec;
|
||||
}
|
||||
|
||||
public void SetFollow(GameObject g) {
|
||||
followThis = g;
|
||||
offset = transform.position - followThis.transform.position;
|
||||
var diff = (transform.position - followThis.transform.position);
|
||||
diff.Scale(new Vector3(1f, 1f, 0f));
|
||||
transform.position = transform.position - diff + (Vector3) (Random.insideUnitCircle) * Random.value * 5f;
|
||||
}
|
||||
}
|
|
@ -20,7 +20,9 @@ public class GameController : MonoBehaviour {
|
|||
[SerializeField]
|
||||
GameObject Ground;
|
||||
[SerializeField]
|
||||
GameObject Door;
|
||||
GameObject DoorInner;
|
||||
[SerializeField]
|
||||
GameObject DoorOuter;
|
||||
[SerializeField]
|
||||
GameObject Rock;
|
||||
[SerializeField]
|
||||
|
@ -106,7 +108,8 @@ public class GameController : MonoBehaviour {
|
|||
genPrefabs.Add(GenerationProcessor.ExtendedTileType.RockURD, RockURD);
|
||||
genPrefabs.Add(GenerationProcessor.ExtendedTileType.RockLRD, RockLRD);
|
||||
genPrefabs.Add(GenerationProcessor.ExtendedTileType.Ground, Ground);
|
||||
genPrefabs.Add(GenerationProcessor.ExtendedTileType.Door, Door);
|
||||
genPrefabs.Add(GenerationProcessor.ExtendedTileType.DoorInner, DoorInner);
|
||||
genPrefabs.Add(GenerationProcessor.ExtendedTileType.DoorOuter, DoorOuter);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
|
@ -154,7 +157,7 @@ public class GameController : MonoBehaviour {
|
|||
GenerationProcessor gp = new GenerationProcessor(genPrefabs);
|
||||
dg.Generate();
|
||||
|
||||
// Start room
|
||||
// Start room
|
||||
GameObject goStart = gp.ProcessRoom(dg.start.tiles);
|
||||
goStart.name = "Start";
|
||||
List<Transform> lt = new List<Transform>(goStart.GetComponentsInChildren<Transform>());
|
||||
|
|
|
@ -202,6 +202,8 @@ public class DungeonGenerator {
|
|||
GenerateInterior(r);
|
||||
}
|
||||
|
||||
start.spawnpoints.Add(start.GetCenter());
|
||||
|
||||
foreach (Vector2Int v in allDoors) {
|
||||
foreach (GenRoom r in rooms) {
|
||||
for (int x = -TUNNEL_THICKNESS; x < TUNNEL_THICKNESS; x++)
|
||||
|
|
|
@ -3,83 +3,84 @@ using System.Collections.Generic;
|
|||
using UnityEngine;
|
||||
|
||||
public class GenerationProcessor {
|
||||
public enum ExtendedTileType {
|
||||
BorderOuter, BorderInner, BorderSingle, Ground, Door, Rock, RockL, RockU, RockR, RockD, RockLU, RockLR, RockLD, RockUR, RockUD, RockRD, RockLURD, RockLUD, RockLUR, RockURD, RockLRD
|
||||
}
|
||||
Dictionary<ExtendedTileType, GameObject> prefabs;
|
||||
public GenerationProcessor(Dictionary<ExtendedTileType, GameObject> prefabs) {
|
||||
this.prefabs = prefabs;
|
||||
}
|
||||
public enum ExtendedTileType {
|
||||
BorderOuter, BorderInner, BorderSingle, Ground, DoorInner, DoorOuter, Rock, RockL, RockU, RockR, RockD, RockLU, RockLR, RockLD, RockUR, RockUD, RockRD, RockLURD, RockLUD, RockLUR, RockURD, RockLRD
|
||||
}
|
||||
Dictionary<ExtendedTileType, GameObject> prefabs;
|
||||
public GenerationProcessor(Dictionary<ExtendedTileType, GameObject> prefabs) {
|
||||
this.prefabs = prefabs;
|
||||
}
|
||||
|
||||
public GameObject ProcessRoom(Dictionary<Vector2Int, GenTile> tiles) {
|
||||
GameObject root = new GameObject {
|
||||
name = "Room"
|
||||
};
|
||||
foreach ( Vector2Int v in tiles.Keys ) {
|
||||
ExtendedTileType type = ExtendedTileType.Ground;
|
||||
int rotation = 0;
|
||||
switch ( tiles[v].type ) {
|
||||
case Room.TileType.WALL:
|
||||
type = getCorrectWallType(tiles, v);
|
||||
rotation = getCorrectWallRotation(type, tiles[v].position);
|
||||
break;
|
||||
case Room.TileType.GROUND:
|
||||
type = ExtendedTileType.Ground;
|
||||
break;
|
||||
case Room.TileType.DOOR:
|
||||
type = ExtendedTileType.Door;
|
||||
break;
|
||||
case Room.TileType.ROCK:
|
||||
type = getCorrectRockType(tiles, v);
|
||||
break;
|
||||
}
|
||||
CreateGOFromType(v, rotation, type, root);
|
||||
public GameObject ProcessRoom(Dictionary<Vector2Int, GenTile> tiles) {
|
||||
GameObject root = new GameObject {
|
||||
name = "Room"
|
||||
};
|
||||
foreach ( Vector2Int v in tiles.Keys ) {
|
||||
ExtendedTileType type = ExtendedTileType.Ground;
|
||||
int rotation = 0;
|
||||
switch ( tiles[v].type ) {
|
||||
case Room.TileType.WALL:
|
||||
type = GetCorrectWallType(tiles, v);
|
||||
rotation = GetCorrectWallRotation(type, tiles[v].position);
|
||||
break;
|
||||
case Room.TileType.GROUND:
|
||||
type = ExtendedTileType.Ground;
|
||||
break;
|
||||
case Room.TileType.DOOR:
|
||||
type = GetCorrectDoorType(tiles, v);
|
||||
rotation = GetCorrectDoorRotation(type, tiles, v);
|
||||
break;
|
||||
case Room.TileType.ROCK:
|
||||
type = GetCorrectRockType(tiles, v);
|
||||
break;
|
||||
}
|
||||
return root;
|
||||
CreateGOFromType(v, rotation, tiles[v].type, type, root);
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
private GameObject CreateGOFromType(Vector2 v, int rotation, ExtendedTileType t, GameObject root) {
|
||||
GameObject tmp = null;
|
||||
//if (t == ExtendedTileType.BorderInner || t == ExtendedTileType.BorderOuter || t == ExtendedTileType.BorderInner)
|
||||
// CreateGOFromType(v, rotation, ExtendedTileType.Ground, root);
|
||||
if ( prefabs.ContainsKey(t) && root != null ) {
|
||||
tmp = Object.Instantiate(prefabs[t], root.transform);
|
||||
tmp.transform.position = v;
|
||||
tmp.transform.Rotate(new Vector3(0, 0, rotation));
|
||||
}
|
||||
return tmp;
|
||||
private GameObject CreateGOFromType(Vector2 v, int rotation, Room.TileType type, ExtendedTileType t, GameObject root) {
|
||||
GameObject tmp = null;
|
||||
if (type != Room.TileType.GROUND)
|
||||
CreateGOFromType(v, 0, Room.TileType.GROUND, ExtendedTileType.Ground, root);
|
||||
if ( prefabs.ContainsKey(t) && root != null ) {
|
||||
tmp = Object.Instantiate(prefabs[t], root.transform);
|
||||
tmp.transform.position = v;
|
||||
tmp.transform.Rotate(new Vector3(0, 0, rotation));
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
private int CountSpecificNeighbours(Dictionary<Vector2Int, GenTile> tiles, Vector2Int position, Room.TileType type) {
|
||||
int counter = 0;
|
||||
Vector2Int toCheck = position + new Vector2Int(0, -1);
|
||||
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == type)
|
||||
counter++;
|
||||
toCheck = position + new Vector2Int(-1, 0);
|
||||
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == type)
|
||||
counter++;
|
||||
toCheck = position + new Vector2Int(0, 1);
|
||||
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == type)
|
||||
counter++;
|
||||
toCheck = position + new Vector2Int(1, 0);
|
||||
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == type)
|
||||
counter++;
|
||||
return counter;
|
||||
}
|
||||
private int CountSpecificNeighbours(Dictionary<Vector2Int, GenTile> tiles, Vector2Int position, Room.TileType type) {
|
||||
int counter = 0;
|
||||
Vector2Int toCheck = position + new Vector2Int(0, -1);
|
||||
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == type)
|
||||
counter++;
|
||||
toCheck = position + new Vector2Int(-1, 0);
|
||||
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == type)
|
||||
counter++;
|
||||
toCheck = position + new Vector2Int(0, 1);
|
||||
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == type)
|
||||
counter++;
|
||||
toCheck = position + new Vector2Int(1, 0);
|
||||
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == type)
|
||||
counter++;
|
||||
return counter;
|
||||
}
|
||||
|
||||
private ExtendedTileType getCorrectWallType(Dictionary<Vector2Int, GenTile> tiles, Vector2Int position){
|
||||
int groundNumber = CountSpecificNeighbours(tiles, position, Room.TileType.GROUND) + CountSpecificNeighbours(tiles, position, Room.TileType.ROCK);
|
||||
switch(groundNumber){
|
||||
case 0:
|
||||
return ExtendedTileType.BorderInner;
|
||||
case 2:
|
||||
return ExtendedTileType.BorderOuter;
|
||||
default:
|
||||
return ExtendedTileType.BorderSingle;
|
||||
}
|
||||
}
|
||||
private ExtendedTileType GetCorrectWallType(Dictionary<Vector2Int, GenTile> tiles, Vector2Int position){
|
||||
int groundNumber = CountSpecificNeighbours(tiles, position, Room.TileType.GROUND) + CountSpecificNeighbours(tiles, position, Room.TileType.ROCK);
|
||||
switch(groundNumber){
|
||||
case 0:
|
||||
return ExtendedTileType.BorderInner;
|
||||
case 2:
|
||||
return ExtendedTileType.BorderOuter;
|
||||
default:
|
||||
return ExtendedTileType.BorderSingle;
|
||||
}
|
||||
}
|
||||
|
||||
private int getCorrectWallRotation(ExtendedTileType type, GenTile.Position position) {
|
||||
private int GetCorrectWallRotation(ExtendedTileType type, GenTile.Position position) {
|
||||
int rotation = 0;
|
||||
switch (type) {
|
||||
case ExtendedTileType.BorderSingle:
|
||||
|
@ -113,24 +114,24 @@ public class GenerationProcessor {
|
|||
rotation = 180;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return rotation;
|
||||
break;
|
||||
}
|
||||
return rotation;
|
||||
}
|
||||
|
||||
private ExtendedTileType getCorrectRockType(Dictionary<Vector2Int, GenTile> tiles, Vector2Int position) {
|
||||
private ExtendedTileType GetCorrectRockType(Dictionary<Vector2Int, GenTile> tiles, Vector2Int position) {
|
||||
int meta = 0;
|
||||
Vector2Int toCheck = position + new Vector2Int(0, -1);
|
||||
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == Room.TileType.ROCK)
|
||||
meta += 1;
|
||||
toCheck = position + new Vector2Int(-1, 0);
|
||||
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == Room.TileType.ROCK)
|
||||
meta += 2;
|
||||
toCheck = position + new Vector2Int(0, 1);
|
||||
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == Room.TileType.ROCK)
|
||||
meta += 4;
|
||||
toCheck = position + new Vector2Int(1, 0);
|
||||
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == Room.TileType.ROCK)
|
||||
Vector2Int toCheck = position + new Vector2Int(0, -1);
|
||||
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == Room.TileType.ROCK)
|
||||
meta += 1;
|
||||
toCheck = position + new Vector2Int(-1, 0);
|
||||
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == Room.TileType.ROCK)
|
||||
meta += 2;
|
||||
toCheck = position + new Vector2Int(0, 1);
|
||||
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == Room.TileType.ROCK)
|
||||
meta += 4;
|
||||
toCheck = position + new Vector2Int(1, 0);
|
||||
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == Room.TileType.ROCK)
|
||||
meta += 8;
|
||||
|
||||
switch(meta) {
|
||||
|
@ -167,5 +168,39 @@ public class GenerationProcessor {
|
|||
default:
|
||||
return ExtendedTileType.Rock;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ExtendedTileType GetCorrectDoorType(Dictionary<Vector2Int, GenTile> tiles, Vector2Int position) {
|
||||
int neighbourDoors = CountSpecificNeighbours(tiles, position, Room.TileType.DOOR);
|
||||
switch(neighbourDoors) {
|
||||
case 1:
|
||||
return ExtendedTileType.DoorOuter;
|
||||
default:
|
||||
return ExtendedTileType.DoorInner;
|
||||
}
|
||||
}
|
||||
|
||||
private int GetCorrectDoorRotation(ExtendedTileType type, Dictionary<Vector2Int, GenTile> tiles, Vector2Int position) {
|
||||
switch(type) {
|
||||
case ExtendedTileType.DoorOuter:
|
||||
Vector2Int toCheck = position + new Vector2Int(0, -1);
|
||||
if(tiles.ContainsKey(toCheck) && tiles[toCheck].type == Room.TileType.DOOR)
|
||||
return 270;
|
||||
toCheck = position + new Vector2Int(-1, 0);
|
||||
if(tiles.ContainsKey(toCheck) && tiles[toCheck].type == Room.TileType.DOOR)
|
||||
return 180;
|
||||
toCheck = position + new Vector2Int(0, 1);
|
||||
if(tiles.ContainsKey(toCheck) && tiles[toCheck].type == Room.TileType.DOOR)
|
||||
return 90;
|
||||
toCheck = position + new Vector2Int(1, 0);
|
||||
return 0;
|
||||
break;
|
||||
case ExtendedTileType.DoorInner:
|
||||
Vector2Int toCheckD = position + new Vector2Int(0, -1);
|
||||
if(tiles.ContainsKey(toCheckD) && tiles[toCheckD].type == Room.TileType.DOOR)
|
||||
return 90;
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ public class PlayerMovement : MonoBehaviour {
|
|||
return;
|
||||
|
||||
Vector3 speedVec = new Vector3(rb.velocity.x, rb.velocity.y, 0);
|
||||
Camera.main.orthographicSize = Camera.main.orthographicSize * 0.95f + (5 + 4f/6f * (speedVec.magnitude)) * 0.05f;
|
||||
float speed = speedVec.magnitude;
|
||||
|
||||
{ // Forward
|
||||
|
|
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 7.9 KiB |
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d069c80c6e533b540be700fbf87df23a
|
||||
guid: c859997db2d488d42a8189791f73e0fb
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
|
@ -78,35 +78,13 @@ TextureImporter:
|
|||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 9dcafc29ebb3b30459aef9428afc15cf
|
||||
spriteID: b61e83ad89dcc8c48a89222222467c15
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8d303be62c3d4aa4191ed4771deb21f7
|
||||
guid: d9380a46a795012449f336288fbd1854
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
|
@ -78,35 +78,13 @@ TextureImporter:
|
|||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: ec5219b6a944ba04fad7d8c63457efef
|
||||
spriteID: a2e2a57d1f17801488b7f9cb7ae4eef9
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
Binary file not shown.
Before Width: | Height: | Size: 8.8 KiB |
|
@ -1,117 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6e7545b35610da243b692db13fb3c380
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 5
|
||||
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
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
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: 1000
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 2
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 3acde526598c49d48a37036db484d91d
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/graphics/textures/car.meta
Normal file
8
Assets/graphics/textures/car.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9ec323b9157704d00a3409f8ea6e46b2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/graphics/textures/tmp.meta
Normal file
8
Assets/graphics/textures/tmp.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: df6e7833427b5497b92308fb6f54e552
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Reference in a new issue