diff --git a/Assets/Scripts/CameraController.cs b/Assets/Scripts/CameraController.cs index 9a89c51..ba88ebb 100644 --- a/Assets/Scripts/CameraController.cs +++ b/Assets/Scripts/CameraController.cs @@ -34,12 +34,7 @@ public void SetFollowedPlayer(GameObject player) transform.position = player.transform.position - (Distance * direction); }; } - - void Awake() - { - this.SetFollowedPlayer(gameObject); - } - + void LateUpdate() { updateStrategy(); diff --git a/Assets/Scripts/LevelController.cs b/Assets/Scripts/LevelController.cs index f01b3d2..a7f78f1 100644 --- a/Assets/Scripts/LevelController.cs +++ b/Assets/Scripts/LevelController.cs @@ -40,9 +40,10 @@ public void GenerateNext() float nextSpawnZ = spawnPosition.position.z; float nextSpawnX = spawnPosition.position.x; FloorInfo floorInfo; - for (int i = 0; i < depth; i++) + GameObject prefab = (GameObject)Resources.Load("Prefabs/Floor1", typeof(GameObject)); + int i = 0; + for (; i < depth; i++) { - GameObject prefab = (GameObject)Resources.Load("Prefabs/Floor1", typeof(GameObject)); nextLevel = Instantiate(prefab, new Vector3(nextSpawnX, -YDISTANCE * (i + 1), nextSpawnZ), prefab.transform.rotation); floorInfo = nextLevel.GetComponent(); int direction = random.Next(1, 4); @@ -67,6 +68,8 @@ public void GenerateNext() floorInfo.DoorWest.SetActive(false); } } + + nextLevel = Instantiate(prefab, new Vector3(nextSpawnX, -YDISTANCE * (i + 1), nextSpawnZ), prefab.transform.rotation); } void Awake() diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index 9e124d6..d791814 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -21,7 +21,7 @@ void Start() } // Update is called once per frame - void FixedUpdate() + void Update() { ApplyMovement(); if (!isAttacking)