From c8ccda6d3762912a634fafe36e9976e2999741cc Mon Sep 17 00:00:00 2001 From: Piegames <14054505+piegamesde@users.noreply.github.com> Date: Tue, 24 Apr 2018 00:38:31 +0200 Subject: [PATCH] Tweaks and fixes --- Assets/Scripts/Generation/DungeonGenerator.cs | 1 + Assets/Scripts/Objectives/EntityObjective.cs | 10 ++++++++-- Assets/Scripts/PlayerMovement.cs | 3 +-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/Generation/DungeonGenerator.cs b/Assets/Scripts/Generation/DungeonGenerator.cs index f85bdef..5315ca7 100644 --- a/Assets/Scripts/Generation/DungeonGenerator.cs +++ b/Assets/Scripts/Generation/DungeonGenerator.cs @@ -204,6 +204,7 @@ public class DungeonGenerator { } start.spawnpoints.Add(start.GetCenter()); + end.spawnpoints.Add(start.GetCenter()); foreach (Vector2Int v in allDoors) { foreach (GenRoom r in rooms) { diff --git a/Assets/Scripts/Objectives/EntityObjective.cs b/Assets/Scripts/Objectives/EntityObjective.cs index 169d14d..51d6f6c 100644 --- a/Assets/Scripts/Objectives/EntityObjective.cs +++ b/Assets/Scripts/Objectives/EntityObjective.cs @@ -28,6 +28,13 @@ public class EntityObjective : Objective { if ( activated ) return; base.ActivateGoal(ply); + + List spawnPointList = room.GetSpawnpoints(); + if (spawnPointList.Count == 0) { + ReachedGoal(); + return; + } + foreach ( GameObject i in prefabList ) { Debug.Log("[ROOMS] Spawning Entity..."); if(i == null || player == null) { @@ -35,8 +42,7 @@ public class EntityObjective : Objective { return; } - GameObject tempObject = GameObject.Instantiate(i); - List spawnPointList = room.GetSpawnpoints(); + GameObject tempObject = UnityEngine.Object.Instantiate(i); tempObject.transform.position = spawnPointList[Random.Range(0, spawnPointList.Count)].position; tempObject.GetComponent().SetVictim(player.gameObject); tempObject.GetComponent().SetObjective(this); diff --git a/Assets/Scripts/PlayerMovement.cs b/Assets/Scripts/PlayerMovement.cs index bb569c1..c51e374 100644 --- a/Assets/Scripts/PlayerMovement.cs +++ b/Assets/Scripts/PlayerMovement.cs @@ -74,9 +74,8 @@ public class PlayerMovement : MonoBehaviour { brakeTime = maxBrakeTime; braking = false; } else if (!braking) { - brakeTime -= (Time.time - lastFrame) * 0.1f; + //brakeTime -= (Time.time - lastFrame) * 0.1f; } - Debug.Log(braking + " " + brakeTime); if (braking) { brakeTime += Time.time - lastFrame; GameController.instance.GetAudioControl().SfxStop(AudioControl.Sfx.driving);