From eb8786a30a87b24ed81c9ed20d05d80defaeae45 Mon Sep 17 00:00:00 2001 From: Jan Date: Sat, 21 Apr 2018 16:24:58 +0200 Subject: [PATCH] add change of collision for door, moved player to prefab --- Assets/{ => Prefabs}/Player.prefab | 0 Assets/{ => Prefabs}/Player.prefab.meta | 0 Assets/Scripts/Door.cs | 7 ++++++- 3 files changed, 6 insertions(+), 1 deletion(-) rename Assets/{ => Prefabs}/Player.prefab (100%) rename Assets/{ => Prefabs}/Player.prefab.meta (100%) diff --git a/Assets/Player.prefab b/Assets/Prefabs/Player.prefab similarity index 100% rename from Assets/Player.prefab rename to Assets/Prefabs/Player.prefab diff --git a/Assets/Player.prefab.meta b/Assets/Prefabs/Player.prefab.meta similarity index 100% rename from Assets/Player.prefab.meta rename to Assets/Prefabs/Player.prefab.meta diff --git a/Assets/Scripts/Door.cs b/Assets/Scripts/Door.cs index 2e7c241..5a5769a 100644 --- a/Assets/Scripts/Door.cs +++ b/Assets/Scripts/Door.cs @@ -4,19 +4,24 @@ using UnityEngine; public class Door : MonoBehaviour { private bool locked = false; + + BoxCollider2D boundingBox; // Use this for initialization void Start () { - locked = false; + boundingBox = GetComponent(); + Unlock(); } public void Lock() { locked = true; + boundingBox.enabled = true; } public void Unlock() { locked = false; + boundingBox.enabled = false; } public bool IsLocked()