From 35d8cdbd3c6d77ceaf73ac00d4a2876dcda6645f Mon Sep 17 00:00:00 2001 From: Mikkel Bybjerg Date: Sun, 28 Apr 2019 05:21:31 +0200 Subject: wiggle wiggle --- nGJ2019/Assets/Scripts/DragonMovement.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nGJ2019/Assets/Scripts/DragonMovement.cs b/nGJ2019/Assets/Scripts/DragonMovement.cs index 302a9e7..f0965a2 100644 --- a/nGJ2019/Assets/Scripts/DragonMovement.cs +++ b/nGJ2019/Assets/Scripts/DragonMovement.cs @@ -17,6 +17,8 @@ public class DragonMovement : MonoBehaviour public float horizontalBound = 6f; public float verticalBound = 4f; + private float slitherPhase = 0; + public HealthBar healthBar; private float hurtCooldown = 0; @@ -188,6 +190,16 @@ public class DragonMovement : MonoBehaviour if(transform.position.x > horizontalBound) transform.position = new Vector3(horizontalBound, transform.position.y, transform.position.z); + + slitherPhase += 0.1f; + foreach(Transform t in swarm.meshRender.bones) + { + t.Translate(new Vector3(0, Mathf.Sin(t.position.x-transform.position.x+slitherPhase)*0.002f, 0), Space.World); + } + foreach(Renderer r in solids) + { + r.transform.Translate(new Vector3(0, Mathf.Sin(r.transform.position.x-transform.position.x+slitherPhase+0.2f)*-0.008f, 0), Space.World); + } } void Update() -- cgit v1.2.3