From 8ffc34f2d0a0f5c8dc9fdfc04609a1c633e21eff Mon Sep 17 00:00:00 2001 From: Piegames <14054505+piegamesde@users.noreply.github.com> Date: Mon, 23 Apr 2018 18:21:09 +0200 Subject: [PATCH 1/2] Little tweaks --- Assets/Scripts/Generation/DungeonGenerator.cs | 2 +- Assets/Scripts/PlayerMovement.cs | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/Generation/DungeonGenerator.cs b/Assets/Scripts/Generation/DungeonGenerator.cs index 80db011..63ae5b5 100644 --- a/Assets/Scripts/Generation/DungeonGenerator.cs +++ b/Assets/Scripts/Generation/DungeonGenerator.cs @@ -432,7 +432,7 @@ public class DungeonGenerator { r.tiles[pos].type = Room.TileType.ROCK; continue; } - float prob2 = 0.02f; + float prob2 = 0.04f; if (UnityEngine.Random.value > 1 - prob2) { r.spawnpoints.Add(pos); diff --git a/Assets/Scripts/PlayerMovement.cs b/Assets/Scripts/PlayerMovement.cs index 4989135..605ebb5 100644 --- a/Assets/Scripts/PlayerMovement.cs +++ b/Assets/Scripts/PlayerMovement.cs @@ -57,11 +57,20 @@ public class PlayerMovement : MonoBehaviour { //Debug.Log(br); Debug.DrawLine(transform.position, transform.position + br, Color.red, 0.01f, false); } - if ( Input.GetAxis("Horizontal") < 0 ) - rb.MoveRotation(rb.rotation + turnSpeed); //transform.Rotate(Vector3.forward * turnSpeed); - if ( Input.GetAxis("Horizontal") > 0 ) - rb.MoveRotation(rb.rotation - turnSpeed); + if (Input.GetAxis("Horizontal") < 0) + { + //rb.rotation += turnSpeed; + rb.MoveRotation(rb.rotation + turnSpeed); + } else + //transform.Rotate(Vector3.forward * turnSpeed); + if (Input.GetAxis("Horizontal") > 0) + { + //rb.rotation -= turnSpeed; + rb.MoveRotation(rb.rotation - turnSpeed); + } else { + rb.MoveRotation(rb.rotation); + } //transform.Rotate(Vector3.forward * -turnSpeed); // Debug lines Debug.DrawLine(transform.position, transform.position + speedVec, Color.magenta, 0.01f, false); From db72c6a7072d9c35cfe6968c2c8d6456c7687808 Mon Sep 17 00:00:00 2001 From: Piegames <14054505+piegamesde@users.noreply.github.com> Date: Mon, 23 Apr 2018 19:11:12 +0200 Subject: [PATCH 2/2] Kill Player on win --- Assets/Scenes/CodeDEV.unity | 2 +- Assets/Scripts/Entities/Player.cs | 2 +- Assets/Scripts/GameController.cs | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Assets/Scenes/CodeDEV.unity b/Assets/Scenes/CodeDEV.unity index e34dc74..21c0de8 100644 --- a/Assets/Scenes/CodeDEV.unity +++ b/Assets/Scenes/CodeDEV.unity @@ -976,7 +976,7 @@ Prefab: - target: {fileID: 224150154901314796, guid: 460d856ea4eb14cedb5fecde1fe6d743, type: 2} propertyPath: m_AnchoredPosition.x - value: 65.89836 + value: 63.233368 objectReference: {fileID: 0} - target: {fileID: 224150154901314796, guid: 460d856ea4eb14cedb5fecde1fe6d743, type: 2} diff --git a/Assets/Scripts/Entities/Player.cs b/Assets/Scripts/Entities/Player.cs index 64309da..57a20b0 100644 --- a/Assets/Scripts/Entities/Player.cs +++ b/Assets/Scripts/Entities/Player.cs @@ -55,6 +55,6 @@ public class Player : Mob { protected override void Death() { Debug.Log("Player died..."); Destroy(this.gameObject); - GameController.instance.ChangeState(GameController.GameState.ENDED); + GameController.instance.EndGame(GameController.EndedCause.DIED); } } diff --git a/Assets/Scripts/GameController.cs b/Assets/Scripts/GameController.cs index f125a51..239720f 100644 --- a/Assets/Scripts/GameController.cs +++ b/Assets/Scripts/GameController.cs @@ -300,7 +300,8 @@ public class GameController : MonoBehaviour { cam.GetComponent().GameOverBgm(); ui.GetComponent().ShowGameOverUI(); } else if(endCause == EndedCause.WIN) { - //cam.GetComponent().SfxPlay(2); + //cam.GetComponent().SfxPlay(2); + player.InflictDamage(int.MaxValue/2); ui.GetComponent().ShowWinUI(); } } else { @@ -325,6 +326,8 @@ public class GameController : MonoBehaviour { } public void EndGame(EndedCause cause) { + if (endCause != null && state == GameState.ENDED) + return; // Already ended game endCause = cause; ChangeState(GameState.ENDED); }