From b8c4567189d2d4f49d0331858519ac6455e1eb3d Mon Sep 17 00:00:00 2001 From: Mikkel Bybjerg Date: Sat, 27 Apr 2019 04:24:12 +0200 Subject: better dragon particle effects --- nGJ2019/Assets/Scripts/DragonMovement.cs | 49 +++++++++++++++++++------------- 1 file changed, 30 insertions(+), 19 deletions(-) (limited to 'nGJ2019/Assets/Scripts/DragonMovement.cs') diff --git a/nGJ2019/Assets/Scripts/DragonMovement.cs b/nGJ2019/Assets/Scripts/DragonMovement.cs index 67f5cde..64d7f21 100644 --- a/nGJ2019/Assets/Scripts/DragonMovement.cs +++ b/nGJ2019/Assets/Scripts/DragonMovement.cs @@ -89,7 +89,7 @@ public class DragonMovement : MonoBehaviour { while(state == State.normal && swarm.Noise > 0) { - swarm.Noise -= 0.08f; + swarm.Noise -= 0.12f; yield return new WaitForSeconds(0.01f); } if(state == State.normal) @@ -125,21 +125,32 @@ public class DragonMovement : MonoBehaviour StartCoroutine("transformSpread"); } - private void turnNormal() + private void turnAntiSwirl() { - State prev = state; - state = State.normal; - if(prev == State.swirl) + if(state == State.swirl) { + state = State.normal; turnVisible(true); swarm.activate(false); } - - if(prev == State.slim) + } + + private void turnAntiSlim() + { + if(state == State.slim) + { + state = State.normal; StartCoroutine("transformAntiSlim"); - - if(prev == State.spread) + } + } + + private void turnAntiSpread() + { + if(state == State.spread) + { + state = State.normal; StartCoroutine("transformAntiSpread"); + } } private void resetTurn() @@ -151,7 +162,7 @@ public class DragonMovement : MonoBehaviour void Start() { swarm = GetComponent(); - swarm.activate(true); + swarm.activate(false); } void Update() @@ -165,20 +176,20 @@ public class DragonMovement : MonoBehaviour if(Input.GetKey("d")) moveRight(); - if(Input.GetKeyDown("r")) + if(Input.GetKeyDown("i")) turnSwirl(); - if(Input.GetKeyUp("r")) - turnNormal(); + if(Input.GetKeyUp("i")) + turnAntiSwirl(); - if(Input.GetKeyDown("f")) + if(Input.GetKeyDown("j")) turnSlim(); - if(Input.GetKeyUp("f")) - turnNormal(); + if(Input.GetKeyUp("j")) + turnAntiSlim(); - if(Input.GetKeyDown("e")) + if(Input.GetKeyDown("k")) turnSpread(); - if(Input.GetKeyUp("e")) - turnNormal(); + if(Input.GetKeyUp("k")) + turnAntiSpread(); } void OnDrawGizmosSelected() -- cgit v1.2.3