From b836408d4b3d913b0ccd1191ef470aaa976b5c81 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Wed, 13 Sep 2017 02:05:44 +0300 Subject: [PATCH 01/34] AnimationManager uses bar numbers instead of regions to follow music. Titles are being redesigned. --- Assets/Scripts/AnimationManager.cs | 300 +++++++++++++++-------------- Assets/Scripts/Mover.cs | 32 ++- Assets/Scripts/Titles.cs | 20 +- 3 files changed, 203 insertions(+), 149 deletions(-) diff --git a/Assets/Scripts/AnimationManager.cs b/Assets/Scripts/AnimationManager.cs index c30e23d..ae61121 100644 --- a/Assets/Scripts/AnimationManager.cs +++ b/Assets/Scripts/AnimationManager.cs @@ -25,17 +25,20 @@ public class AnimationManager : MonoBehaviour [SerializeField] Transform planetesimalPrefab; - public static Title openingTitles; - public static Title openingTitlesWide; - public static Title partOneTitles; - public static Title partOneTitlesWide; + public static Title openingTitlesMusic; + public static Title openingTitlesBy; + public static Title openingTitlesComposer; + public static Title partOneTitlesPartNumber; + public static Title partOneTitlesPartName; public Transform newSun; [NonSerialized] public Transform sun; - int currentBar = 0; + float alignY = 0; + + int animationCurrentBar = 0; int currentRegion = 0; Gravity gravity; @@ -44,34 +47,34 @@ public class AnimationManager : MonoBehaviour void Start() { - openingTitles = new Title(new Word[] { - new Word(new Vector3(-62f, 15f, -8.4f), 5, 5, 2, 2, 2, 1.1f, "GUNEY"), - new Word(new Vector3(10f, 15f, -8.4f), 5, 5, 2, 2, 2, 1.1f, "OZSAN"), - new Word(new Vector3(-50f, 0f, -8.4f), 5, 5, 2, 2, 2, 1.1f, "OUT"), - new Word(new Vector3(-2f, 0f, -8.4f), 5, 5, 2, 2, 2, 1.1f, "THERE") + openingTitlesMusic = new Title(new Word[] { + new Word(new Vector3(-55f, 17f, -8.4f), 5, 5, 2, 2, 2, 1.3f, "OUT"), + new Word(new Vector3(-2f, 17f, -8.4f), 5, 5, 2, 2, 2, 1.3f, "THERE"), + }); + + openingTitlesBy = new Title(new Word[] { + new Word(new Vector3(-11f, 7f, -8.4f), 5, 5, 2, 2, 2, 1.3f, "BY"), }); - openingTitlesWide = new Title(new Word[] { - new Word(new Vector3(-66f, 15f, -8.4f), 5, 5, 2, 2, 2, 1.5f, "GUNEY"), - new Word(new Vector3(6f, 15f, -8.4f), 5, 5, 2, 2, 2, 1.5f, "OZSAN"), - new Word(new Vector3(-54f, 0f, -8.4f), 5, 5, 2, 2, 2, 1.5f, "OUT"), - new Word(new Vector3(-6f, 0f, -8.4f), 5, 5, 2, 2, 2, 1.5f, "THERE") + openingTitlesComposer = new Title(new Word[] { + new Word(new Vector3(-66f, 7f, -8.4f), 5, 5, 2, 2, 2, 1.3f, "GUNEY"), + new Word(new Vector3(8f, 7f, -8.4f), 5, 5, 2, 2, 2, 1.3f, "OZSAN"), }); - partOneTitles = new Title(new Word[] { - new Word(new Vector3(-35f, 15f, -8.4f), 5, 5, 2, 2, 2, 1.1f, "PART I"), - new Word(new Vector3(-30f, 0f, -8.4f), 5, 5, 2, 2, 2, 1.1f, "PROBE"), + partOneTitlesPartNumber = new Title(new Word[] { + new Word(new Vector3(0f, 15f, -8.4f), 5, 5, 2, 2, 2, 1.1f, "PART I"), }); - partOneTitlesWide = new Title(new Word[] { - new Word(new Vector3(-39f, 15f, -8.4f), 5, 5, 2, 2, 2, 1.5f, "PART I"), - new Word(new Vector3(-34f, 0f, -8.4f), 5, 5, 2, 2, 2, 1.5f, "PROBE"), + partOneTitlesPartName = new Title(new Word[] { + new Word(new Vector3(0f, 0f, -8.4f), 5, 5, 2, 2, 2, 1.5f, "PROBE"), }); Transform gravityTarget = GetComponent().sun; Transform planetesimalParent = new GameObject("Planetesimals").transform; - int cubeSideLength = MathUtility.ClosestCubeRoot(openingTitles.ParticleCount, true); + //int cubeSideLength = MathUtility.ClosestCubeRoot(openingTitlesBy.ParticleCount, true); + int cubeSideLength = MathUtility.ClosestCubeRoot(896, true); + float particlePadding = 1f; float alignmentAdjustment = cubeSideLength / 2; @@ -86,150 +89,165 @@ void Start() for (int k = 0; k < cubeSideLength; k++) { float z = k * particlePadding - alignmentAdjustment; - - Space.planetesimals.Add(new Planetesimal(Instantiate(planetesimalPrefab, new Vector3(x, y, z), Quaternion.identity, planetesimalParent))); + Space.planetesimals.Add(new Planetesimal(Instantiate(planetesimalPrefab, new Vector3(x, y + alignY, z), Quaternion.identity, planetesimalParent))); } } } - - //for (int i = 0; i < openingTitles.Length; i++) - //{ - // int particlesPerSlot = openingTitles[i].HorizontalParticlesPerSlot * openingTitles[i].VerticalParticlesPerSlot; - // for (int j = 0; j < openingTitles[i].Length; j++) - // { - // openingTitleParticleCount += particlesPerSlot * openingTitles[i][j].OccupiedSlotsCount; - // } - - - // float rowLength = openingTitles[i].Code.Length / openingTitles[i].VerticalParticleSlotsPerLetter; - // float slotPadding = openingTitles[i].SlotPadding; - // int horizontalParticleSlotsPerLetter = openingTitles[i].HorizontalParticleSlotsPerLetter; - - // for (int j = 0; j < openingTitles[i].Code.Length; j++) - // { - // if (openingTitles[i].Code[j].ToString() != " ") - // { - // float currentRow = Mathf.FloorToInt(j / rowLength); - // float y = -1 * slotPadding * currentRow; - - // // Puts space between letters - // float letterPadding = slotPadding * (j / horizontalParticleSlotsPerLetter); - - // // Because the word is coded as a single string, this offsets each line of particle slots back to paragraph indent. - // float offsetLineToParagraphIndent = -1 * currentRow * slotPadding * (rowLength + rowLength / horizontalParticleSlotsPerLetter); - - // float x = slotPadding * j + letterPadding + offsetLineToParagraphIndent; - - // for (int k = 0; k < openingTitles[i].HorizontalParticlesPerSlot; k++) - // { - // for (int l = 0; l < openingTitles[i].VerticalParticlesPerSlot; l++) - // { - // planetesimal = Instantiate(planetesimalPrefab, openingTitles[i].Location + new Vector3(x + k * openingTitles[i].ParticlePadding, y - l * openingTitles[i].ParticlePadding, 0), Quaternion.identity, planetesimalParent); - // planetesimal.GetComponent().SetTarget(gravityTarget); - // planetesimal.tag = "Planet"; - // } - // } - // } - // } - //} - } void Update() { - if (Sequencer.CurrentRegionId == 2) + switch (Sequencer.CurrentBar) { - if (currentRegion != Sequencer.CurrentRegionId) - { - currentRegion = Sequencer.CurrentRegionId; + case 4: + if (animationCurrentBar != Sequencer.CurrentBar) + { + currentRegion = Sequencer.CurrentRegionId; - sun = Instantiate(newSun, new Vector3(0, 0, 0), Quaternion.identity); - sun.localScale = new Vector3(5, 5, 5); - sun.tag = "Sun"; + sun = Instantiate(newSun, new Vector3(0, alignY, 0), Quaternion.identity); + sun.localScale = new Vector3(5, 5, 5); + sun.tag = "Sun"; #if UNITY_EDITOR - sun.name = "PyramidSun"; + sun.name = "PyramidSun"; #endif - } - - if (currentBar != Sequencer.CurrentBar) - { - currentBar = Sequencer.CurrentBar; - } - } - else if (Sequencer.CurrentRegionId == 4) - { - if (currentRegion != Sequencer.CurrentRegionId) - { - currentRegion = Sequencer.CurrentRegionId; - Title.FormTitle(openingTitles, 18.70125f); - } + Title.FormTitle(openingTitlesMusic, 4f, 0.018f); + } + break; - if (Sequencer.CurrentBar == 14 && currentBar != 14) - { - Title.FormTitle(openingTitlesWide, 6.33f); - } + case 8: + if (animationCurrentBar != Sequencer.CurrentBar) + { + Title.DistributeTitle(openingTitlesMusic, 10, 8, 0.018f); + } + break; - if (currentBar != Sequencer.CurrentBar) - { - currentBar = Sequencer.CurrentBar; - } - } - else if (Sequencer.CurrentRegionId == 5) - { - if (currentRegion != Sequencer.CurrentRegionId) - { - currentRegion = Sequencer.CurrentRegionId; - Title.SetPlanetesimalsFree(); - } + case 110: + if (animationCurrentBar != Sequencer.CurrentBar) + { + Title.FormTitle(openingTitlesBy, 4f, 0.018f); + } + break; - if (Sequencer.CurrentBar == 18 && currentBar != 18) - { - Title.FormTitle(partOneTitles, 12.4675f); - } - else if (Sequencer.CurrentBar == 22 && currentBar != 22) - { - Title.FormTitle(partOneTitlesWide, 6.33f); - } - else if (Sequencer.CurrentBar == 24 && currentBar != 24) - { - Title.SetPlanetesimalsFree(); - } + case 112: + if (animationCurrentBar != Sequencer.CurrentBar) + { + Title.SetPlanetesimalsFree(); + Title.FormTitle(openingTitlesComposer, 4f, 0.018f); + } + break; - if (currentBar != Sequencer.CurrentBar) - { - currentBar = Sequencer.CurrentBar; - } - } - else if (Sequencer.CurrentRegionId >= 6 && Sequencer.CurrentRegionId <= 8 && currentBar != Sequencer.CurrentBar) - { - currentRegion = Sequencer.CurrentRegionId; - SwitchAnimation(0, -300, 0); - currentBar = Sequencer.CurrentBar; - } - else if (Sequencer.CurrentRegionId >= 10 && Sequencer.CurrentRegionId <= 24 && currentBar != Sequencer.CurrentBar) - { - currentRegion = Sequencer.CurrentRegionId; - SwitchAnimation(1, -300, 0); - currentBar = Sequencer.CurrentBar; + case 116: + if (animationCurrentBar != Sequencer.CurrentBar) + { + Title.SetPlanetesimalsFree(); + Title.FormTitle(partOneTitlesPartNumber, 4f, 0.018f); + } + break; } - else if (Sequencer.CurrentRegionId == 9 || Sequencer.CurrentRegionId == 25) + + if (animationCurrentBar != Sequencer.CurrentBar) { - currentRegion = Sequencer.CurrentRegionId; - TurnOffAnimation(0); - currentBar = Sequencer.CurrentBar; - sun.GetComponent().enabled = false; - sun.GetComponent().enabled = false; - sun.GetComponent().localScale = Vector3.Lerp(sun.GetComponent().localScale, new Vector3(0.1f, 0.1f, 0.1f), Time.deltaTime); + animationCurrentBar = Sequencer.CurrentBar; } - } + //------------------------ + +// if (Sequencer.CurrentRegionId == 2) +// { +// if (currentRegion != Sequencer.CurrentRegionId) +// { +// currentRegion = Sequencer.CurrentRegionId; + +// sun = Instantiate(newSun, new Vector3(0, 0, 0), Quaternion.identity); +// sun.localScale = new Vector3(5, 5, 5); +// sun.tag = "Sun"; +//#if UNITY_EDITOR +// sun.name = "PyramidSun"; +//#endif +// } + +// if (Sequencer.CurrentBar == 6 && currentBar != 6) +// { +// Title.FormTitle(openingTitlesName , 7f, 0.05f); +// } + +// if (currentBar != Sequencer.CurrentBar) +// { +// currentBar = Sequencer.CurrentBar; +// } +// } +// else if (Sequencer.CurrentRegionId == 4) +// { +// if (currentRegion != Sequencer.CurrentRegionId) +// { +// currentRegion = Sequencer.CurrentRegionId; +// //Title.FormTitle(openingTitlesBy, 5f, 0.03f); +// } + +// if (Sequencer.CurrentBar == 14 && currentBar != 14) +// { +// //Title.FormTitle(openingTitlesWide, 6.33f); +// } + +// if (currentBar != Sequencer.CurrentBar) +// { +// currentBar = Sequencer.CurrentBar; +// } +// } + //else if (Sequencer.CurrentRegionId == 5) + //{ + // if (currentRegion != Sequencer.CurrentRegionId) + // { + // currentRegion = Sequencer.CurrentRegionId; + // Title.SetPlanetesimalsFree(); + // } + + // if (Sequencer.CurrentBar == 18 && currentBar != 18) + // { + // Title.FormTitle(partOneTitles, 12.4675f, 0); + // } + // else if (Sequencer.CurrentBar == 22 && currentBar != 22) + // { + // Title.FormTitle(partOneTitlesWide, 6.33f, 0); + // } + // else if (Sequencer.CurrentBar == 24 && currentBar != 24) + // { + // Title.SetPlanetesimalsFree(); + // } + // if (currentBar != Sequencer.CurrentBar) + // { + // currentBar = Sequencer.CurrentBar; + // } + //} + //else if (Sequencer.CurrentRegionId >= 6 && Sequencer.CurrentRegionId <= 8 && currentBar != Sequencer.CurrentBar) + //{ + // currentRegion = Sequencer.CurrentRegionId; + // SwitchAnimation(0, -300, 0); + // currentBar = Sequencer.CurrentBar; + //} + //else if (Sequencer.CurrentRegionId >= 10 && Sequencer.CurrentRegionId <= 24 && currentBar != Sequencer.CurrentBar) + //{ + // currentRegion = Sequencer.CurrentRegionId; + // SwitchAnimation(1, -300, 0); + // currentBar = Sequencer.CurrentBar; + //} + //else if (Sequencer.CurrentRegionId == 9 || Sequencer.CurrentRegionId == 25) + //{ + // currentRegion = Sequencer.CurrentRegionId; + // TurnOffAnimation(0); + // currentBar = Sequencer.CurrentBar; + // sun.GetComponent().enabled = false; + // sun.GetComponent().enabled = false; + // sun.GetComponent().localScale = Vector3.Lerp(sun.GetComponent().localScale, new Vector3(0.1f, 0.1f, 0.1f), Time.deltaTime); + //} + } void SwitchAnimation(int switcher, int gravityForce, int antiGravityForce) { - if (currentBar % 2 == switcher) + if (animationCurrentBar % 2 == switcher) { foreach (Planetesimal planetesimal in Space.planetesimals) { diff --git a/Assets/Scripts/Mover.cs b/Assets/Scripts/Mover.cs index df72478..200c59b 100644 --- a/Assets/Scripts/Mover.cs +++ b/Assets/Scripts/Mover.cs @@ -21,13 +21,21 @@ public class Mover : MonoBehaviour { - public void MoveTo(Vector3 target, float time) + public void MoveTo(Vector3 target, float time, float delay) { - StartCoroutine(MoveThisTo(target, time)); + StartCoroutine(MoveThisTo(target, time, delay)); } - IEnumerator MoveThisTo(Vector3 target, float time) + public void SpreadAround(float range, float time, float delay) { + StartCoroutine(SpreadThisAround(range, time, delay)); + } + + + IEnumerator MoveThisTo(Vector3 target, float time, float delay) + { + yield return new WaitForSeconds(delay); + transform.GetComponent().velocity = Vector3.zero; Vector3 start = transform.position; float t = 0; @@ -39,4 +47,22 @@ IEnumerator MoveThisTo(Vector3 target, float time) yield return null; } } + + IEnumerator SpreadThisAround(float range, float time, float delay) + { + yield return new WaitForSeconds(delay); + Vector3 start = transform.position; + Vector3 target = transform.position + range * (new Vector3(Random.value, Random.value, Random.value)); + float t = 0; + + while (transform.position != target) + { + transform.position = Vector3.Slerp(start, target, t); + t += Time.deltaTime / time; + yield return null; + } + + StopAllCoroutines(); + transform.GetComponent().velocity = range * (new Vector3(Random.value, Random.value, Random.value)); + } } diff --git a/Assets/Scripts/Titles.cs b/Assets/Scripts/Titles.cs index 265e4f3..588770e 100644 --- a/Assets/Scripts/Titles.cs +++ b/Assets/Scripts/Titles.cs @@ -79,16 +79,15 @@ public int ParticleCount Vector3 velocity = Vector3.zero; - public static void FormTitle(Title title, float time) + public static void FormTitle(Title title, float time, float particleDelay) { - StopPlanetesimals(); - SetPlanetesimalsFree(); - int planetesimalIndex = (Space.planetesimals.Count - title.ParticleCount) / 2; + int particleCount = 0; Vector3 xVector = new Vector3(1, 0, 0); Vector3 yVector = new Vector3(0, 1, 0); + // word for (int i = 0; i < title.Length; i++) { @@ -119,7 +118,8 @@ public static void FormTitle(Title title, float time) for (int n = 0; n < title[i].HorizontalParticlesPerSlot; n++) { Vector3 target = slotLocation + new Vector3(m * title[i].ParticlePadding, n * title[i].ParticlePadding, 0); - Space.planetesimals[planetesimalIndex].Mover.MoveTo(target, time); + Space.planetesimals[planetesimalIndex].Mover.MoveTo(target, time, particleCount * particleDelay); + particleCount++; planetesimalIndex++; } } @@ -145,6 +145,16 @@ public static void SetPlanetesimalsFree() Space.planetesimals[i].Mover.StopAllCoroutines(); } } + + public static void DistributeTitle(Title title, float range, float time, float delay) + { + int planetesimalIndex = (Space.planetesimals.Count - title.ParticleCount) / 2; + + for (int i = planetesimalIndex; i < Space.planetesimals.Count - planetesimalIndex; i++) + { + Space.planetesimals[i].Mover.SpreadAround(range, time, delay); + } + } } From c3fca6604c01cfb1444fadb71a56194959295978 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Wed, 13 Sep 2017 13:35:21 +0300 Subject: [PATCH 02/34] Implement function for setting magnitude of the gravity force. --- Assets/Scripts/AnimationManager.cs | 18 +++++++++++++++--- Assets/Scripts/Gravity.cs | 10 ++++++++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/AnimationManager.cs b/Assets/Scripts/AnimationManager.cs index ae61121..31dd77a 100644 --- a/Assets/Scripts/AnimationManager.cs +++ b/Assets/Scripts/AnimationManager.cs @@ -245,20 +245,32 @@ void Update() //} } + + + void SetGravity(float gravityForce) + { + for (int i = 0; i < Space.planetesimals.Count; i++) + { + Space.planetesimals[i].Gravity.SetForce(gravityForce); + } + } + + + void SwitchAnimation(int switcher, int gravityForce, int antiGravityForce) { if (animationCurrentBar % 2 == switcher) { foreach (Planetesimal planetesimal in Space.planetesimals) { - planetesimal.Gravity.forceMultiplier = gravityForce; + planetesimal.Gravity.SetForce(gravityForce); } } else { foreach (Planetesimal planetesimal in Space.planetesimals) { - planetesimal.Gravity.forceMultiplier = antiGravityForce; + planetesimal.Gravity.SetForce(antiGravityForce); } } } @@ -270,7 +282,7 @@ void TurnOffAnimation(int antiGravityForce) foreach (GameObject planet in GameObject.FindGameObjectsWithTag("Planet")) { gravity = planet.GetComponent(); - gravity.forceMultiplier = antiGravityForce; + gravity.SetForce(antiGravityForce); } } } diff --git a/Assets/Scripts/Gravity.cs b/Assets/Scripts/Gravity.cs index fe09662..c31c6c1 100644 --- a/Assets/Scripts/Gravity.cs +++ b/Assets/Scripts/Gravity.cs @@ -28,7 +28,8 @@ public class Gravity : MonoBehaviour Vector3 target; [NonSerialized] - public int forceMultiplier = 0; + + float forceMagnitude; void Start() { @@ -39,7 +40,7 @@ void Update () { if (Mathf.Pow(Vector3.Distance(transform.position, target), 2) != 0) { - body.AddForce(forceMultiplier * (transform.position - target) / Mathf.Pow(Vector3.Distance(transform.position, target), 2)); + body.AddForce(forceMagnitude * (transform.position - target) / Mathf.Pow(Vector3.Distance(transform.position, target), 2)); } } @@ -47,4 +48,9 @@ public void SetTarget(Vector3 target) { this.target = target; } + + public void SetForce(float forceMagnitude) + { + this.forceMagnitude = forceMagnitude; + } } \ No newline at end of file From 2b216bf92d386d580d6f0bd63bf2bd803801915c Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Wed, 13 Sep 2017 15:13:36 +0300 Subject: [PATCH 03/34] Fix calling stopallcoroutines at the end of MoveThis coroutine executes SpreadThisAround coroutine once before stopping. This part still needs some care. --- Assets/Scripts/AnimationManager.cs | 37 ++++++++++++++++++++---------- Assets/Scripts/Mover.cs | 25 +++++++++++++++----- 2 files changed, 44 insertions(+), 18 deletions(-) diff --git a/Assets/Scripts/AnimationManager.cs b/Assets/Scripts/AnimationManager.cs index 31dd77a..3cc72bc 100644 --- a/Assets/Scripts/AnimationManager.cs +++ b/Assets/Scripts/AnimationManager.cs @@ -48,25 +48,25 @@ public class AnimationManager : MonoBehaviour void Start() { openingTitlesMusic = new Title(new Word[] { - new Word(new Vector3(-55f, 17f, -8.4f), 5, 5, 2, 2, 2, 1.3f, "OUT"), - new Word(new Vector3(-2f, 17f, -8.4f), 5, 5, 2, 2, 2, 1.3f, "THERE"), + new Word(new Vector3(-55f, 17f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "OUT"), + new Word(new Vector3(-2f, 17f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "THERE"), }); openingTitlesBy = new Title(new Word[] { - new Word(new Vector3(-11f, 7f, -8.4f), 5, 5, 2, 2, 2, 1.3f, "BY"), + new Word(new Vector3(-11f, 7f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "BY"), }); openingTitlesComposer = new Title(new Word[] { - new Word(new Vector3(-66f, 7f, -8.4f), 5, 5, 2, 2, 2, 1.3f, "GUNEY"), - new Word(new Vector3(8f, 7f, -8.4f), 5, 5, 2, 2, 2, 1.3f, "OZSAN"), + new Word(new Vector3(-66f, 7f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "GUNEY"), + new Word(new Vector3(8f, 7f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "OZSAN"), }); partOneTitlesPartNumber = new Title(new Word[] { - new Word(new Vector3(0f, 15f, -8.4f), 5, 5, 2, 2, 2, 1.1f, "PART I"), + new Word(new Vector3(0f, 15f, -9.4f), 5, 5, 2, 2, 2, 1.1f, "PART I"), }); partOneTitlesPartName = new Title(new Word[] { - new Word(new Vector3(0f, 0f, -8.4f), 5, 5, 2, 2, 2, 1.5f, "PROBE"), + new Word(new Vector3(0f, 0f, -9.4f), 5, 5, 2, 2, 2, 1.5f, "PROBE"), }); Transform gravityTarget = GetComponent().sun; @@ -101,7 +101,7 @@ void Update() { switch (Sequencer.CurrentBar) { - case 4: + case 2: if (animationCurrentBar != Sequencer.CurrentBar) { currentRegion = Sequencer.CurrentRegionId; @@ -112,24 +112,37 @@ void Update() #if UNITY_EDITOR sun.name = "PyramidSun"; #endif - Title.FormTitle(openingTitlesMusic, 4f, 0.018f); + Title.FormTitle(openingTitlesMusic, 5f, 0.012f); + SetGravity(-5); } break; case 8: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.DistributeTitle(openingTitlesMusic, 10, 8, 0.018f); + Title.DistributeTitle(openingTitlesMusic, 20, 8, 0.018f); } break; - case 110: + case 12: + SetGravity(-20); + break; + + case 13: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.FormTitle(openingTitlesBy, 4f, 0.018f); + Title.FormTitle(openingTitlesComposer, 4f, 0.018f); } break; + case 19: + if (animationCurrentBar != Sequencer.CurrentBar) + { + Title.DistributeTitle(openingTitlesComposer, 20, 8, 0.018f); + } + break; + + case 112: if (animationCurrentBar != Sequencer.CurrentBar) { diff --git a/Assets/Scripts/Mover.cs b/Assets/Scripts/Mover.cs index 200c59b..e3e3cee 100644 --- a/Assets/Scripts/Mover.cs +++ b/Assets/Scripts/Mover.cs @@ -21,17 +21,24 @@ public class Mover : MonoBehaviour { + bool stoppingCoroutines; + Vector3 halfVector = new Vector3(0.5f, 0.5f, 0.5f); + + public void MoveTo(Vector3 target, float time, float delay) { StartCoroutine(MoveThisTo(target, time, delay)); } + + public void SpreadAround(float range, float time, float delay) { StartCoroutine(SpreadThisAround(range, time, delay)); } + IEnumerator MoveThisTo(Vector3 target, float time, float delay) { yield return new WaitForSeconds(delay); @@ -40,29 +47,35 @@ IEnumerator MoveThisTo(Vector3 target, float time, float delay) float t = 0; - while (true) + while (!stoppingCoroutines) { transform.position = Vector3.Slerp(start, target, Mathf.SmoothStep(0, 1, t)); t += Time.deltaTime / time; yield return null; } + stoppingCoroutines = false; } + + IEnumerator SpreadThisAround(float range, float time, float delay) { yield return new WaitForSeconds(delay); + transform.GetComponent().velocity = Vector3.zero; Vector3 start = transform.position; - Vector3 target = transform.position + range * (new Vector3(Random.value, Random.value, Random.value)); + Vector3 target = transform.position + range * (new Vector3(Random.value, Random.value, Random.value) - halfVector); float t = 0; - while (transform.position != target) + while (t <= 1) { transform.position = Vector3.Slerp(start, target, t); t += Time.deltaTime / time; + if (t >= 1) + { + stoppingCoroutines = true; + } yield return null; } - - StopAllCoroutines(); - transform.GetComponent().velocity = range * (new Vector3(Random.value, Random.value, Random.value)); + transform.GetComponent().velocity = (target - start) / time; } } From b2ab72b8ce6ab467335bb5b89f4100d6ee9b6e12 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Wed, 13 Sep 2017 21:08:29 +0300 Subject: [PATCH 04/34] Mover method has option for spherical or normal Lerp. A static variable for bar duration is available at Sequencer class. --- Assets/Scripts/AnimationManager.cs | 48 ++++++++++++++++++++---------- Assets/Scripts/Mover.cs | 32 +++++++++++++++----- Assets/Scripts/Sequencer.cs | 14 ++++++--- Assets/Scripts/Titles.cs | 8 ++--- 4 files changed, 70 insertions(+), 32 deletions(-) diff --git a/Assets/Scripts/AnimationManager.cs b/Assets/Scripts/AnimationManager.cs index 3cc72bc..7e20834 100644 --- a/Assets/Scripts/AnimationManager.cs +++ b/Assets/Scripts/AnimationManager.cs @@ -62,11 +62,11 @@ void Start() }); partOneTitlesPartNumber = new Title(new Word[] { - new Word(new Vector3(0f, 15f, -9.4f), 5, 5, 2, 2, 2, 1.1f, "PART I"), + new Word(new Vector3(-30f, 7f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "PART I"), }); partOneTitlesPartName = new Title(new Word[] { - new Word(new Vector3(0f, 0f, -9.4f), 5, 5, 2, 2, 2, 1.5f, "PROBE"), + new Word(new Vector3(-25f, 7f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "PROBE"), }); Transform gravityTarget = GetComponent().sun; @@ -101,7 +101,7 @@ void Update() { switch (Sequencer.CurrentBar) { - case 2: + case 4: if (animationCurrentBar != Sequencer.CurrentBar) { currentRegion = Sequencer.CurrentRegionId; @@ -112,42 +112,58 @@ void Update() #if UNITY_EDITOR sun.name = "PyramidSun"; #endif - Title.FormTitle(openingTitlesMusic, 5f, 0.012f); - SetGravity(-5); + SetGravity(0); } break; - case 8: + case 7: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.DistributeTitle(openingTitlesMusic, 20, 8, 0.018f); + Title.FormTitle(openingTitlesMusic, 10, 0.05f, true); + SetGravity(-3); } break; - case 12: - SetGravity(-20); + case 20: + if (animationCurrentBar != Sequencer.CurrentBar) + { + Title.DistributeTitle(openingTitlesMusic, 30, 3 * (float)Sequencer.BarDuration, 0.1f, false); + } + break; + + case 114: + if (animationCurrentBar != Sequencer.CurrentBar) + { + Title.FormTitle(partOneTitlesPartNumber, 5f, 0.012f, true); + } break; - case 13: + case 117: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.FormTitle(openingTitlesComposer, 4f, 0.018f); + Title.FormTitle(partOneTitlesPartName, 5f, 0, true); } break; - case 19: + case 113: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.DistributeTitle(openingTitlesComposer, 20, 8, 0.018f); + Title.FormTitle(openingTitlesComposer, 4f, 0.018f, true); } break; + case 119: + if (animationCurrentBar != Sequencer.CurrentBar) + { + Title.DistributeTitle(openingTitlesComposer, 20, 8, 0.018f, true); + } + break; - case 112: + case 120: if (animationCurrentBar != Sequencer.CurrentBar) { Title.SetPlanetesimalsFree(); - Title.FormTitle(openingTitlesComposer, 4f, 0.018f); + Title.FormTitle(openingTitlesComposer, 4f, 0.018f, true); } break; @@ -155,7 +171,7 @@ void Update() if (animationCurrentBar != Sequencer.CurrentBar) { Title.SetPlanetesimalsFree(); - Title.FormTitle(partOneTitlesPartNumber, 4f, 0.018f); + Title.FormTitle(partOneTitlesPartNumber, 4f, 0.018f, true); } break; } diff --git a/Assets/Scripts/Mover.cs b/Assets/Scripts/Mover.cs index e3e3cee..fd9d642 100644 --- a/Assets/Scripts/Mover.cs +++ b/Assets/Scripts/Mover.cs @@ -25,21 +25,21 @@ public class Mover : MonoBehaviour { Vector3 halfVector = new Vector3(0.5f, 0.5f, 0.5f); - public void MoveTo(Vector3 target, float time, float delay) + public void MoveTo(Vector3 target, float time, float delay, bool sphericalLerp) { - StartCoroutine(MoveThisTo(target, time, delay)); + StartCoroutine(MoveThisTo(target, time, delay, sphericalLerp)); } - public void SpreadAround(float range, float time, float delay) + public void SpreadAround(float range, float time, float delay, bool sphericalLerp) { - StartCoroutine(SpreadThisAround(range, time, delay)); + StartCoroutine(SpreadThisAround(range, time, delay, sphericalLerp)); } - IEnumerator MoveThisTo(Vector3 target, float time, float delay) + IEnumerator MoveThisTo(Vector3 target, float time, float delay, bool sphericalLerp) { yield return new WaitForSeconds(delay); transform.GetComponent().velocity = Vector3.zero; @@ -49,7 +49,14 @@ IEnumerator MoveThisTo(Vector3 target, float time, float delay) while (!stoppingCoroutines) { - transform.position = Vector3.Slerp(start, target, Mathf.SmoothStep(0, 1, t)); + if (sphericalLerp) + { + transform.position = Vector3.Lerp(start, target, Mathf.SmoothStep(0, 1, t)); + } + else + { + transform.position = Vector3.Slerp(start, target, Mathf.SmoothStep(0, 1, t)); + } t += Time.deltaTime / time; yield return null; } @@ -58,9 +65,10 @@ IEnumerator MoveThisTo(Vector3 target, float time, float delay) - IEnumerator SpreadThisAround(float range, float time, float delay) + IEnumerator SpreadThisAround(float range, float time, float delay, bool sphericalLerp) { yield return new WaitForSeconds(delay); + print("x"); transform.GetComponent().velocity = Vector3.zero; Vector3 start = transform.position; Vector3 target = transform.position + range * (new Vector3(Random.value, Random.value, Random.value) - halfVector); @@ -68,7 +76,15 @@ IEnumerator SpreadThisAround(float range, float time, float delay) while (t <= 1) { - transform.position = Vector3.Slerp(start, target, t); + if (sphericalLerp) + { + transform.position = Vector3.Slerp(start, target, t); + } + else + { + transform.position = Vector3.Lerp(start, target, t); + } + t += Time.deltaTime / time; if (t >= 1) { diff --git a/Assets/Scripts/Sequencer.cs b/Assets/Scripts/Sequencer.cs index 4c1d339..a2d8fbb 100644 --- a/Assets/Scripts/Sequencer.cs +++ b/Assets/Scripts/Sequencer.cs @@ -39,7 +39,13 @@ public enum Part { Intro, Part1Probe, Part2Approach }; public static int CurrentBar { get; private set; } int BPM; - double beatDuration; + public static double BeatDuration { get; private set; } + public static double BarDuration { + get + { + return BeatDuration * 4; + } + } int loopToBar; @@ -56,7 +62,7 @@ void Start() // InitializeFastForward(); #endif BPM = 77; - beatDuration = 60d / BPM; + BeatDuration = 60d / BPM; loopToBar = 60; @@ -327,7 +333,7 @@ void SetCurrentRegion() #if UNITY_EDITOR void SetBeats() { - if (music.time > ((CurrentBar - 1) * 4 + CurrentBeat) * beatDuration) + if (music.time > ((CurrentBar - 1) * 4 + CurrentBeat) * BeatDuration) { if (CurrentBeat < 4) { @@ -347,7 +353,7 @@ void LoopMusicTo(int loopToBar) { if (music.time >= 595.324) { - music.time = (float)((loopToBar - 1d) * 4d * beatDuration); + music.time = (float)((loopToBar - 1d) * 4d * BeatDuration); music.Play(); CurrentBar = this.loopToBar; diff --git a/Assets/Scripts/Titles.cs b/Assets/Scripts/Titles.cs index 588770e..38b6c7d 100644 --- a/Assets/Scripts/Titles.cs +++ b/Assets/Scripts/Titles.cs @@ -79,7 +79,7 @@ public int ParticleCount Vector3 velocity = Vector3.zero; - public static void FormTitle(Title title, float time, float particleDelay) + public static void FormTitle(Title title, float time, float particleDelay, bool sphericalLerp) { int planetesimalIndex = (Space.planetesimals.Count - title.ParticleCount) / 2; int particleCount = 0; @@ -118,7 +118,7 @@ public static void FormTitle(Title title, float time, float particleDelay) for (int n = 0; n < title[i].HorizontalParticlesPerSlot; n++) { Vector3 target = slotLocation + new Vector3(m * title[i].ParticlePadding, n * title[i].ParticlePadding, 0); - Space.planetesimals[planetesimalIndex].Mover.MoveTo(target, time, particleCount * particleDelay); + Space.planetesimals[planetesimalIndex].Mover.MoveTo(target, time, particleCount * particleDelay, sphericalLerp); particleCount++; planetesimalIndex++; } @@ -146,13 +146,13 @@ public static void SetPlanetesimalsFree() } } - public static void DistributeTitle(Title title, float range, float time, float delay) + public static void DistributeTitle(Title title, float range, float time, float delay, bool sphericalLerp) { int planetesimalIndex = (Space.planetesimals.Count - title.ParticleCount) / 2; for (int i = planetesimalIndex; i < Space.planetesimals.Count - planetesimalIndex; i++) { - Space.planetesimals[i].Mover.SpreadAround(range, time, delay); + Space.planetesimals[i].Mover.SpreadAround(range, time, delay, sphericalLerp); } } } From 1dc1c2083f72183b8c9a3ff952bddac28f0b94e3 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Wed, 13 Sep 2017 21:15:28 +0300 Subject: [PATCH 05/34] Fix Spread function delay not working. --- Assets/Scripts/AnimationManager.cs | 4 ++-- Assets/Scripts/Mover.cs | 1 - Assets/Scripts/Titles.cs | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/AnimationManager.cs b/Assets/Scripts/AnimationManager.cs index 7e20834..7c7c853 100644 --- a/Assets/Scripts/AnimationManager.cs +++ b/Assets/Scripts/AnimationManager.cs @@ -127,7 +127,7 @@ void Update() case 20: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.DistributeTitle(openingTitlesMusic, 30, 3 * (float)Sequencer.BarDuration, 0.1f, false); + Title.SpreadTitle(openingTitlesMusic, 30, 3 * (float)Sequencer.BarDuration, 0.018f, false); } break; @@ -155,7 +155,7 @@ void Update() case 119: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.DistributeTitle(openingTitlesComposer, 20, 8, 0.018f, true); + Title.SpreadTitle(openingTitlesComposer, 20, 8, 0.018f, true); } break; diff --git a/Assets/Scripts/Mover.cs b/Assets/Scripts/Mover.cs index fd9d642..32108dd 100644 --- a/Assets/Scripts/Mover.cs +++ b/Assets/Scripts/Mover.cs @@ -68,7 +68,6 @@ IEnumerator MoveThisTo(Vector3 target, float time, float delay, bool sphericalLe IEnumerator SpreadThisAround(float range, float time, float delay, bool sphericalLerp) { yield return new WaitForSeconds(delay); - print("x"); transform.GetComponent().velocity = Vector3.zero; Vector3 start = transform.position; Vector3 target = transform.position + range * (new Vector3(Random.value, Random.value, Random.value) - halfVector); diff --git a/Assets/Scripts/Titles.cs b/Assets/Scripts/Titles.cs index 38b6c7d..a5b38e8 100644 --- a/Assets/Scripts/Titles.cs +++ b/Assets/Scripts/Titles.cs @@ -146,13 +146,13 @@ public static void SetPlanetesimalsFree() } } - public static void DistributeTitle(Title title, float range, float time, float delay, bool sphericalLerp) + public static void SpreadTitle(Title title, float range, float time, float delay, bool sphericalLerp) { int planetesimalIndex = (Space.planetesimals.Count - title.ParticleCount) / 2; for (int i = planetesimalIndex; i < Space.planetesimals.Count - planetesimalIndex; i++) { - Space.planetesimals[i].Mover.SpreadAround(range, time, delay, sphericalLerp); + Space.planetesimals[i].Mover.SpreadAround(range, time, i * delay, sphericalLerp); } } } From b68c7de2244e76ad8472853d901919b6e90e1c73 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Wed, 13 Sep 2017 22:06:15 +0300 Subject: [PATCH 06/34] Fix SpreadTitle does not start immediately but with a delay proportional with the first index of the first planetesimal assigned. --- Assets/Scripts/AnimationManager.cs | 44 ++++++++++-------------------- Assets/Scripts/Sequencer.cs | 9 +++++- Assets/Scripts/Titles.cs | 7 ++--- 3 files changed, 26 insertions(+), 34 deletions(-) diff --git a/Assets/Scripts/AnimationManager.cs b/Assets/Scripts/AnimationManager.cs index 7c7c853..b90c3a9 100644 --- a/Assets/Scripts/AnimationManager.cs +++ b/Assets/Scripts/AnimationManager.cs @@ -62,11 +62,11 @@ void Start() }); partOneTitlesPartNumber = new Title(new Word[] { - new Word(new Vector3(-30f, 7f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "PART I"), + new Word(new Vector3(-30f, 17f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "PART I"), }); partOneTitlesPartName = new Title(new Word[] { - new Word(new Vector3(-25f, 7f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "PROBE"), + new Word(new Vector3(-25f, 17f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "PROBE"), }); Transform gravityTarget = GetComponent().sun; @@ -119,60 +119,46 @@ void Update() case 7: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.FormTitle(openingTitlesMusic, 10, 0.05f, true); + Title.FormTitle(openingTitlesMusic, 3.2f * Sequencer.BarDurationF, 0.05f, true); SetGravity(-3); } break; - case 20: + case 17: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.SpreadTitle(openingTitlesMusic, 30, 3 * (float)Sequencer.BarDuration, 0.018f, false); + Title.SpreadTitle(openingTitlesMusic, 30, 5 * (float)Sequencer.BarDurationF, 0.1f, false); } break; - case 114: + case 18: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.FormTitle(partOneTitlesPartNumber, 5f, 0.012f, true); - } - break; - - case 117: - if (animationCurrentBar != Sequencer.CurrentBar) - { - Title.FormTitle(partOneTitlesPartName, 5f, 0, true); - } - break; - - case 113: - if (animationCurrentBar != Sequencer.CurrentBar) - { - Title.FormTitle(openingTitlesComposer, 4f, 0.018f, true); + SetGravity(0); } break; - case 119: + case 22: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.SpreadTitle(openingTitlesComposer, 20, 8, 0.018f, true); + SetGravity(-10); } break; - case 120: + case 32: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.SetPlanetesimalsFree(); - Title.FormTitle(openingTitlesComposer, 4f, 0.018f, true); + Title.FormTitle(partOneTitlesPartNumber, 0.5f * Sequencer.BarDurationF, 0.02f, true); } + SetGravity(0); break; - case 116: + case 34: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.SetPlanetesimalsFree(); - Title.FormTitle(partOneTitlesPartNumber, 4f, 0.018f, true); + Title.FormTitle(partOneTitlesPartName, 0.5f * Sequencer.BarDurationF, 0f, true); } + SetGravity(0); break; } diff --git a/Assets/Scripts/Sequencer.cs b/Assets/Scripts/Sequencer.cs index a2d8fbb..8cba250 100644 --- a/Assets/Scripts/Sequencer.cs +++ b/Assets/Scripts/Sequencer.cs @@ -43,7 +43,14 @@ public enum Part { Intro, Part1Probe, Part2Approach }; public static double BarDuration { get { - return BeatDuration * 4; + return 4 * BeatDuration; + } + } + public static float BarDurationF + { + get + { + return 4 * (float)BeatDuration; } } diff --git a/Assets/Scripts/Titles.cs b/Assets/Scripts/Titles.cs index a5b38e8..6fa8267 100644 --- a/Assets/Scripts/Titles.cs +++ b/Assets/Scripts/Titles.cs @@ -87,7 +87,6 @@ public static void FormTitle(Title title, float time, float particleDelay, bool Vector3 xVector = new Vector3(1, 0, 0); Vector3 yVector = new Vector3(0, 1, 0); - // word for (int i = 0; i < title.Length; i++) { @@ -148,11 +147,11 @@ public static void SetPlanetesimalsFree() public static void SpreadTitle(Title title, float range, float time, float delay, bool sphericalLerp) { - int planetesimalIndex = (Space.planetesimals.Count - title.ParticleCount) / 2; + int firstPlanetesimalIndex = (Space.planetesimals.Count - title.ParticleCount) / 2; - for (int i = planetesimalIndex; i < Space.planetesimals.Count - planetesimalIndex; i++) + for (int i = firstPlanetesimalIndex; i < Space.planetesimals.Count - firstPlanetesimalIndex; i++) { - Space.planetesimals[i].Mover.SpreadAround(range, time, i * delay, sphericalLerp); + Space.planetesimals[i].Mover.SpreadAround(range, time, (i - firstPlanetesimalIndex) * delay, sphericalLerp); } } } From 2f2ccf8273ce29bed847ee214241f8692ab4ee7a Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Mon, 23 Oct 2017 00:52:40 +0300 Subject: [PATCH 07/34] Upgrade Unity 3D to 2017.1.1f1. --- ProjectSettings/ProjectVersion.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index ca1aa05..a211ccd 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1 +1 @@ -m_EditorVersion: 2017.1.0f3 +m_EditorVersion: 2017.1.1f1 From 0f30e6ed4c172dfef6db8b6c406666dfc02a2991 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Mon, 23 Oct 2017 00:53:26 +0300 Subject: [PATCH 08/34] Option for disabling debug UI for nicer GIF captures. --- Assets/Scenes/OutThere-MusicVideo.unity | 105 +++++++++++------------- Assets/Scripts/DebugGUI.cs | 24 ++++-- 2 files changed, 61 insertions(+), 68 deletions(-) diff --git a/Assets/Scenes/OutThere-MusicVideo.unity b/Assets/Scenes/OutThere-MusicVideo.unity index f71e4c7..8c7058f 100644 --- a/Assets/Scenes/OutThere-MusicVideo.unity +++ b/Assets/Scenes/OutThere-MusicVideo.unity @@ -156,20 +156,6 @@ Light: m_Lightmapping: 1 m_AreaSize: {x: 1, y: 1} m_BounceIntensity: 1 - m_FalloffTable: - m_Table[0]: 0 - m_Table[1]: 0 - m_Table[2]: 0 - m_Table[3]: 0 - m_Table[4]: 0 - m_Table[5]: 0 - m_Table[6]: 0 - m_Table[7]: 0 - m_Table[8]: 0 - m_Table[9]: 0 - m_Table[10]: 0 - m_Table[11]: 0 - m_Table[12]: 0 m_ColorTemperature: 6570 m_UseColorTemperature: 0 m_ShadowRadius: 0 @@ -185,7 +171,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 4 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &184312932 GameObject: @@ -214,7 +200,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 1 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!108 &184312934 Light: @@ -248,20 +234,6 @@ Light: m_Lightmapping: 1 m_AreaSize: {x: 1, y: 1} m_BounceIntensity: 1 - m_FalloffTable: - m_Table[0]: 0 - m_Table[1]: 0 - m_Table[2]: 0 - m_Table[3]: 0 - m_Table[4]: 0 - m_Table[5]: 0 - m_Table[6]: 0 - m_Table[7]: 0 - m_Table[8]: 0 - m_Table[9]: 0 - m_Table[10]: 0 - m_Table[11]: 0 - m_Table[12]: 0 m_ColorTemperature: 6570 m_UseColorTemperature: 0 m_ShadowRadius: 0 @@ -293,7 +265,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 3 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!108 &204063248 Light: @@ -327,20 +299,6 @@ Light: m_Lightmapping: 1 m_AreaSize: {x: 1, y: 1} m_BounceIntensity: 1 - m_FalloffTable: - m_Table[0]: 0 - m_Table[1]: 0 - m_Table[2]: 0 - m_Table[3]: 0 - m_Table[4]: 0 - m_Table[5]: 0 - m_Table[6]: 0 - m_Table[7]: 0 - m_Table[8]: 0 - m_Table[9]: 0 - m_Table[10]: 0 - m_Table[11]: 0 - m_Table[12]: 0 m_ColorTemperature: 6570 m_UseColorTemperature: 0 m_ShadowRadius: 0 @@ -374,7 +332,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 2 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!20 &1210266820 Camera: @@ -426,6 +384,47 @@ Behaviour: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1210266818} m_Enabled: 1 +--- !u!1 &1256199836 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1256199838} + - component: {fileID: 1256199837} + m_Layer: 0 + m_Name: DebugGui + m_TagString: EditorOnly + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1256199837 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1256199836} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 45112382adf96ec4b9c50be2fa4cc572, type: 3} + m_Name: + m_EditorClassIdentifier: + displayGui: 1 +--- !u!4 &1256199838 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1256199836} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1368347917 GameObject: m_ObjectHideFlags: 0 @@ -436,7 +435,6 @@ GameObject: - component: {fileID: 1368347918} - component: {fileID: 1368347919} - component: {fileID: 1368347924} - - component: {fileID: 1368347923} - component: {fileID: 1368347922} - component: {fileID: 1368347921} m_Layer: 0 @@ -457,7 +455,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 0 + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!81 &1368347919 AudioListener: @@ -491,17 +489,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: fastForwardToBar: 0 ---- !u!114 &1368347923 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1368347917} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 45112382adf96ec4b9c50be2fa4cc572, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!82 &1368347924 AudioSource: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/DebugGUI.cs b/Assets/Scripts/DebugGUI.cs index f08ab97..20b27ae 100644 --- a/Assets/Scripts/DebugGUI.cs +++ b/Assets/Scripts/DebugGUI.cs @@ -24,17 +24,23 @@ public class DebugGUI : MonoBehaviour { + [SerializeField] + bool displayGui; + void OnGUI() { - GUI.Label( - new Rect(10, 10, 200, 100), - "Bar: " + Sequencer.CurrentBar + ":" + Sequencer.CurrentBeat - + " Time: " + (int)(Sequencer.MusicDebug.time * 1000) + " ms" + Environment.NewLine - + "-------------------------------------------" + Environment.NewLine - + "Part: " + Sequencer.CurrentPart + Environment.NewLine - + "Region: " + Sequencer.CurrentRegionId + Environment.NewLine - + Sequencer.CurrentRegionDescription - ); + if (displayGui) + { + GUI.Label( + new Rect(10, 10, 200, 100), + "Bar: " + Sequencer.CurrentBar + ":" + Sequencer.CurrentBeat + + " Time: " + (int)(Sequencer.MusicDebug.time * 1000) + " ms" + Environment.NewLine + + "-------------------------------------------" + Environment.NewLine + + "Part: " + Sequencer.CurrentPart + Environment.NewLine + + "Region: " + Sequencer.CurrentRegionId + Environment.NewLine + + Sequencer.CurrentRegionDescription + ); + } } } #endif // UNITY_EDITOR \ No newline at end of file From f0042dbef82196b7858377ed8c1015659028c946 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Tue, 24 Oct 2017 01:12:29 +0300 Subject: [PATCH 09/34] Modified by Unity after Unity upgrade. --- ProjectSettings/ProjectSettings.asset | 45 ++++++++++++++++----------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index d879e6f..68d5391 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -3,7 +3,7 @@ --- !u!129 &1 PlayerSettings: m_ObjectHideFlags: 0 - serializedVersion: 11 + serializedVersion: 12 productGUID: ddc451142c7cb3c47b00d95f90a5463d AndroidProfiler: 0 defaultScreenOrientation: 0 @@ -14,7 +14,7 @@ PlayerSettings: productName: Guney Ozsan - Out There (Music Video) defaultCursor: {fileID: 0} cursorHotspot: {x: 0, y: 0} - m_SplashScreenBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21176471, a: 1} + m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} m_ShowUnitySplashScreen: 1 m_ShowUnitySplashLogo: 1 m_SplashScreenOverlayOpacity: 1 @@ -70,12 +70,14 @@ PlayerSettings: captureSingleScreen: 0 muteOtherAudioSources: 0 Prepare IOS For Recording: 0 + Force IOS Speakers When Recording: 0 submitAnalytics: 1 usePlayerLog: 1 bakeCollisionMeshes: 0 forceSingleInstance: 0 resizableWindow: 0 useMacAppStoreValidation: 0 + macAppStoreCategory: public.app-category.games gpuSkinning: 0 graphicsJobs: 0 xboxPIXTextureCapture: 0 @@ -100,6 +102,7 @@ PlayerSettings: xboxOneResolution: 0 xboxOneMonoLoggingLevel: 0 xboxOneLoggingLevel: 1 + xboxOneDisableEsram: 0 videoMemoryForVertexBuffers: 0 psp2PowerMode: 0 psp2AcquireBGM: 1 @@ -135,6 +138,8 @@ PlayerSettings: depthFormat: 1 protectGraphicsMemory: 0 useHDRDisplay: 0 + targetPixelDensity: 0 + resolutionScalingMode: 0 applicationIdentifier: Android: com.Company.ProductName Standalone: com.guneyozsan.outtheremusicvideo @@ -210,6 +215,7 @@ PlayerSettings: iOSMetalForceHardShadows: 0 metalEditorSupport: 1 metalAPIValidation: 1 + iOSRenderExtraFrameOnPause: 1 appleDeveloperTeamID: iOSManualSigningProvisioningProfileID: tvOSManualSigningProvisioningProfileID: @@ -269,6 +275,7 @@ PlayerSettings: wiiUGamePadStartupScreen: {fileID: 0} wiiUDrcBufferDisabled: 0 wiiUProfilerLibPath: + playModeTestRunnerEnabled: 0 actionOnDotNetUnhandledException: 1 enableInternalProfiler: 0 logObjCUncaughtExceptions: 1 @@ -280,6 +287,7 @@ PlayerSettings: switchSocketMemoryPoolSize: 6144 switchSocketAllocatorPoolSize: 128 switchSocketConcurrencyLimit: 14 + switchScreenResolutionBehavior: 2 switchUseCPUProfiler: 0 switchApplicationID: 0x0005000C10000001 switchNSODependencies: @@ -295,9 +303,6 @@ PlayerSettings: switchTitleNames_9: switchTitleNames_10: switchTitleNames_11: - switchTitleNames_12: - switchTitleNames_13: - switchTitleNames_14: switchPublisherNames_0: switchPublisherNames_1: switchPublisherNames_2: @@ -310,9 +315,6 @@ PlayerSettings: switchPublisherNames_9: switchPublisherNames_10: switchPublisherNames_11: - switchPublisherNames_12: - switchPublisherNames_13: - switchPublisherNames_14: switchIcons_0: {fileID: 0} switchIcons_1: {fileID: 0} switchIcons_2: {fileID: 0} @@ -325,9 +327,6 @@ PlayerSettings: switchIcons_9: {fileID: 0} switchIcons_10: {fileID: 0} switchIcons_11: {fileID: 0} - switchIcons_12: {fileID: 0} - switchIcons_13: {fileID: 0} - switchIcons_14: {fileID: 0} switchSmallIcons_0: {fileID: 0} switchSmallIcons_1: {fileID: 0} switchSmallIcons_2: {fileID: 0} @@ -340,9 +339,6 @@ PlayerSettings: switchSmallIcons_9: {fileID: 0} switchSmallIcons_10: {fileID: 0} switchSmallIcons_11: {fileID: 0} - switchSmallIcons_12: {fileID: 0} - switchSmallIcons_13: {fileID: 0} - switchSmallIcons_14: {fileID: 0} switchManualHTML: switchAccessibleURLs: switchLegalInformation: @@ -358,7 +354,7 @@ PlayerSettings: switchApplicationErrorCodeCategory: switchUserAccountSaveDataSize: 0 switchUserAccountSaveDataJournalSize: 0 - switchAttribute: 0 + switchApplicationAttribute: 0 switchCardSpecSize: 4 switchCardSpecClock: 25 switchRatingsMask: 0 @@ -385,6 +381,18 @@ PlayerSettings: switchParentalControl: 0 switchAllowsScreenshot: 1 switchDataLossConfirmation: 0 + switchSupportedNpadStyles: 3 + switchSocketConfigEnabled: 0 + switchTcpInitialSendBufferSize: 32 + switchTcpInitialReceiveBufferSize: 64 + switchTcpAutoSendBufferSizeMax: 256 + switchTcpAutoReceiveBufferSizeMax: 256 + switchUdpSendBufferSize: 9 + switchUdpReceiveBufferSize: 42 + switchSocketBufferEfficiency: 4 + switchSocketInitializeEnabled: 1 + switchNetworkInterfaceManagerInitializeEnabled: 1 + switchPlayerConnectionEnabled: 1 ps4NPAgeRating: 12 ps4NPTitleSecret: ps4NPTrophyPackPath: @@ -422,7 +430,6 @@ PlayerSettings: ps4GarlicHeapSize: 2048 ps4ProGarlicHeapSize: 2560 ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ - ps4UseDebugIl2cppLibs: 0 ps4pnSessions: 1 ps4pnPresence: 1 ps4pnFriends: 1 @@ -497,7 +504,7 @@ PlayerSettings: psp2UseLibLocation: 0 psp2InfoBarOnStartup: 0 psp2InfoBarColor: 0 - psp2UseDebugIl2cppLibs: 0 + psp2ScriptOptimizationLevel: 0 psmSplashimage: {fileID: 0} splashScreenBackgroundSourceLandscape: {fileID: 0} splashScreenBackgroundSourcePortrait: {fileID: 0} @@ -527,6 +534,7 @@ PlayerSettings: incrementalIl2cppBuild: iOS: 0 additionalIl2CppArgs: + scriptingRuntimeVersion: 0 apiCompatibilityLevelPerPlatform: {} m_RenderingPath: 1 m_MobileRenderingPath: 1 @@ -614,4 +622,5 @@ PlayerSettings: projectName: organizationId: cloudEnabled: 0 - enableNewInputSystem: 0 + enableNativePlatformBackendsForNewInputSystem: 0 + disableOldInputManagerSupport: 0 From 1f6ccf39733eb651bcd5f3f59b931f2c75620bc1 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Tue, 24 Oct 2017 01:13:08 +0300 Subject: [PATCH 10/34] Setup Unity cloud build. --- ProjectSettings/ProjectSettings.asset | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 68d5391..b956728 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -618,9 +618,9 @@ PlayerSettings: cloudServicesEnabled: {} facebookSdkVersion: 7.9.1 apiCompatibilityLevel: 2 - cloudProjectId: - projectName: - organizationId: + cloudProjectId: ca4f8e98-cb7d-45be-9749-b1d8c2bb4b88 + projectName: Guney Ozsan - Out There (Music Video) + organizationId: guney-ozsan cloudEnabled: 0 enableNativePlatformBackendsForNewInputSystem: 0 disableOldInputManagerSupport: 0 From fd64872c0f6e8fdf20e544bb51d3025c1701fa64 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Wed, 25 Oct 2017 00:33:27 +0300 Subject: [PATCH 11/34] Unity modified file after cloud build setup. --- ProjectSettings/ProjectSettings.asset | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index b956728..a72642f 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -615,7 +615,9 @@ PlayerSettings: daydream: daydreamIconForeground: {fileID: 0} daydreamIconBackground: {fileID: 0} - cloudServicesEnabled: {} + cloudServicesEnabled: + Build: 1 + UNet: 1 facebookSdkVersion: 7.9.1 apiCompatibilityLevel: 2 cloudProjectId: ca4f8e98-cb7d-45be-9749-b1d8c2bb4b88 From b8ff8ecc3418ea6e163b5dfd72f8e1b75dae1e51 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Wed, 25 Oct 2017 00:55:50 +0300 Subject: [PATCH 12/34] Delays in Mover class now has separate coroutine methods. Coroutines names now start with the words "Delay..." and "Perform..." according to their tasks. --- Assets/Scripts/Mover.cs | 42 ++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/Assets/Scripts/Mover.cs b/Assets/Scripts/Mover.cs index 32108dd..b113bec 100644 --- a/Assets/Scripts/Mover.cs +++ b/Assets/Scripts/Mover.cs @@ -19,35 +19,30 @@ using System.Collections.Generic; using UnityEngine; -public class Mover : MonoBehaviour { - - bool stoppingCoroutines; +public class Mover : MonoBehaviour +{ Vector3 halfVector = new Vector3(0.5f, 0.5f, 0.5f); - public void MoveTo(Vector3 target, float time, float delay, bool sphericalLerp) { - StartCoroutine(MoveThisTo(target, time, delay, sphericalLerp)); + StartCoroutine(DelayMoveTo(target, time, delay, sphericalLerp)); } - - - public void SpreadAround(float range, float time, float delay, bool sphericalLerp) + IEnumerator DelayMoveTo(Vector3 target, float time, float delay, bool sphericalLerp) { - StartCoroutine(SpreadThisAround(range, time, delay, sphericalLerp)); + yield return new WaitForSeconds(delay); + StopAllCoroutines(); + StartCoroutine(PerformMoveTo(target, time, delay, sphericalLerp)); } - - - IEnumerator MoveThisTo(Vector3 target, float time, float delay, bool sphericalLerp) + IEnumerator PerformMoveTo(Vector3 target, float time, float delay, bool sphericalLerp) { - yield return new WaitForSeconds(delay); transform.GetComponent().velocity = Vector3.zero; Vector3 start = transform.position; float t = 0; - while (!stoppingCoroutines) + while (true) { if (sphericalLerp) { @@ -60,14 +55,22 @@ IEnumerator MoveThisTo(Vector3 target, float time, float delay, bool sphericalLe t += Time.deltaTime / time; yield return null; } - stoppingCoroutines = false; } + public void SpreadAround(float range, float time, float delay, bool sphericalLerp) + { + StartCoroutine(DelaySpreadAround(range, time, delay, sphericalLerp)); + } - - IEnumerator SpreadThisAround(float range, float time, float delay, bool sphericalLerp) + IEnumerator DelaySpreadAround(float range, float time, float delay, bool sphericalLerp) { yield return new WaitForSeconds(delay); + StopAllCoroutines(); + StartCoroutine(PerformSpreadAround(range, time, delay, sphericalLerp)); + } + + IEnumerator PerformSpreadAround(float range, float time, float delay, bool sphericalLerp) + { transform.GetComponent().velocity = Vector3.zero; Vector3 start = transform.position; Vector3 target = transform.position + range * (new Vector3(Random.value, Random.value, Random.value) - halfVector); @@ -85,12 +88,9 @@ IEnumerator SpreadThisAround(float range, float time, float delay, bool spherica } t += Time.deltaTime / time; - if (t >= 1) - { - stoppingCoroutines = true; - } yield return null; } + // Allows the object to keep floating to the direction it is moved. transform.GetComponent().velocity = (target - start) / time; } } From 3a73b6f80f169d94f6f7f0fa5924b35162dc1d18 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Wed, 25 Oct 2017 01:02:23 +0300 Subject: [PATCH 13/34] FormTitle method can pick planetesimals randomly. It caches the random order so that the planetesimals forming the title can be called in the same order. --- Assets/Scripts/AnimationManager.cs | 12 +++++------ Assets/Scripts/Titles.cs | 32 ++++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/Assets/Scripts/AnimationManager.cs b/Assets/Scripts/AnimationManager.cs index b90c3a9..a363760 100644 --- a/Assets/Scripts/AnimationManager.cs +++ b/Assets/Scripts/AnimationManager.cs @@ -119,7 +119,7 @@ void Update() case 7: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.FormTitle(openingTitlesMusic, 3.2f * Sequencer.BarDurationF, 0.05f, true); + Title.FormTitle(openingTitlesMusic, 3.2f * Sequencer.BarDurationF, 0.05f, true, true); SetGravity(-3); } break; @@ -127,7 +127,7 @@ void Update() case 17: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.SpreadTitle(openingTitlesMusic, 30, 5 * (float)Sequencer.BarDurationF, 0.1f, false); + Title.SpreadTitle(openingTitlesMusic, 30, 5 * Sequencer.BarDurationF, 0.1f, true, false); } break; @@ -145,10 +145,10 @@ void Update() } break; - case 32: + case 31: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.FormTitle(partOneTitlesPartNumber, 0.5f * Sequencer.BarDurationF, 0.02f, true); + Title.FormTitle(partOneTitlesPartNumber, 0.5f * Sequencer.BarDurationF, 0.02f, false, true); } SetGravity(0); break; @@ -156,9 +156,9 @@ void Update() case 34: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.FormTitle(partOneTitlesPartName, 0.5f * Sequencer.BarDurationF, 0f, true); + Title.FormTitle(partOneTitlesPartName, 0.5f * Sequencer.BarDurationF, 0.01f, false, true); } - SetGravity(0); + SetGravity(-20); break; } diff --git a/Assets/Scripts/Titles.cs b/Assets/Scripts/Titles.cs index 6fa8267..8914b32 100644 --- a/Assets/Scripts/Titles.cs +++ b/Assets/Scripts/Titles.cs @@ -79,8 +79,11 @@ public int ParticleCount Vector3 velocity = Vector3.zero; - public static void FormTitle(Title title, float time, float particleDelay, bool sphericalLerp) + static List usedIndices = new List(); + + public static void FormTitle(Title title, float time, float particleDelay, bool randomSelection, bool sphericalLerp) { + int planetesimalIndex = (Space.planetesimals.Count - title.ParticleCount) / 2; int particleCount = 0; @@ -117,9 +120,21 @@ public static void FormTitle(Title title, float time, float particleDelay, bool for (int n = 0; n < title[i].HorizontalParticlesPerSlot; n++) { Vector3 target = slotLocation + new Vector3(m * title[i].ParticlePadding, n * title[i].ParticlePadding, 0); + if(randomSelection) + { + do + { + planetesimalIndex = UnityEngine.Random.Range(0, Space.planetesimals.Count - 1); + } + while (usedIndices.Contains(planetesimalIndex)); + usedIndices.Add(planetesimalIndex); + } Space.planetesimals[planetesimalIndex].Mover.MoveTo(target, time, particleCount * particleDelay, sphericalLerp); particleCount++; - planetesimalIndex++; + if (!randomSelection) + { + planetesimalIndex++; + } } } } @@ -145,13 +160,22 @@ public static void SetPlanetesimalsFree() } } - public static void SpreadTitle(Title title, float range, float time, float delay, bool sphericalLerp) + public static void SpreadTitle(Title title, float range, float time, float delay, bool randomSelection, bool sphericalLerp) { int firstPlanetesimalIndex = (Space.planetesimals.Count - title.ParticleCount) / 2; for (int i = firstPlanetesimalIndex; i < Space.planetesimals.Count - firstPlanetesimalIndex; i++) { - Space.planetesimals[i].Mover.SpreadAround(range, time, (i - firstPlanetesimalIndex) * delay, sphericalLerp); + int j; + if (randomSelection) + { + j = usedIndices[i - firstPlanetesimalIndex]; + } + else + { + j = i; + } + Space.planetesimals[j].Mover.SpreadAround(range, time, (i - firstPlanetesimalIndex) * delay, sphericalLerp); } } } From ad5f3bf4066bc711715f3250e2d0eedc6c15fcb1 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Wed, 25 Oct 2017 01:45:51 +0300 Subject: [PATCH 14/34] Fix syntax. --- Assets/Scripts/Titles.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/Titles.cs b/Assets/Scripts/Titles.cs index 8914b32..6892221 100644 --- a/Assets/Scripts/Titles.cs +++ b/Assets/Scripts/Titles.cs @@ -26,6 +26,9 @@ public class Title { Word[] words; + Vector3 velocity = Vector3.zero; + static List usedIndices = new List(); + public Title(Word[] words) { this.words = new Word[words.Length]; @@ -77,13 +80,8 @@ public int ParticleCount } } - Vector3 velocity = Vector3.zero; - - static List usedIndices = new List(); - public static void FormTitle(Title title, float time, float particleDelay, bool randomSelection, bool sphericalLerp) { - int planetesimalIndex = (Space.planetesimals.Count - title.ParticleCount) / 2; int particleCount = 0; From 38446c423ddd7df9f936a83db226b28e0b74a5cc Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Wed, 25 Oct 2017 01:46:45 +0300 Subject: [PATCH 15/34] Transition from title "Out There" to title "Part I". --- Assets/Scripts/AnimationManager.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Assets/Scripts/AnimationManager.cs b/Assets/Scripts/AnimationManager.cs index a363760..34a292b 100644 --- a/Assets/Scripts/AnimationManager.cs +++ b/Assets/Scripts/AnimationManager.cs @@ -62,11 +62,11 @@ void Start() }); partOneTitlesPartNumber = new Title(new Word[] { - new Word(new Vector3(-30f, 17f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "PART I"), + new Word(new Vector3(-37.5f, -10f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "PART I"), }); partOneTitlesPartName = new Title(new Word[] { - new Word(new Vector3(-25f, 17f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "PROBE"), + new Word(new Vector3(-25f, -10f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "PROBE"), }); Transform gravityTarget = GetComponent().sun; @@ -138,25 +138,25 @@ void Update() } break; - case 22: + case 20: if (animationCurrentBar != Sequencer.CurrentBar) { SetGravity(-10); } break; - case 31: + case 21: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.FormTitle(partOneTitlesPartNumber, 0.5f * Sequencer.BarDurationF, 0.02f, false, true); + Title.FormTitle(partOneTitlesPartNumber, 11f * Sequencer.BarDurationF, 0.015f, true, true); } - SetGravity(0); + SetGravity(-20); break; - case 34: + case 29: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.FormTitle(partOneTitlesPartName, 0.5f * Sequencer.BarDurationF, 0.01f, false, true); + //Title.FormTitle(partOneTitlesPartName, 5f * Sequencer.BarDurationF, 0.02f, true, true); } SetGravity(-20); break; From 76fc4eb241783f3ad9581f517fdddd889a982da1 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Sun, 29 Oct 2017 22:48:20 +0200 Subject: [PATCH 16/34] Composition of the titles "Part I" and "Probe". --- Assets/Scripts/AnimationManager.cs | 32 ++++++++++++++++++------------ 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/Assets/Scripts/AnimationManager.cs b/Assets/Scripts/AnimationManager.cs index 34a292b..0bf4b3d 100644 --- a/Assets/Scripts/AnimationManager.cs +++ b/Assets/Scripts/AnimationManager.cs @@ -48,8 +48,8 @@ public class AnimationManager : MonoBehaviour void Start() { openingTitlesMusic = new Title(new Word[] { - new Word(new Vector3(-55f, 17f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "OUT"), - new Word(new Vector3(-2f, 17f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "THERE"), + new Word(new Vector3(-59.3f, 19f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "OUT"), + new Word(new Vector3(-6.3f, 19f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "THERE"), }); openingTitlesBy = new Title(new Word[] { @@ -62,11 +62,11 @@ void Start() }); partOneTitlesPartNumber = new Title(new Word[] { - new Word(new Vector3(-37.5f, -10f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "PART I"), + new Word(new Vector3(-39.5f, 19f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "PART I"), }); partOneTitlesPartName = new Title(new Word[] { - new Word(new Vector3(-25f, -10f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "PROBE"), + new Word(new Vector3(-32.85f, -11.3f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "PROBE"), }); Transform gravityTarget = GetComponent().sun; @@ -127,7 +127,7 @@ void Update() case 17: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.SpreadTitle(openingTitlesMusic, 30, 5 * Sequencer.BarDurationF, 0.1f, true, false); + Title.SpreadTitle(openingTitlesMusic, 30, 3.3f * Sequencer.BarDurationF, 0.1f, true, false); } break; @@ -138,27 +138,33 @@ void Update() } break; - case 20: + case 21: if (animationCurrentBar != Sequencer.CurrentBar) { - SetGravity(-10); + Title.FormTitle(partOneTitlesPartNumber, 11f * Sequencer.BarDurationF, 0.015f, true, true); } break; - case 21: + case 23: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.FormTitle(partOneTitlesPartNumber, 11f * Sequencer.BarDurationF, 0.015f, true, true); + Title.FormTitle(partOneTitlesPartName, 11f * Sequencer.BarDurationF, 0.015f, true, true); + } + break; + + case 35: + if (animationCurrentBar != Sequencer.CurrentBar) + { + Title.SpreadTitle(partOneTitlesPartNumber, 30, 5 * Sequencer.BarDurationF, 0.05f, true, false); + SetGravity(-20); } - SetGravity(-20); break; - case 29: + case 39: if (animationCurrentBar != Sequencer.CurrentBar) { - //Title.FormTitle(partOneTitlesPartName, 5f * Sequencer.BarDurationF, 0.02f, true, true); + Title.SpreadTitle(partOneTitlesPartName, 30, 5 * Sequencer.BarDurationF, 0.05f, true, false); } - SetGravity(-20); break; } From 69f6d202c2f2e95f3b062adeff0b2831aa60fb50 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Sun, 29 Oct 2017 23:21:06 +0200 Subject: [PATCH 17/34] Convert Titles.FormTitle() method to non-static. --- Assets/Scripts/AnimationManager.cs | 6 +++--- Assets/Scripts/Titles.cs | 28 ++++++++++++++-------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Assets/Scripts/AnimationManager.cs b/Assets/Scripts/AnimationManager.cs index 0bf4b3d..f49ac5f 100644 --- a/Assets/Scripts/AnimationManager.cs +++ b/Assets/Scripts/AnimationManager.cs @@ -119,7 +119,7 @@ void Update() case 7: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.FormTitle(openingTitlesMusic, 3.2f * Sequencer.BarDurationF, 0.05f, true, true); + openingTitlesMusic.FormTitle(3.2f * Sequencer.BarDurationF, 0.05f, true, true); SetGravity(-3); } break; @@ -141,14 +141,14 @@ void Update() case 21: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.FormTitle(partOneTitlesPartNumber, 11f * Sequencer.BarDurationF, 0.015f, true, true); + partOneTitlesPartNumber.FormTitle(11f * Sequencer.BarDurationF, 0.015f, true, true); } break; case 23: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.FormTitle(partOneTitlesPartName, 11f * Sequencer.BarDurationF, 0.015f, true, true); + partOneTitlesPartName.FormTitle(11f * Sequencer.BarDurationF, 0.015f, true, true); } break; diff --git a/Assets/Scripts/Titles.cs b/Assets/Scripts/Titles.cs index 6892221..d7facb8 100644 --- a/Assets/Scripts/Titles.cs +++ b/Assets/Scripts/Titles.cs @@ -80,44 +80,44 @@ public int ParticleCount } } - public static void FormTitle(Title title, float time, float particleDelay, bool randomSelection, bool sphericalLerp) + public void FormTitle(float time, float particleDelay, bool randomSelection, bool sphericalLerp) { - int planetesimalIndex = (Space.planetesimals.Count - title.ParticleCount) / 2; + int planetesimalIndex = (Space.planetesimals.Count - ParticleCount) / 2; int particleCount = 0; Vector3 xVector = new Vector3(1, 0, 0); Vector3 yVector = new Vector3(0, 1, 0); // word - for (int i = 0; i < title.Length; i++) + for (int i = 0; i < Length; i++) { - Vector3 wordLocation = title[i].Location; - float letterSize = (title[i].SlotPadding + Mathf.Max(0, title[i].ParticlePadding - 1)) * (title[i].HorizontalParticleSlotsPerLetter + 1); + Vector3 wordLocation = this[i].Location; + float letterSize = (this[i].SlotPadding + Mathf.Max(0, this[i].ParticlePadding - 1)) * (this[i].HorizontalParticleSlotsPerLetter + 1); // letter - for (int j = 0; j < title[i].Length; j++) + for (int j = 0; j < this[i].Length; j++) { Vector3 letterLocation = (j * letterSize) * xVector; // slot y - for (int k = 0; k < title[i][j].Slots.GetLength(0); k++) + for (int k = 0; k < this[i][j].Slots.GetLength(0); k++) { - Vector3 slotLocationY = k * (title[i].SlotPadding + Mathf.Max(0, title[i].ParticlePadding - 1)) * yVector; + Vector3 slotLocationY = k * (this[i].SlotPadding + Mathf.Max(0, this[i].ParticlePadding - 1)) * yVector; // slot x - for (int l = 0; l < title[i][j].Slots.GetLength(1); l++) + for (int l = 0; l < this[i][j].Slots.GetLength(1); l++) { - Vector3 slotLocationX = l * (title[i].SlotPadding + Mathf.Max(0, title[i].ParticlePadding - 1)) * xVector; + Vector3 slotLocationX = l * (this[i].SlotPadding + Mathf.Max(0, this[i].ParticlePadding - 1)) * xVector; - if (title[i][j].Slots[k, l]) + if (this[i][j].Slots[k, l]) { Vector3 slotLocation = wordLocation + letterLocation + slotLocationX - slotLocationY; - for (int m = 0; m < title[i].VerticalParticlesPerSlot; m++) + for (int m = 0; m < this[i].VerticalParticlesPerSlot; m++) { - for (int n = 0; n < title[i].HorizontalParticlesPerSlot; n++) + for (int n = 0; n < this[i].HorizontalParticlesPerSlot; n++) { - Vector3 target = slotLocation + new Vector3(m * title[i].ParticlePadding, n * title[i].ParticlePadding, 0); + Vector3 target = slotLocation + new Vector3(m * this[i].ParticlePadding, n * this[i].ParticlePadding, 0); if(randomSelection) { do From 970e3cc6301ce63cc73d2841c8ae94fd32f97692 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Sun, 29 Oct 2017 23:24:28 +0200 Subject: [PATCH 18/34] Conver List usedIndices to List planetesimalsUsed. --- Assets/Scripts/Titles.cs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Assets/Scripts/Titles.cs b/Assets/Scripts/Titles.cs index d7facb8..a507a58 100644 --- a/Assets/Scripts/Titles.cs +++ b/Assets/Scripts/Titles.cs @@ -27,7 +27,7 @@ public class Title Word[] words; Vector3 velocity = Vector3.zero; - static List usedIndices = new List(); + static List planetesimalsUsed = new List(); public Title(Word[] words) { @@ -83,7 +83,7 @@ public int ParticleCount public void FormTitle(float time, float particleDelay, bool randomSelection, bool sphericalLerp) { int planetesimalIndex = (Space.planetesimals.Count - ParticleCount) / 2; - int particleCount = 0; + int currentParticleCount = 0; Vector3 xVector = new Vector3(1, 0, 0); Vector3 yVector = new Vector3(0, 1, 0); @@ -118,17 +118,20 @@ public void FormTitle(float time, float particleDelay, bool randomSelection, boo for (int n = 0; n < this[i].HorizontalParticlesPerSlot; n++) { Vector3 target = slotLocation + new Vector3(m * this[i].ParticlePadding, n * this[i].ParticlePadding, 0); + if(randomSelection) { do { planetesimalIndex = UnityEngine.Random.Range(0, Space.planetesimals.Count - 1); } - while (usedIndices.Contains(planetesimalIndex)); - usedIndices.Add(planetesimalIndex); + while (planetesimalsUsed.Contains(Space.planetesimals[planetesimalIndex])); } - Space.planetesimals[planetesimalIndex].Mover.MoveTo(target, time, particleCount * particleDelay, sphericalLerp); - particleCount++; + + Space.planetesimals[planetesimalIndex].Mover.MoveTo(target, time, currentParticleCount * particleDelay, sphericalLerp); + planetesimalsUsed.Add(Space.planetesimals[planetesimalIndex]); + currentParticleCount++; + if (!randomSelection) { planetesimalIndex++; @@ -164,16 +167,17 @@ public static void SpreadTitle(Title title, float range, float time, float delay for (int i = firstPlanetesimalIndex; i < Space.planetesimals.Count - firstPlanetesimalIndex; i++) { - int j; + Planetesimal planetesimal; + if (randomSelection) { - j = usedIndices[i - firstPlanetesimalIndex]; + planetesimal = planetesimalsUsed[i - firstPlanetesimalIndex]; } else { - j = i; + planetesimal = Space.planetesimals[i]; } - Space.planetesimals[j].Mover.SpreadAround(range, time, (i - firstPlanetesimalIndex) * delay, sphericalLerp); + planetesimal.Mover.SpreadAround(range, time, (i - firstPlanetesimalIndex) * delay, sphericalLerp); } } } From 7e78374f44bf06544fb83ca21b825ec6dc381973 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Mon, 30 Oct 2017 00:20:47 +0200 Subject: [PATCH 19/34] Rename static variable planetesimalsUsed to allPlanetesimalused so that we can introduce local variable planetesimalsUsed to keep track of planetesimals used for each title separately. --- Assets/Scripts/Titles.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/Titles.cs b/Assets/Scripts/Titles.cs index a507a58..07f0ca3 100644 --- a/Assets/Scripts/Titles.cs +++ b/Assets/Scripts/Titles.cs @@ -27,7 +27,7 @@ public class Title Word[] words; Vector3 velocity = Vector3.zero; - static List planetesimalsUsed = new List(); + static List allPlanetesimalsUsed = new List(); public Title(Word[] words) { @@ -125,11 +125,11 @@ public void FormTitle(float time, float particleDelay, bool randomSelection, boo { planetesimalIndex = UnityEngine.Random.Range(0, Space.planetesimals.Count - 1); } - while (planetesimalsUsed.Contains(Space.planetesimals[planetesimalIndex])); + while (allPlanetesimalsUsed.Contains(Space.planetesimals[planetesimalIndex])); } Space.planetesimals[planetesimalIndex].Mover.MoveTo(target, time, currentParticleCount * particleDelay, sphericalLerp); - planetesimalsUsed.Add(Space.planetesimals[planetesimalIndex]); + allPlanetesimalsUsed.Add(Space.planetesimals[planetesimalIndex]); currentParticleCount++; if (!randomSelection) @@ -171,7 +171,7 @@ public static void SpreadTitle(Title title, float range, float time, float delay if (randomSelection) { - planetesimal = planetesimalsUsed[i - firstPlanetesimalIndex]; + planetesimal = allPlanetesimalsUsed[i - firstPlanetesimalIndex]; } else { From 30e956e9f022e334d38506faf3c298861a0bbf69 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Mon, 30 Oct 2017 17:34:55 +0200 Subject: [PATCH 20/34] Convert Titles.SpreadTitle() to non-static. --- Assets/Scripts/AnimationManager.cs | 6 +++--- Assets/Scripts/Titles.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/AnimationManager.cs b/Assets/Scripts/AnimationManager.cs index f49ac5f..3fa83b9 100644 --- a/Assets/Scripts/AnimationManager.cs +++ b/Assets/Scripts/AnimationManager.cs @@ -127,7 +127,7 @@ void Update() case 17: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.SpreadTitle(openingTitlesMusic, 30, 3.3f * Sequencer.BarDurationF, 0.1f, true, false); + openingTitlesMusic.SpreadTitle(30, 3.3f * Sequencer.BarDurationF, 0.1f, true, false); } break; @@ -155,7 +155,7 @@ void Update() case 35: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.SpreadTitle(partOneTitlesPartNumber, 30, 5 * Sequencer.BarDurationF, 0.05f, true, false); + partOneTitlesPartNumber.SpreadTitle(30, 5 * Sequencer.BarDurationF, 0.05f, true, false); SetGravity(-20); } break; @@ -163,7 +163,7 @@ void Update() case 39: if (animationCurrentBar != Sequencer.CurrentBar) { - Title.SpreadTitle(partOneTitlesPartName, 30, 5 * Sequencer.BarDurationF, 0.05f, true, false); + partOneTitlesPartName.SpreadTitle(30, 5 * Sequencer.BarDurationF, 0.05f, true, false); } break; } diff --git a/Assets/Scripts/Titles.cs b/Assets/Scripts/Titles.cs index 07f0ca3..43bd45f 100644 --- a/Assets/Scripts/Titles.cs +++ b/Assets/Scripts/Titles.cs @@ -161,9 +161,9 @@ public static void SetPlanetesimalsFree() } } - public static void SpreadTitle(Title title, float range, float time, float delay, bool randomSelection, bool sphericalLerp) + public void SpreadTitle(float range, float time, float delay, bool randomSelection, bool sphericalLerp) { - int firstPlanetesimalIndex = (Space.planetesimals.Count - title.ParticleCount) / 2; + int firstPlanetesimalIndex = (Space.planetesimals.Count - ParticleCount) / 2; for (int i = firstPlanetesimalIndex; i < Space.planetesimals.Count - firstPlanetesimalIndex; i++) { From 2670010ca364002d7e0f7533728170a0ba3928f2 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Mon, 30 Oct 2017 17:36:42 +0200 Subject: [PATCH 21/34] Keep track of planetesimals used also for each Title separately. --- Assets/Scripts/Titles.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Assets/Scripts/Titles.cs b/Assets/Scripts/Titles.cs index 43bd45f..c634db6 100644 --- a/Assets/Scripts/Titles.cs +++ b/Assets/Scripts/Titles.cs @@ -28,6 +28,7 @@ public class Title Vector3 velocity = Vector3.zero; static List allPlanetesimalsUsed = new List(); + List planetesimalsUsed = new List(); public Title(Word[] words) { @@ -130,6 +131,7 @@ public void FormTitle(float time, float particleDelay, bool randomSelection, boo Space.planetesimals[planetesimalIndex].Mover.MoveTo(target, time, currentParticleCount * particleDelay, sphericalLerp); allPlanetesimalsUsed.Add(Space.planetesimals[planetesimalIndex]); + planetesimalsUsed.Add(Space.planetesimals[planetesimalIndex]); currentParticleCount++; if (!randomSelection) From 12c6283519b058a7363024bf5d865104fb9e7141 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Mon, 30 Oct 2017 17:53:39 +0200 Subject: [PATCH 22/34] Hide Planetesimal.Mover and introduce necessary methods for better encapsulation. --- Assets/Scripts/Planetesimal.cs | 14 ++++++++++++-- Assets/Scripts/Titles.cs | 12 ++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Assets/Scripts/Planetesimal.cs b/Assets/Scripts/Planetesimal.cs index cc35b87..85d4b1e 100644 --- a/Assets/Scripts/Planetesimal.cs +++ b/Assets/Scripts/Planetesimal.cs @@ -24,7 +24,7 @@ public class Planetesimal { public Transform Transform { get; private set; } public Rigidbody Rigidbody { get; private set; } public Gravity Gravity { get; private set; } - public Mover Mover { get; private set; } + Mover Mover { get; set; } public Planetesimal(Transform planetesimal) { @@ -33,4 +33,14 @@ public Planetesimal(Transform planetesimal) Gravity = planetesimal.GetComponent(); Mover = planetesimal.GetComponent(); } -} + + public void MoveTo(Vector3 target, float time, float delay, bool sphericalLerp) + { + Mover.MoveTo(target, time, delay, sphericalLerp); + } + + public void SpreadAround(float range, float time, float delay, bool sphericalLerp) + { + Mover.SpreadAround(range, time, delay, sphericalLerp); + } +} \ No newline at end of file diff --git a/Assets/Scripts/Titles.cs b/Assets/Scripts/Titles.cs index c634db6..2c23b10 100644 --- a/Assets/Scripts/Titles.cs +++ b/Assets/Scripts/Titles.cs @@ -129,7 +129,7 @@ public void FormTitle(float time, float particleDelay, bool randomSelection, boo while (allPlanetesimalsUsed.Contains(Space.planetesimals[planetesimalIndex])); } - Space.planetesimals[planetesimalIndex].Mover.MoveTo(target, time, currentParticleCount * particleDelay, sphericalLerp); + Space.planetesimals[planetesimalIndex].MoveTo(target, time, currentParticleCount * particleDelay, sphericalLerp); allPlanetesimalsUsed.Add(Space.planetesimals[planetesimalIndex]); planetesimalsUsed.Add(Space.planetesimals[planetesimalIndex]); currentParticleCount++; @@ -155,14 +155,6 @@ public static void StopPlanetesimals() } } - public static void SetPlanetesimalsFree() - { - for (int i = 0; i < Space.planetesimals.Count; i++) - { - Space.planetesimals[i].Mover.StopAllCoroutines(); - } - } - public void SpreadTitle(float range, float time, float delay, bool randomSelection, bool sphericalLerp) { int firstPlanetesimalIndex = (Space.planetesimals.Count - ParticleCount) / 2; @@ -179,7 +171,7 @@ public void SpreadTitle(float range, float time, float delay, bool randomSelecti { planetesimal = Space.planetesimals[i]; } - planetesimal.Mover.SpreadAround(range, time, (i - firstPlanetesimalIndex) * delay, sphericalLerp); + planetesimal.SpreadAround(range, time, (i - firstPlanetesimalIndex) * delay, sphericalLerp); } } } From f925b616bb2f283ba9d0719cfe238b69504ca05f Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Mon, 30 Oct 2017 17:55:13 +0200 Subject: [PATCH 23/34] Hide Planetesimal.Gravity and introduce necessary methods for better encapsulation. --- Assets/Scripts/AnimationManager.cs | 6 +++--- Assets/Scripts/Planetesimal.cs | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/AnimationManager.cs b/Assets/Scripts/AnimationManager.cs index 3fa83b9..ead45c6 100644 --- a/Assets/Scripts/AnimationManager.cs +++ b/Assets/Scripts/AnimationManager.cs @@ -272,7 +272,7 @@ void SetGravity(float gravityForce) { for (int i = 0; i < Space.planetesimals.Count; i++) { - Space.planetesimals[i].Gravity.SetForce(gravityForce); + Space.planetesimals[i].SetGravityForce(gravityForce); } } @@ -284,14 +284,14 @@ void SwitchAnimation(int switcher, int gravityForce, int antiGravityForce) { foreach (Planetesimal planetesimal in Space.planetesimals) { - planetesimal.Gravity.SetForce(gravityForce); + planetesimal.SetGravityForce(gravityForce); } } else { foreach (Planetesimal planetesimal in Space.planetesimals) { - planetesimal.Gravity.SetForce(antiGravityForce); + planetesimal.SetGravityForce(antiGravityForce); } } } diff --git a/Assets/Scripts/Planetesimal.cs b/Assets/Scripts/Planetesimal.cs index 85d4b1e..cd185dc 100644 --- a/Assets/Scripts/Planetesimal.cs +++ b/Assets/Scripts/Planetesimal.cs @@ -23,7 +23,7 @@ public class Planetesimal { public Transform Transform { get; private set; } public Rigidbody Rigidbody { get; private set; } - public Gravity Gravity { get; private set; } + Gravity Gravity { get; set; } Mover Mover { get; set; } public Planetesimal(Transform planetesimal) @@ -43,4 +43,9 @@ public void SpreadAround(float range, float time, float delay, bool sphericalLer { Mover.SpreadAround(range, time, delay, sphericalLerp); } + + public void SetGravityForce(float gravityForce) + { + Gravity.SetForce(gravityForce); + } } \ No newline at end of file From e42168057774059e3534596961038af2371ab50a Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Mon, 30 Oct 2017 17:58:19 +0200 Subject: [PATCH 24/34] Hide Planetesimal.Rigidbody and introduce necessary methods for better encapsulation. --- Assets/Scripts/Planetesimal.cs | 7 ++++++- Assets/Scripts/Titles.cs | 8 -------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Assets/Scripts/Planetesimal.cs b/Assets/Scripts/Planetesimal.cs index cd185dc..074fd6d 100644 --- a/Assets/Scripts/Planetesimal.cs +++ b/Assets/Scripts/Planetesimal.cs @@ -22,7 +22,7 @@ public class Planetesimal { public Transform Transform { get; private set; } - public Rigidbody Rigidbody { get; private set; } + Rigidbody Rigidbody { get; set; } Gravity Gravity { get; set; } Mover Mover { get; set; } @@ -48,4 +48,9 @@ public void SetGravityForce(float gravityForce) { Gravity.SetForce(gravityForce); } + + public void SetVelocity(Vector3 velocity) + { + Rigidbody.velocity = velocity; + } } \ No newline at end of file diff --git a/Assets/Scripts/Titles.cs b/Assets/Scripts/Titles.cs index 2c23b10..3c3c40b 100644 --- a/Assets/Scripts/Titles.cs +++ b/Assets/Scripts/Titles.cs @@ -147,14 +147,6 @@ public void FormTitle(float time, float particleDelay, bool randomSelection, boo } } - public static void StopPlanetesimals() - { - for (int i = 0; i < Space.planetesimals.Count; i++) - { - Space.planetesimals[i].Rigidbody.velocity = Vector3.zero; - } - } - public void SpreadTitle(float range, float time, float delay, bool randomSelection, bool sphericalLerp) { int firstPlanetesimalIndex = (Space.planetesimals.Count - ParticleCount) / 2; From 500268fb0c6595f0f441571a41d171279210cc15 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Mon, 30 Oct 2017 18:00:42 +0200 Subject: [PATCH 25/34] Removed unnecessary property Planetesimal.Transform. --- Assets/Scripts/Planetesimal.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Assets/Scripts/Planetesimal.cs b/Assets/Scripts/Planetesimal.cs index 074fd6d..360da0f 100644 --- a/Assets/Scripts/Planetesimal.cs +++ b/Assets/Scripts/Planetesimal.cs @@ -21,14 +21,12 @@ public class Planetesimal { - public Transform Transform { get; private set; } Rigidbody Rigidbody { get; set; } Gravity Gravity { get; set; } Mover Mover { get; set; } public Planetesimal(Transform planetesimal) { - Transform = planetesimal.transform; Rigidbody = planetesimal.GetComponent(); Gravity = planetesimal.GetComponent(); Mover = planetesimal.GetComponent(); From 5683562c84407609d4a89e0bdf0abeb2c8ec12bd Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Mon, 30 Oct 2017 19:08:06 +0200 Subject: [PATCH 26/34] Fix Mover.MoveTo still running Lerp loop after t >= 1. --- Assets/Scripts/Mover.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Mover.cs b/Assets/Scripts/Mover.cs index b113bec..7bce2a6 100644 --- a/Assets/Scripts/Mover.cs +++ b/Assets/Scripts/Mover.cs @@ -42,7 +42,7 @@ IEnumerator PerformMoveTo(Vector3 target, float time, float delay, bool spherica float t = 0; - while (true) + while (t <= 1) { if (sphericalLerp) { @@ -55,6 +55,12 @@ IEnumerator PerformMoveTo(Vector3 target, float time, float delay, bool spherica t += Time.deltaTime / time; yield return null; } + + while (true) + { + transform.position = target; + yield return null; + } } public void SpreadAround(float range, float time, float delay, bool sphericalLerp) From fab4cfe7115b05d8afbbe1485e83e7995545b410 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Mon, 30 Oct 2017 19:15:55 +0200 Subject: [PATCH 27/34] Planetesimals know if they are in use or free. --- Assets/Scripts/Mover.cs | 3 +++ Assets/Scripts/Planetesimal.cs | 20 +++++++++++++++++++- Assets/Scripts/Titles.cs | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Mover.cs b/Assets/Scripts/Mover.cs index 7bce2a6..4d5993a 100644 --- a/Assets/Scripts/Mover.cs +++ b/Assets/Scripts/Mover.cs @@ -21,6 +21,8 @@ public class Mover : MonoBehaviour { + public event System.Action MoverFinished; + Vector3 halfVector = new Vector3(0.5f, 0.5f, 0.5f); public void MoveTo(Vector3 target, float time, float delay, bool sphericalLerp) @@ -98,5 +100,6 @@ IEnumerator PerformSpreadAround(float range, float time, float delay, bool spher } // Allows the object to keep floating to the direction it is moved. transform.GetComponent().velocity = (target - start) / time; + if (MoverFinished != null) MoverFinished(); } } diff --git a/Assets/Scripts/Planetesimal.cs b/Assets/Scripts/Planetesimal.cs index 360da0f..1046357 100644 --- a/Assets/Scripts/Planetesimal.cs +++ b/Assets/Scripts/Planetesimal.cs @@ -24,6 +24,22 @@ public class Planetesimal { Rigidbody Rigidbody { get; set; } Gravity Gravity { get; set; } Mover Mover { get; set; } + public bool InUse { get; private set; } + + void Awake() + { + Mover.MoverFinished += OnMoverFinished; + } + + void OnDestroy() + { + Mover.MoverFinished -= OnMoverFinished; + } + + public void OnMoverFinished() + { + InUse = false; + } public Planetesimal(Transform planetesimal) { @@ -34,11 +50,13 @@ public Planetesimal(Transform planetesimal) public void MoveTo(Vector3 target, float time, float delay, bool sphericalLerp) { + InUse = true; Mover.MoveTo(target, time, delay, sphericalLerp); } public void SpreadAround(float range, float time, float delay, bool sphericalLerp) { + InUse = true; Mover.SpreadAround(range, time, delay, sphericalLerp); } @@ -50,5 +68,5 @@ public void SetGravityForce(float gravityForce) public void SetVelocity(Vector3 velocity) { Rigidbody.velocity = velocity; - } + } } \ No newline at end of file diff --git a/Assets/Scripts/Titles.cs b/Assets/Scripts/Titles.cs index 3c3c40b..6721863 100644 --- a/Assets/Scripts/Titles.cs +++ b/Assets/Scripts/Titles.cs @@ -126,7 +126,7 @@ public void FormTitle(float time, float particleDelay, bool randomSelection, boo { planetesimalIndex = UnityEngine.Random.Range(0, Space.planetesimals.Count - 1); } - while (allPlanetesimalsUsed.Contains(Space.planetesimals[planetesimalIndex])); + while (Space.planetesimals[planetesimalIndex].InUse); } Space.planetesimals[planetesimalIndex].MoveTo(target, time, currentParticleCount * particleDelay, sphericalLerp); From d9b3af439f917324a5e3128cad29f896bb413352 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Thu, 2 Nov 2017 23:41:57 +0200 Subject: [PATCH 28/34] Introduce a method that marks all planetesimals free that is not in use by a title. --- Assets/Scripts/Planetesimal.cs | 7 ++++++- Assets/Scripts/Space.cs | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Planetesimal.cs b/Assets/Scripts/Planetesimal.cs index 1046357..6710b99 100644 --- a/Assets/Scripts/Planetesimal.cs +++ b/Assets/Scripts/Planetesimal.cs @@ -68,5 +68,10 @@ public void SetGravityForce(float gravityForce) public void SetVelocity(Vector3 velocity) { Rigidbody.velocity = velocity; - } + } + + public void SetFree() + { + InUse = false; + } } \ No newline at end of file diff --git a/Assets/Scripts/Space.cs b/Assets/Scripts/Space.cs index 7a27875..150c7cd 100644 --- a/Assets/Scripts/Space.cs +++ b/Assets/Scripts/Space.cs @@ -22,4 +22,12 @@ public static class Space { public static List planetesimals = new List(); + + public static void SetAllFree() + { + for (int i = 0; i < planetesimals.Count; i++) + { + planetesimals[i].SetFree(); + } + } } \ No newline at end of file From e6f06acfc8ceb6c9c0fed0d53f6a41f39aec316d Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Thu, 2 Nov 2017 23:44:31 +0200 Subject: [PATCH 29/34] Removed global list of used planetesimals from Title class. Instead use locally held list of planetesimals used by each title object. --- Assets/Scripts/Titles.cs | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/Assets/Scripts/Titles.cs b/Assets/Scripts/Titles.cs index 6721863..907e811 100644 --- a/Assets/Scripts/Titles.cs +++ b/Assets/Scripts/Titles.cs @@ -27,7 +27,6 @@ public class Title Word[] words; Vector3 velocity = Vector3.zero; - static List allPlanetesimalsUsed = new List(); List planetesimalsUsed = new List(); public Title(Word[] words) @@ -130,7 +129,6 @@ public void FormTitle(float time, float particleDelay, bool randomSelection, boo } Space.planetesimals[planetesimalIndex].MoveTo(target, time, currentParticleCount * particleDelay, sphericalLerp); - allPlanetesimalsUsed.Add(Space.planetesimals[planetesimalIndex]); planetesimalsUsed.Add(Space.planetesimals[planetesimalIndex]); currentParticleCount++; @@ -149,21 +147,9 @@ public void FormTitle(float time, float particleDelay, bool randomSelection, boo public void SpreadTitle(float range, float time, float delay, bool randomSelection, bool sphericalLerp) { - int firstPlanetesimalIndex = (Space.planetesimals.Count - ParticleCount) / 2; - - for (int i = firstPlanetesimalIndex; i < Space.planetesimals.Count - firstPlanetesimalIndex; i++) + for (int i = 0; i < planetesimalsUsed.Count; i++) { - Planetesimal planetesimal; - - if (randomSelection) - { - planetesimal = allPlanetesimalsUsed[i - firstPlanetesimalIndex]; - } - else - { - planetesimal = Space.planetesimals[i]; - } - planetesimal.SpreadAround(range, time, (i - firstPlanetesimalIndex) * delay, sphericalLerp); + planetesimalsUsed[i].SpreadAround(range, time, i * delay, sphericalLerp); } } } From 86fc11c5607ae6c666efc1eb41e4d6b851b98c2b Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Thu, 2 Nov 2017 23:45:25 +0200 Subject: [PATCH 30/34] Roughly completed the linear composition for Part 1. --- Assets/Scripts/AnimationManager.cs | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/AnimationManager.cs b/Assets/Scripts/AnimationManager.cs index ead45c6..b5d8a9c 100644 --- a/Assets/Scripts/AnimationManager.cs +++ b/Assets/Scripts/AnimationManager.cs @@ -142,28 +142,43 @@ void Update() if (animationCurrentBar != Sequencer.CurrentBar) { partOneTitlesPartNumber.FormTitle(11f * Sequencer.BarDurationF, 0.015f, true, true); + SetGravity(-10); } break; - case 23: + case 22: if (animationCurrentBar != Sequencer.CurrentBar) { - partOneTitlesPartName.FormTitle(11f * Sequencer.BarDurationF, 0.015f, true, true); + partOneTitlesPartName.FormTitle(11f * Sequencer.BarDurationF, 0.01f, true, true); } break; - case 35: + case 34: if (animationCurrentBar != Sequencer.CurrentBar) { - partOneTitlesPartNumber.SpreadTitle(30, 5 * Sequencer.BarDurationF, 0.05f, true, false); SetGravity(-20); + partOneTitlesPartNumber.SpreadTitle(30, 3.3f * Sequencer.BarDurationF, 0.02f, true, false); } break; - case 39: + case 36: if (animationCurrentBar != Sequencer.CurrentBar) { - partOneTitlesPartName.SpreadTitle(30, 5 * Sequencer.BarDurationF, 0.05f, true, false); + partOneTitlesPartName.SpreadTitle(10, 30 * Sequencer.BarDurationF, 0.01f, true, false); + } + break; + + case 43: + if (animationCurrentBar != Sequencer.CurrentBar) + { + SetGravity(0); + } + break; + + case 47: + if (animationCurrentBar != Sequencer.CurrentBar) + { + SetGravity(-50); } break; } From 1761ad8f1ae36046711a13e69ce726ff9733bd79 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Thu, 2 Nov 2017 23:50:10 +0200 Subject: [PATCH 31/34] Rename DebugGUI class to Debugging. --- Assets/Scenes/OutThere-MusicVideo.unity | 2 +- Assets/Scripts/{DebugGUI.cs => Debugging.cs} | 2 +- Assets/Scripts/{DebugGUI.cs.meta => Debugging.cs.meta} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename Assets/Scripts/{DebugGUI.cs => Debugging.cs} (97%) rename Assets/Scripts/{DebugGUI.cs.meta => Debugging.cs.meta} (100%) diff --git a/Assets/Scenes/OutThere-MusicVideo.unity b/Assets/Scenes/OutThere-MusicVideo.unity index 8c7058f..a703861 100644 --- a/Assets/Scenes/OutThere-MusicVideo.unity +++ b/Assets/Scenes/OutThere-MusicVideo.unity @@ -394,7 +394,7 @@ GameObject: - component: {fileID: 1256199838} - component: {fileID: 1256199837} m_Layer: 0 - m_Name: DebugGui + m_Name: Debugging m_TagString: EditorOnly m_Icon: {fileID: 0} m_NavMeshLayer: 0 diff --git a/Assets/Scripts/DebugGUI.cs b/Assets/Scripts/Debugging.cs similarity index 97% rename from Assets/Scripts/DebugGUI.cs rename to Assets/Scripts/Debugging.cs index 20b27ae..9794666 100644 --- a/Assets/Scripts/DebugGUI.cs +++ b/Assets/Scripts/Debugging.cs @@ -22,7 +22,7 @@ using System.Collections.Generic; using UnityEngine; -public class DebugGUI : MonoBehaviour { +public class Debugging : MonoBehaviour { [SerializeField] bool displayGui; diff --git a/Assets/Scripts/DebugGUI.cs.meta b/Assets/Scripts/Debugging.cs.meta similarity index 100% rename from Assets/Scripts/DebugGUI.cs.meta rename to Assets/Scripts/Debugging.cs.meta From 119ea0749cb0275011b2a4d3a54d2175389fa2c4 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Fri, 3 Nov 2017 00:03:48 +0200 Subject: [PATCH 32/34] Implemented playback speed option for debugging. --- Assets/Scenes/OutThere-MusicVideo.unity | 1 + Assets/Scripts/AnimationManager.cs | 3 +++ Assets/Scripts/Debugging.cs | 9 +++++++++ Assets/Scripts/Sequencer.cs | 5 +++++ 4 files changed, 18 insertions(+) diff --git a/Assets/Scenes/OutThere-MusicVideo.unity b/Assets/Scenes/OutThere-MusicVideo.unity index a703861..fd35d1e 100644 --- a/Assets/Scenes/OutThere-MusicVideo.unity +++ b/Assets/Scenes/OutThere-MusicVideo.unity @@ -412,6 +412,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: displayGui: 1 + playbackSpeed: 1 --- !u!4 &1256199838 Transform: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/AnimationManager.cs b/Assets/Scripts/AnimationManager.cs index b5d8a9c..43cf8b9 100644 --- a/Assets/Scripts/AnimationManager.cs +++ b/Assets/Scripts/AnimationManager.cs @@ -47,6 +47,9 @@ public class AnimationManager : MonoBehaviour void Start() { +#if UNITY_EDITOR + Time.timeScale = Debugging.PlaybackSpeed; +#endif openingTitlesMusic = new Title(new Word[] { new Word(new Vector3(-59.3f, 19f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "OUT"), new Word(new Vector3(-6.3f, 19f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "THERE"), diff --git a/Assets/Scripts/Debugging.cs b/Assets/Scripts/Debugging.cs index 9794666..155a965 100644 --- a/Assets/Scripts/Debugging.cs +++ b/Assets/Scripts/Debugging.cs @@ -26,6 +26,15 @@ public class Debugging : MonoBehaviour { [SerializeField] bool displayGui; + [SerializeField] + float playbackSpeed; + + public static float PlaybackSpeed { get; private set; } + + void Awake() + { + PlaybackSpeed = playbackSpeed; + } void OnGUI() { diff --git a/Assets/Scripts/Sequencer.cs b/Assets/Scripts/Sequencer.cs index d469de1..779968f 100644 --- a/Assets/Scripts/Sequencer.cs +++ b/Assets/Scripts/Sequencer.cs @@ -363,6 +363,11 @@ void SetBeats() CurrentBar++; } } + + if (Time.timeScale != 1 && (music.time + Time.deltaTime * (Time.timeScale - 1)) >= 0) + { + music.time += Time.deltaTime * (Time.timeScale - 1); + } } #endif From 345009097cc156556895b3fadd86d2675ecb7879 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Fri, 3 Nov 2017 00:08:32 +0200 Subject: [PATCH 33/34] Real time playback speed control using a slider in Unity editor. --- Assets/Scripts/AnimationManager.cs | 7 ++++--- Assets/Scripts/Debugging.cs | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/AnimationManager.cs b/Assets/Scripts/AnimationManager.cs index 43cf8b9..c6f679d 100644 --- a/Assets/Scripts/AnimationManager.cs +++ b/Assets/Scripts/AnimationManager.cs @@ -47,9 +47,6 @@ public class AnimationManager : MonoBehaviour void Start() { -#if UNITY_EDITOR - Time.timeScale = Debugging.PlaybackSpeed; -#endif openingTitlesMusic = new Title(new Word[] { new Word(new Vector3(-59.3f, 19f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "OUT"), new Word(new Vector3(-6.3f, 19f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "THERE"), @@ -102,6 +99,10 @@ void Start() void Update() { +#if UNITY_EDITOR + Time.timeScale = Debugging.PlaybackSpeed; +#endif + switch (Sequencer.CurrentBar) { case 4: diff --git a/Assets/Scripts/Debugging.cs b/Assets/Scripts/Debugging.cs index 155a965..ebdfe94 100644 --- a/Assets/Scripts/Debugging.cs +++ b/Assets/Scripts/Debugging.cs @@ -27,11 +27,12 @@ public class Debugging : MonoBehaviour { [SerializeField] bool displayGui; [SerializeField] + [Range(0, 5)] float playbackSpeed; public static float PlaybackSpeed { get; private set; } - void Awake() + void Update() { PlaybackSpeed = playbackSpeed; } From 230ad0e20076ee2cd12c741c43ae22975dab6452 Mon Sep 17 00:00:00 2001 From: Guney Ozsan Date: Fri, 3 Nov 2017 00:25:12 +0200 Subject: [PATCH 34/34] Updated release history. --- ReleaseHistory.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ReleaseHistory.txt b/ReleaseHistory.txt index 5e64bcf..a6738b9 100644 --- a/ReleaseHistory.txt +++ b/ReleaseHistory.txt @@ -1,4 +1,15 @@ RELEASE NOTES +------ +v0.5.0 +- Rough cut of "Part 1 - Probe" that is the region until bar 60, is completed. +- Added real time playback speed control for seeking forward faster (also allows slow motion for debugging). +- Connected to Unity cloud build. +- Option for disabling debug GUI. + +------ +v0.4.1 +- Fix editor works but builds fail. + ------ v0.4.0 - Implemented system for forming title texts on screen with planetesimals.