Add ToOuter to door | PlayerSettings
This commit is contained in:
parent
fb2ba06537
commit
e49d5d2ea4
5 changed files with 232 additions and 214 deletions
|
@ -7,6 +7,8 @@ public class Door : MonoBehaviour {
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
Room parent;
|
Room parent;
|
||||||
|
|
||||||
|
Vector2Int toOuter;
|
||||||
|
|
||||||
BoxCollider2D boundingBox;
|
BoxCollider2D boundingBox;
|
||||||
BoxCollider2D triggerBox;
|
BoxCollider2D triggerBox;
|
||||||
|
|
||||||
|
@ -33,6 +35,10 @@ public class Door : MonoBehaviour {
|
||||||
this.parent = room;
|
this.parent = room;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetToOuter(Vector2Int v) {
|
||||||
|
toOuter = v;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Locks the door.
|
/// Locks the door.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -73,12 +79,13 @@ public class Door : MonoBehaviour {
|
||||||
Player player = collision.gameObject.GetComponent<Player>();
|
Player player = collision.gameObject.GetComponent<Player>();
|
||||||
Vector2 centerToCollider = (Vector2) gameObject.transform.position - parent.GetPosition() + parent.GetCenter();
|
Vector2 centerToCollider = (Vector2) gameObject.transform.position - parent.GetPosition() + parent.GetCenter();
|
||||||
Vector2 centerToPlayer = (Vector2) player.gameObject.transform.position - parent.GetPosition() + parent.GetCenter();
|
Vector2 centerToPlayer = (Vector2) player.gameObject.transform.position - parent.GetPosition() + parent.GetCenter();
|
||||||
if (centerToCollider.magnitude - 1 < centerToPlayer.magnitude) {
|
if (centerToCollider.magnitude - 0.89 < centerToPlayer.magnitude) {
|
||||||
Debug.Log(centerToCollider.magnitude - 1);
|
Debug.Log(centerToCollider.magnitude - 0.89);
|
||||||
Debug.Log(centerToPlayer.magnitude);
|
Debug.Log(centerToPlayer.magnitude);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Debug.Log(centerToCollider.magnitude - 0.89);
|
||||||
|
Debug.Log(centerToPlayer.magnitude);
|
||||||
Debug.Log("Leaving Trigger");
|
Debug.Log("Leaving Trigger");
|
||||||
if(parent == null) {
|
if(parent == null) {
|
||||||
Debug.Log("This door has no parent Room!");
|
Debug.Log("This door has no parent Room!");
|
||||||
|
|
|
@ -222,7 +222,7 @@ public class GameController : MonoBehaviour {
|
||||||
lt.ForEach(x => {
|
lt.ForEach(x => {
|
||||||
x.SetParent(doorRoot.transform);
|
x.SetParent(doorRoot.transform);
|
||||||
x.gameObject.GetComponent<Door>().SetParent(start);
|
x.gameObject.GetComponent<Door>().SetParent(start);
|
||||||
});
|
});
|
||||||
start.SetDoorsRootObject(doorRoot);
|
start.SetDoorsRootObject(doorRoot);
|
||||||
|
|
||||||
// Spawnpoint
|
// Spawnpoint
|
||||||
|
|
|
@ -3,217 +3,236 @@ using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class GenerationProcessor {
|
public class GenerationProcessor {
|
||||||
public enum ExtendedTileType {
|
public enum ExtendedTileType {
|
||||||
BorderOuter, BorderInner, BorderSingle, Ground0, Ground1, Ground2, Ground3, DoorInner, DoorOuter, Rock, RockL, RockU, RockR, RockD, RockLU, RockLR, RockLD, RockUR, RockUD, RockRD, RockLURD, RockLUD, RockLUR, RockURD, RockLRD, Flag
|
BorderOuter, BorderInner, BorderSingle, Ground0, Ground1, Ground2, Ground3, DoorInner, DoorOuter, Rock, RockL, RockU, RockR, RockD, RockLU, RockLR, RockLD, RockUR, RockUD, RockRD, RockLURD, RockLUD, RockLUR, RockURD, RockLRD, Flag
|
||||||
}
|
|
||||||
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 = GetRandomGroundType();
|
|
||||||
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 = GetRandomGroundType();
|
|
||||||
break;
|
|
||||||
case Room.TileType.DOOR:
|
|
||||||
type = GetCorrectDoorType(tiles, v);
|
|
||||||
rotation = GetCorrectDoorRotation(type, tiles, v);
|
|
||||||
break;
|
|
||||||
case Room.TileType.ROCK:
|
|
||||||
type = GetCorrectRockType(tiles, v);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
CreateGOFromType(v, rotation, tiles[v].type, type, root);
|
|
||||||
}
|
}
|
||||||
return root;
|
Dictionary<ExtendedTileType, GameObject> prefabs;
|
||||||
}
|
public GenerationProcessor(Dictionary<ExtendedTileType, GameObject> prefabs) {
|
||||||
|
this.prefabs = prefabs;
|
||||||
public 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, GetRandomGroundType(), 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) {
|
public GameObject ProcessRoom(Dictionary<Vector2Int, GenTile> tiles) {
|
||||||
int counter = 0;
|
GameObject root = new GameObject {
|
||||||
Vector2Int toCheck = position + new Vector2Int(0, -1);
|
name = "Room"
|
||||||
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == type)
|
};
|
||||||
counter++;
|
foreach ( Vector2Int v in tiles.Keys ) {
|
||||||
toCheck = position + new Vector2Int(-1, 0);
|
ExtendedTileType type = GetRandomGroundType();
|
||||||
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == type)
|
int rotation = 0;
|
||||||
counter++;
|
switch ( tiles[v].type ) {
|
||||||
toCheck = position + new Vector2Int(0, 1);
|
case Room.TileType.WALL:
|
||||||
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == type)
|
type = GetCorrectWallType(tiles, v);
|
||||||
counter++;
|
rotation = GetCorrectWallRotation(type, tiles[v].position);
|
||||||
toCheck = position + new Vector2Int(1, 0);
|
break;
|
||||||
if (tiles.ContainsKey(toCheck) && tiles[toCheck].type == type)
|
case Room.TileType.GROUND:
|
||||||
counter++;
|
type = GetRandomGroundType();
|
||||||
return counter;
|
break;
|
||||||
}
|
case Room.TileType.DOOR:
|
||||||
|
type = GetCorrectDoorType(tiles, v);
|
||||||
private ExtendedTileType GetCorrectWallType(Dictionary<Vector2Int, GenTile> tiles, Vector2Int position){
|
rotation = GetCorrectDoorRotation(type, tiles, v);
|
||||||
int groundNumber = CountSpecificNeighbours(tiles, position, Room.TileType.GROUND) + CountSpecificNeighbours(tiles, position, Room.TileType.ROCK);
|
break;
|
||||||
switch(groundNumber){
|
case Room.TileType.ROCK:
|
||||||
case 0:
|
type = GetCorrectRockType(tiles, v);
|
||||||
return ExtendedTileType.BorderInner;
|
break;
|
||||||
case 2:
|
}
|
||||||
return ExtendedTileType.BorderOuter;
|
GameObject go = CreateGOFromType(v, rotation, tiles[v].type, type, root);
|
||||||
default:
|
// Todo dirty hack
|
||||||
return ExtendedTileType.BorderSingle;
|
if ( go.tag == "door" ) {
|
||||||
}
|
go.GetComponent<Door>().SetToOuter(GenerationProcessor.GetDirectionVector(tiles[v].position));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int GetCorrectWallRotation(ExtendedTileType type, GenTile.Position position) {
|
|
||||||
int rotation = 0;
|
|
||||||
switch (type) {
|
|
||||||
case ExtendedTileType.BorderSingle:
|
|
||||||
switch (position) {
|
|
||||||
case GenTile.Position.BOTTOM:
|
|
||||||
rotation = 180;
|
|
||||||
break;
|
|
||||||
case GenTile.Position.LEFT:
|
|
||||||
rotation = 90;
|
|
||||||
break;
|
|
||||||
case GenTile.Position.TOP:
|
|
||||||
rotation = 0;
|
|
||||||
break;
|
|
||||||
case GenTile.Position.RIGHT:
|
|
||||||
rotation = 270;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
return root;
|
||||||
case ExtendedTileType.BorderInner:
|
}
|
||||||
switch (position) {
|
|
||||||
case GenTile.Position.BOTTOM_LEFT:
|
public GameObject CreateGOFromType(Vector2 v, int rotation, Room.TileType type, ExtendedTileType t, GameObject root) {
|
||||||
rotation = 90;
|
GameObject tmp = null;
|
||||||
break;
|
if ( type != Room.TileType.GROUND )
|
||||||
case GenTile.Position.TOP_LEFT:
|
CreateGOFromType(v, 0, Room.TileType.GROUND, GetRandomGroundType(), root);
|
||||||
rotation = 0;
|
if ( prefabs.ContainsKey(t) && root != null ) {
|
||||||
break;
|
tmp = Object.Instantiate(prefabs[t], root.transform);
|
||||||
case GenTile.Position.TOP_RIGHT:
|
tmp.transform.position = v;
|
||||||
rotation = 270;
|
tmp.transform.Rotate(new Vector3(0, 0, rotation));
|
||||||
break;
|
|
||||||
case GenTile.Position.BOTTOM_RIGHT:
|
|
||||||
rotation = 180;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
return tmp;
|
||||||
}
|
}
|
||||||
return rotation;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ExtendedTileType GetCorrectRockType(Dictionary<Vector2Int, GenTile> tiles, Vector2Int position) {
|
private int CountSpecificNeighbours(Dictionary<Vector2Int, GenTile> tiles, Vector2Int position, Room.TileType type) {
|
||||||
int meta = 0;
|
int counter = 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)
|
|
||||||
meta += 8;
|
|
||||||
|
|
||||||
switch(meta) {
|
|
||||||
case 1:
|
|
||||||
return ExtendedTileType.RockD;
|
|
||||||
case 2:
|
|
||||||
return ExtendedTileType.RockL;
|
|
||||||
case 3:
|
|
||||||
return ExtendedTileType.RockLD;
|
|
||||||
case 4:
|
|
||||||
return ExtendedTileType.RockU;
|
|
||||||
case 5:
|
|
||||||
return ExtendedTileType.RockUD;
|
|
||||||
case 6:
|
|
||||||
return ExtendedTileType.RockLU;
|
|
||||||
case 7:
|
|
||||||
return ExtendedTileType.RockLUD;
|
|
||||||
case 8:
|
|
||||||
return ExtendedTileType.RockR;
|
|
||||||
case 9:
|
|
||||||
return ExtendedTileType.RockRD;
|
|
||||||
case 10:
|
|
||||||
return ExtendedTileType.RockLR;
|
|
||||||
case 11:
|
|
||||||
return ExtendedTileType.RockLRD;
|
|
||||||
case 12:
|
|
||||||
return ExtendedTileType.RockUR;
|
|
||||||
case 13:
|
|
||||||
return ExtendedTileType.RockURD;
|
|
||||||
case 14:
|
|
||||||
return ExtendedTileType.RockLUR;
|
|
||||||
case 15:
|
|
||||||
return ExtendedTileType.RockLURD;
|
|
||||||
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);
|
Vector2Int toCheck = position + new Vector2Int(0, -1);
|
||||||
if(tiles.ContainsKey(toCheck) && tiles[toCheck].type == Room.TileType.DOOR)
|
if ( tiles.ContainsKey(toCheck) && tiles[toCheck].type == type )
|
||||||
return 270;
|
counter++;
|
||||||
toCheck = position + new Vector2Int(-1, 0);
|
toCheck = position + new Vector2Int(-1, 0);
|
||||||
if(tiles.ContainsKey(toCheck) && tiles[toCheck].type == Room.TileType.DOOR)
|
if ( tiles.ContainsKey(toCheck) && tiles[toCheck].type == type )
|
||||||
return 180;
|
counter++;
|
||||||
toCheck = position + new Vector2Int(0, 1);
|
toCheck = position + new Vector2Int(0, 1);
|
||||||
if(tiles.ContainsKey(toCheck) && tiles[toCheck].type == Room.TileType.DOOR)
|
if ( tiles.ContainsKey(toCheck) && tiles[toCheck].type == type )
|
||||||
return 90;
|
counter++;
|
||||||
toCheck = position + new Vector2Int(1, 0);
|
toCheck = position + new Vector2Int(1, 0);
|
||||||
return 0;
|
if ( tiles.ContainsKey(toCheck) && tiles[toCheck].type == type )
|
||||||
case ExtendedTileType.DoorInner:
|
counter++;
|
||||||
Vector2Int toCheckD = position + new Vector2Int(0, -1);
|
return counter;
|
||||||
if(tiles.ContainsKey(toCheckD) && tiles[toCheckD].type == Room.TileType.DOOR)
|
|
||||||
return 90;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ExtendedTileType GetRandomGroundType() {
|
private ExtendedTileType GetCorrectWallType(Dictionary<Vector2Int, GenTile> tiles, Vector2Int position) {
|
||||||
int num = (int) (UnityEngine.Random.value * 4);
|
int groundNumber = CountSpecificNeighbours(tiles, position, Room.TileType.GROUND) + CountSpecificNeighbours(tiles, position, Room.TileType.ROCK);
|
||||||
switch(num) {
|
switch ( groundNumber ) {
|
||||||
case 0:
|
case 0:
|
||||||
return ExtendedTileType.Ground0;
|
return ExtendedTileType.BorderInner;
|
||||||
case 1:
|
case 2:
|
||||||
return ExtendedTileType.Ground1;
|
return ExtendedTileType.BorderOuter;
|
||||||
case 2:
|
default:
|
||||||
return ExtendedTileType.Ground2;
|
return ExtendedTileType.BorderSingle;
|
||||||
default:
|
}
|
||||||
return ExtendedTileType.Ground3;
|
}
|
||||||
|
|
||||||
|
private int GetCorrectWallRotation(ExtendedTileType type, GenTile.Position position) {
|
||||||
|
int rotation = 0;
|
||||||
|
switch ( type ) {
|
||||||
|
case ExtendedTileType.BorderSingle:
|
||||||
|
switch ( position ) {
|
||||||
|
case GenTile.Position.BOTTOM:
|
||||||
|
rotation = 180;
|
||||||
|
break;
|
||||||
|
case GenTile.Position.LEFT:
|
||||||
|
rotation = 90;
|
||||||
|
break;
|
||||||
|
case GenTile.Position.TOP:
|
||||||
|
rotation = 0;
|
||||||
|
break;
|
||||||
|
case GenTile.Position.RIGHT:
|
||||||
|
rotation = 270;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ExtendedTileType.BorderInner:
|
||||||
|
switch ( position ) {
|
||||||
|
case GenTile.Position.BOTTOM_LEFT:
|
||||||
|
rotation = 90;
|
||||||
|
break;
|
||||||
|
case GenTile.Position.TOP_LEFT:
|
||||||
|
rotation = 0;
|
||||||
|
break;
|
||||||
|
case GenTile.Position.TOP_RIGHT:
|
||||||
|
rotation = 270;
|
||||||
|
break;
|
||||||
|
case GenTile.Position.BOTTOM_RIGHT:
|
||||||
|
rotation = 180;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return rotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 )
|
||||||
|
meta += 8;
|
||||||
|
|
||||||
|
switch ( meta ) {
|
||||||
|
case 1:
|
||||||
|
return ExtendedTileType.RockD;
|
||||||
|
case 2:
|
||||||
|
return ExtendedTileType.RockL;
|
||||||
|
case 3:
|
||||||
|
return ExtendedTileType.RockLD;
|
||||||
|
case 4:
|
||||||
|
return ExtendedTileType.RockU;
|
||||||
|
case 5:
|
||||||
|
return ExtendedTileType.RockUD;
|
||||||
|
case 6:
|
||||||
|
return ExtendedTileType.RockLU;
|
||||||
|
case 7:
|
||||||
|
return ExtendedTileType.RockLUD;
|
||||||
|
case 8:
|
||||||
|
return ExtendedTileType.RockR;
|
||||||
|
case 9:
|
||||||
|
return ExtendedTileType.RockRD;
|
||||||
|
case 10:
|
||||||
|
return ExtendedTileType.RockLR;
|
||||||
|
case 11:
|
||||||
|
return ExtendedTileType.RockLRD;
|
||||||
|
case 12:
|
||||||
|
return ExtendedTileType.RockUR;
|
||||||
|
case 13:
|
||||||
|
return ExtendedTileType.RockURD;
|
||||||
|
case 14:
|
||||||
|
return ExtendedTileType.RockLUR;
|
||||||
|
case 15:
|
||||||
|
return ExtendedTileType.RockLURD;
|
||||||
|
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;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vector2Int GetDirectionVector(GenTile.Position p) {
|
||||||
|
switch ( p ) {
|
||||||
|
case GenTile.Position.TOP:
|
||||||
|
return new Vector2Int(0, 1);
|
||||||
|
case GenTile.Position.LEFT:
|
||||||
|
return new Vector2Int(-1, 0);
|
||||||
|
case GenTile.Position.RIGHT:
|
||||||
|
return new Vector2Int(1, 0);
|
||||||
|
case GenTile.Position.BOTTOM:
|
||||||
|
return new Vector2Int(0, -1);
|
||||||
|
default:
|
||||||
|
return new Vector2Int();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ExtendedTileType GetRandomGroundType() {
|
||||||
|
int num = ( int ) ( UnityEngine.Random.value * 4 );
|
||||||
|
switch ( num ) {
|
||||||
|
case 0:
|
||||||
|
return ExtendedTileType.Ground0;
|
||||||
|
case 1:
|
||||||
|
return ExtendedTileType.Ground1;
|
||||||
|
case 2:
|
||||||
|
return ExtendedTileType.Ground2;
|
||||||
|
default:
|
||||||
|
return ExtendedTileType.Ground3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,14 +31,6 @@ public class StartObjective : Objective {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the created Player object. Call this after <see cref="ActivateGoal(Player)"/> !
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Player</returns>
|
|
||||||
public Player GetPlayer() {
|
|
||||||
return player;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Code executed if the goal is reached eg. opening doors.
|
/// Code executed if the goal is reached eg. opening doors.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -12,8 +12,8 @@ PlayerSettings:
|
||||||
targetDevice: 2
|
targetDevice: 2
|
||||||
useOnDemandResources: 0
|
useOnDemandResources: 0
|
||||||
accelerometerFrequency: 60
|
accelerometerFrequency: 60
|
||||||
companyName: DefaultCompany
|
companyName: Bildschirmflausch
|
||||||
productName: New Unity Project
|
productName: Dungeon Drifter
|
||||||
defaultCursor: {fileID: 0}
|
defaultCursor: {fileID: 0}
|
||||||
cursorHotspot: {x: 0, y: 0}
|
cursorHotspot: {x: 0, y: 0}
|
||||||
m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}
|
m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}
|
||||||
|
@ -543,7 +543,7 @@ PlayerSettings:
|
||||||
splashScreenBackgroundSourceLandscape: {fileID: 0}
|
splashScreenBackgroundSourceLandscape: {fileID: 0}
|
||||||
splashScreenBackgroundSourcePortrait: {fileID: 0}
|
splashScreenBackgroundSourcePortrait: {fileID: 0}
|
||||||
spritePackerPolicy:
|
spritePackerPolicy:
|
||||||
webGLMemorySize: 256
|
webGLMemorySize: 512
|
||||||
webGLExceptionSupport: 1
|
webGLExceptionSupport: 1
|
||||||
webGLNameFilesAsHashes: 0
|
webGLNameFilesAsHashes: 0
|
||||||
webGLDataCaching: 0
|
webGLDataCaching: 0
|
||||||
|
|
Loading…
Add table
Reference in a new issue