diff options
Diffstat (limited to 'nGJ2019/Assets/Scripts')
-rw-r--r-- | nGJ2019/Assets/Scripts/DragonMovement.cs | 10 | ||||
-rw-r--r-- | nGJ2019/Assets/Scripts/SwarmSystem.cs | 7 |
2 files changed, 11 insertions, 6 deletions
diff --git a/nGJ2019/Assets/Scripts/DragonMovement.cs b/nGJ2019/Assets/Scripts/DragonMovement.cs index 64d7f21..04f1c3a 100644 --- a/nGJ2019/Assets/Scripts/DragonMovement.cs +++ b/nGJ2019/Assets/Scripts/DragonMovement.cs @@ -55,9 +55,9 @@ public class DragonMovement : MonoBehaviour private IEnumerator transformSlim() { - while(state == State.slim && transform.localScale.y > 0.2f) + while(state == State.slim && swarm.Collapse < 0.8f) { - transform.localScale = new Vector3(transform.localScale.x, transform.localScale.y-0.03f, transform.localScale.z-0.03f); + swarm.Collapse += 0.05f; yield return new WaitForSeconds(0.01f); } } @@ -73,9 +73,9 @@ public class DragonMovement : MonoBehaviour private IEnumerator transformAntiSlim() { - while(state == State.normal && transform.localScale.y < 1) + while(state == State.normal && swarm.Collapse > 0) { - transform.localScale = new Vector3(transform.localScale.x, transform.localScale.y+0.05f, transform.localScale.z+0.05f); + swarm.Collapse -= 0.07f; yield return new WaitForSeconds(0.01f); } if(state == State.normal) @@ -155,7 +155,7 @@ public class DragonMovement : MonoBehaviour private void resetTurn() { - transform.localScale = Vector3.one; + swarm.Collapse = 0; swarm.Noise = 0; } diff --git a/nGJ2019/Assets/Scripts/SwarmSystem.cs b/nGJ2019/Assets/Scripts/SwarmSystem.cs index 9f19dd0..9658a92 100644 --- a/nGJ2019/Assets/Scripts/SwarmSystem.cs +++ b/nGJ2019/Assets/Scripts/SwarmSystem.cs @@ -26,6 +26,7 @@ public class SwarmSystem : MonoBehaviour private List<List<int>> triGraph; public float Noise {get; set;} + public float Collapse {get; set;} private Mesh getCurrentMesh() { @@ -365,11 +366,15 @@ public class SwarmSystem : MonoBehaviour Vector3 boneCenter = findBoneCenter(u, out boneDirec); - anchors[u].position = boneCenter + (Quaternion.AngleAxis(1f, boneDirec) * (anchors[u].position - boneCenter)); + anchors[u].position = boneCenter + (Quaternion.AngleAxis(3f, boneDirec) * (anchors[u].position - boneCenter)); anchors[u].position = meshIntersection(u, vertices, triangles, boneCenter); unit.position = anchors[u].position + Noise*noiseDirecs[u]; + + Vector3 collapsedPos = Vector3.Project(unit.position - transform.position, Vector3.right) + transform.position; + + unit.position = (1-Collapse)*unit.position + Collapse*collapsedPos; } } |