1
0
Fork 0

Generation integration Part 1

Fix Texture Unit size
Added Root tags
Fixed NullPointers
Todo: 
- Fix sprite rotation
- Fix processing of hallways
- Put doors in their own root GameObject
This commit is contained in:
Saibotk 2018-04-22 17:52:20 +02:00
parent 18c711d2c6
commit e35c70e002
14 changed files with 372 additions and 21 deletions

View file

@ -1178,7 +1178,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
gameOverPanel: {fileID: 354516592} gameOverPanel: {fileID: 354516592}
healthcontroller: {fileID: 0} healthcontroller: {fileID: 623293249}
--- !u!4 &1487324258 --- !u!4 &1487324258
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1353,3 +1353,4 @@ MonoBehaviour:
cam: {fileID: 881384367} cam: {fileID: 881384367}
playerPrefab: {fileID: 1679161327080020, guid: 3d1911457c1e44f53b6b4044334db52f, playerPrefab: {fileID: 1679161327080020, guid: 3d1911457c1e44f53b6b4044334db52f,
type: 2} type: 2}
mapRoot: {fileID: 1624368723}

View file

@ -154,9 +154,13 @@ public class GameController : MonoBehaviour {
dg.Generate(); dg.Generate();
GameObject goStart = gp.ProcessRoom(dg.start.tiles); GameObject goStart = gp.ProcessRoom(dg.start.tiles);
start = goStart.AddComponent<Room>(); start = goStart.AddComponent<Room>();
//start.SetDoorsRootObject(new List<Transform>(goStart.GetComponentsInChildren<Transform>()).Find(x => x.tag == "DoorRoot").gameObject);
start.Reload();
start.transform.SetParent(mapRoot.transform); start.transform.SetParent(mapRoot.transform);
GameObject goFinish = gp.ProcessRoom(dg.end.tiles); GameObject goFinish = gp.ProcessRoom(dg.end.tiles);
finish = goFinish.AddComponent<Room>(); finish = goFinish.AddComponent<Room>();
//finish.SetDoorsRootObject(new List<Transform>(goFinish.GetComponentsInChildren<Transform>()).Find(x => x.tag == "DoorRoot").gameObject);
finish.Reload();
finish.transform.SetParent(mapRoot.transform); finish.transform.SetParent(mapRoot.transform);
foreach (GenRoom gr in dg.rooms) { foreach (GenRoom gr in dg.rooms) {
GameObject groom = gp.ProcessRoom(gr.tiles); GameObject groom = gp.ProcessRoom(gr.tiles);
@ -170,7 +174,8 @@ public class GameController : MonoBehaviour {
start.SetObjective(goal); start.SetObjective(goal);
start.OnPlayerEnter(player); start.OnPlayerEnter(player);
player = goal.GetPlayer(); player = goal.GetPlayer();
cam.GetComponent<CameraControl>().SetFollow(player.gameObject); if(player != null)
cam.GetComponent<CameraControl>().SetFollow(player.gameObject);
} }
private void Running() { private void Running() {

View file

@ -19,7 +19,8 @@ public class StartObjective : Objective {
/// Handle activation code for a goal. /// Handle activation code for a goal.
/// </summary> /// </summary>
/// <param name="ply">Player is ignored </param> /// <param name="ply">Player is ignored </param>
public override void ActivateGoal(Player player=null) { public override void ActivateGoal(Player player) {
Debug.Log(room == null);
if ( room.GetSpawnpoints().Count > 0 ) { if ( room.GetSpawnpoints().Count > 0 ) {
GameObject ply = GameObject.Instantiate(playerPrefab); GameObject ply = GameObject.Instantiate(playerPrefab);
ply.transform.position = room.GetSpawnpoints()[0].position; ply.transform.position = room.GetSpawnpoints()[0].position;
@ -33,6 +34,7 @@ public class StartObjective : Objective {
/// </summary> /// </summary>
/// <returns>Player</returns> /// <returns>Player</returns>
public Player GetPlayer() { public Player GetPlayer() {
Debug.Log(player == null);
return player; return player;
} }

View file

@ -22,17 +22,61 @@ public class Room : MonoBehaviour {
// Use this for initialization // Use this for initialization
void Start() { void Start() {
doors = new List<Door>(); doors = new List<Door>();
foreach ( Door d in doorsRootObject.GetComponentsInChildren<Door>() ) { if ( doorsRootObject != null ) {
doors.Add(d); foreach ( Door d in doorsRootObject.GetComponentsInChildren<Door>() ) {
} doors.Add(d);
Debug.Log("[ROOMS] Doors: " + doors.Count);
spawnpoints = new List<Transform>();
foreach ( Transform t in spawnpointRootObject.GetComponentsInChildren<Transform>() ) {
if ( t.gameObject != spawnpointRootObject ) {
spawnpoints.Add(t);
} }
Debug.Log("[ROOMS] Doors: " + doors.Count);
} }
Debug.Log("[ROOMS] Spawnpoints: " + spawnpoints.Count);
spawnpoints = new List<Transform>();
if ( spawnpointRootObject != null ) {
foreach ( Transform t in spawnpointRootObject.GetComponentsInChildren<Transform>() ) {
if ( t.gameObject != spawnpointRootObject ) {
spawnpoints.Add(t);
}
}
Debug.Log("[ROOMS] Spawnpoints: " + spawnpoints.Count);
}
}
/// <summary>
/// Reloads the spawnpoints and doors.
/// </summary>
public void Reload() {
doors = new List<Door>();
if ( doorsRootObject != null ) {
foreach ( Door d in doorsRootObject.GetComponentsInChildren<Door>() ) {
doors.Add(d);
}
Debug.Log("[ROOMS] Doors: " + doors.Count);
}
spawnpoints = new List<Transform>();
if ( spawnpointRootObject != null ) {
foreach ( Transform t in spawnpointRootObject.GetComponentsInChildren<Transform>() ) {
if ( t.gameObject != spawnpointRootObject ) {
spawnpoints.Add(t);
}
}
Debug.Log("[ROOMS] Spawnpoints: " + spawnpoints.Count);
}
}
/// <summary>
/// Sets the doors root object.
/// </summary>
/// <param name="go"></param>
public void SetDoorsRootObject(GameObject go) {
doorsRootObject = go;
}
/// <summary>
/// Sets the spawnpoints root object.
/// </summary>
/// <param name="go"></param>
public void SetSpawnPointsRootObject(GameObject go) {
spawnpointRootObject = go;
} }
/// <summary> /// <summary>

View file

@ -43,7 +43,7 @@ TextureImporter:
spriteMeshType: 1 spriteMeshType: 1
alignment: 0 alignment: 0
spritePivot: {x: 0.5, y: 0.5} spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100 spritePixelsToUnits: 1000
spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1 spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1 alphaUsage: 1
@ -67,6 +67,39 @@ TextureImporter:
allowsAlphaSplitting: 0 allowsAlphaSplitting: 0
overridden: 0 overridden: 0
androidETC2FallbackOverride: 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: spriteSheet:
serializedVersion: 2 serializedVersion: 2
sprites: [] sprites: []

View file

@ -43,7 +43,7 @@ TextureImporter:
spriteMeshType: 1 spriteMeshType: 1
alignment: 0 alignment: 0
spritePivot: {x: 0.5, y: 0.5} spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100 spritePixelsToUnits: 1000
spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1 spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1 alphaUsage: 1
@ -67,6 +67,39 @@ TextureImporter:
allowsAlphaSplitting: 0 allowsAlphaSplitting: 0
overridden: 0 overridden: 0
androidETC2FallbackOverride: 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: spriteSheet:
serializedVersion: 2 serializedVersion: 2
sprites: [] sprites: []

View file

@ -43,7 +43,7 @@ TextureImporter:
spriteMeshType: 1 spriteMeshType: 1
alignment: 0 alignment: 0
spritePivot: {x: 0.5, y: 0.5} spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100 spritePixelsToUnits: 1000
spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1 spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1 alphaUsage: 1
@ -67,6 +67,39 @@ TextureImporter:
allowsAlphaSplitting: 0 allowsAlphaSplitting: 0
overridden: 0 overridden: 0
androidETC2FallbackOverride: 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: spriteSheet:
serializedVersion: 2 serializedVersion: 2
sprites: [] sprites: []

View file

@ -43,7 +43,7 @@ TextureImporter:
spriteMeshType: 1 spriteMeshType: 1
alignment: 0 alignment: 0
spritePivot: {x: 0.5, y: 0.5} spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100 spritePixelsToUnits: 1000
spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1 spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1 alphaUsage: 1
@ -67,6 +67,39 @@ TextureImporter:
allowsAlphaSplitting: 0 allowsAlphaSplitting: 0
overridden: 0 overridden: 0
androidETC2FallbackOverride: 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: spriteSheet:
serializedVersion: 2 serializedVersion: 2
sprites: [] sprites: []

View file

@ -43,7 +43,7 @@ TextureImporter:
spriteMeshType: 1 spriteMeshType: 1
alignment: 0 alignment: 0
spritePivot: {x: 0.5, y: 0.5} spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100 spritePixelsToUnits: 1000
spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1 spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1 alphaUsage: 1
@ -67,6 +67,39 @@ TextureImporter:
allowsAlphaSplitting: 0 allowsAlphaSplitting: 0
overridden: 0 overridden: 0
androidETC2FallbackOverride: 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: spriteSheet:
serializedVersion: 2 serializedVersion: 2
sprites: [] sprites: []

View file

@ -43,7 +43,7 @@ TextureImporter:
spriteMeshType: 1 spriteMeshType: 1
alignment: 0 alignment: 0
spritePivot: {x: 0.5, y: 0.5} spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100 spritePixelsToUnits: 1000
spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1 spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1 alphaUsage: 1
@ -67,6 +67,39 @@ TextureImporter:
allowsAlphaSplitting: 0 allowsAlphaSplitting: 0
overridden: 0 overridden: 0
androidETC2FallbackOverride: 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: spriteSheet:
serializedVersion: 2 serializedVersion: 2
sprites: [] sprites: []

View file

@ -43,7 +43,7 @@ TextureImporter:
spriteMeshType: 1 spriteMeshType: 1
alignment: 0 alignment: 0
spritePivot: {x: 0.5, y: 0.5} spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100 spritePixelsToUnits: 1000
spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1 spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1 alphaUsage: 1
@ -67,6 +67,39 @@ TextureImporter:
allowsAlphaSplitting: 0 allowsAlphaSplitting: 0
overridden: 0 overridden: 0
androidETC2FallbackOverride: 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: spriteSheet:
serializedVersion: 2 serializedVersion: 2
sprites: [] sprites: []

View file

@ -43,7 +43,7 @@ TextureImporter:
spriteMeshType: 1 spriteMeshType: 1
alignment: 0 alignment: 0
spritePivot: {x: 0.5, y: 0.5} spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100 spritePixelsToUnits: 1000
spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1 spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1 alphaUsage: 1
@ -67,6 +67,39 @@ TextureImporter:
allowsAlphaSplitting: 0 allowsAlphaSplitting: 0
overridden: 0 overridden: 0
androidETC2FallbackOverride: 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: spriteSheet:
serializedVersion: 2 serializedVersion: 2
sprites: [] sprites: []

View file

@ -43,7 +43,7 @@ TextureImporter:
spriteMeshType: 1 spriteMeshType: 1
alignment: 0 alignment: 0
spritePivot: {x: 0.5, y: 0.5} spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100 spritePixelsToUnits: 1000
spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1 spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1 alphaUsage: 1
@ -67,6 +67,39 @@ TextureImporter:
allowsAlphaSplitting: 0 allowsAlphaSplitting: 0
overridden: 0 overridden: 0
androidETC2FallbackOverride: 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: spriteSheet:
serializedVersion: 2 serializedVersion: 2
sprites: [] sprites: []

View file

@ -6,6 +6,8 @@ TagManager:
tags: tags:
- wall - wall
- door - door
- DoorRoot
- SpawnlistRoot
layers: layers:
- Default - Default
- TransparentFX - TransparentFX