Closing rooms works now
This commit is contained in:
parent
3bf38b81e1
commit
dbc713b6c4
4 changed files with 26 additions and 5 deletions
|
@ -30,7 +30,7 @@ public class Door : MonoBehaviour {
|
||||||
public void SetParent(Room room) {
|
public void SetParent(Room room) {
|
||||||
this.parent = room;
|
this.parent = room;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Locks the door.
|
/// Locks the door.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -65,13 +65,15 @@ public class Door : MonoBehaviour {
|
||||||
/// <param name="collision"></param>
|
/// <param name="collision"></param>
|
||||||
private void OnTriggerExit2D(Collider2D collision) {
|
private void OnTriggerExit2D(Collider2D collision) {
|
||||||
if ( collision.tag == "Player") {
|
if ( collision.tag == "Player") {
|
||||||
// TODO better checks
|
Player player = collision.gameObject.GetComponent<Player>();
|
||||||
|
if ((boundingBox.offset - parent.GetCenter()).sqrMagnitude < ((Vector2) player.transform.position - parent.GetCenter()).sqrMagnitude)
|
||||||
|
return;
|
||||||
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!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
parent.OnPlayerEnter(collision.gameObject.GetComponent<Player>());
|
parent.OnPlayerEnter(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,8 +122,11 @@ public class GameController : MonoBehaviour {
|
||||||
{ GenerationProcessor.ExtendedTileType.RockLUD, RockLUD },
|
{ GenerationProcessor.ExtendedTileType.RockLUD, RockLUD },
|
||||||
{ GenerationProcessor.ExtendedTileType.RockLUR, RockLUR },
|
{ GenerationProcessor.ExtendedTileType.RockLUR, RockLUR },
|
||||||
{ GenerationProcessor.ExtendedTileType.RockURD, RockURD },
|
{ GenerationProcessor.ExtendedTileType.RockURD, RockURD },
|
||||||
{ GenerationProcessor.ExtendedTileType.RockLRD, RockLRD },
|
{ GenerationProcessor.ExtendedTileType.RockLRD, RockLRD },
|
||||||
{ GenerationProcessor.ExtendedTileType.Ground, Ground },
|
{ GenerationProcessor.ExtendedTileType.Ground0, Ground0 },
|
||||||
|
{ GenerationProcessor.ExtendedTileType.Ground1, Ground1 },
|
||||||
|
{ GenerationProcessor.ExtendedTileType.Ground2, Ground2 },
|
||||||
|
{ GenerationProcessor.ExtendedTileType.Ground3, Ground3 },
|
||||||
{ GenerationProcessor.ExtendedTileType.DoorInner, DoorInner },
|
{ GenerationProcessor.ExtendedTileType.DoorInner, DoorInner },
|
||||||
{ GenerationProcessor.ExtendedTileType.DoorOuter, DoorOuter }
|
{ GenerationProcessor.ExtendedTileType.DoorOuter, DoorOuter }
|
||||||
};
|
};
|
||||||
|
|
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