diff --git a/Assets/Scenes/OutThere-MusicVideo.unity b/Assets/Scenes/OutThere-MusicVideo.unity index f71e4c7..fd35d1e 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,48 @@ 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: Debugging + 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 + playbackSpeed: 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 +436,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 +456,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 +490,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/AnimationManager.cs b/Assets/Scripts/AnimationManager.cs index c30e23d..c6f679d 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(-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[] { + new Word(new Vector3(-11f, 7f, -9.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, -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"), }); - 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(-39.5f, 19f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "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(-32.85f, -11.3f, -9.4f), 5, 5, 2, 2, 2, 1.3f, "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,142 +89,209 @@ 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) +#if UNITY_EDITOR + Time.timeScale = Debugging.PlaybackSpeed; +#endif + + 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 - } + SetGravity(0); + } + break; - if (currentBar != Sequencer.CurrentBar) - { - currentBar = Sequencer.CurrentBar; - } - } - else if (Sequencer.CurrentRegionId == 4) - { - if (currentRegion != Sequencer.CurrentRegionId) - { - currentRegion = Sequencer.CurrentRegionId; - Title.FormTitle(openingTitles, 18.70125f); - } + case 7: + if (animationCurrentBar != Sequencer.CurrentBar) + { + openingTitlesMusic.FormTitle(3.2f * Sequencer.BarDurationF, 0.05f, true, true); + SetGravity(-3); + } + break; - if (Sequencer.CurrentBar == 14 && currentBar != 14) - { - Title.FormTitle(openingTitlesWide, 6.33f); - } + case 17: + if (animationCurrentBar != Sequencer.CurrentBar) + { + openingTitlesMusic.SpreadTitle(30, 3.3f * Sequencer.BarDurationF, 0.1f, true, false); + } + break; - if (currentBar != Sequencer.CurrentBar) - { - currentBar = Sequencer.CurrentBar; - } - } - else if (Sequencer.CurrentRegionId == 5) - { - if (currentRegion != Sequencer.CurrentRegionId) - { - currentRegion = Sequencer.CurrentRegionId; - Title.SetPlanetesimalsFree(); - } + case 18: + if (animationCurrentBar != Sequencer.CurrentBar) + { + SetGravity(0); + } + 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 21: + if (animationCurrentBar != Sequencer.CurrentBar) + { + partOneTitlesPartNumber.FormTitle(11f * Sequencer.BarDurationF, 0.015f, true, true); + SetGravity(-10); + } + 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; + case 22: + if (animationCurrentBar != Sequencer.CurrentBar) + { + partOneTitlesPartName.FormTitle(11f * Sequencer.BarDurationF, 0.01f, true, true); + } + break; + + case 34: + if (animationCurrentBar != Sequencer.CurrentBar) + { + SetGravity(-20); + partOneTitlesPartNumber.SpreadTitle(30, 3.3f * Sequencer.BarDurationF, 0.02f, true, false); + } + break; + + case 36: + if (animationCurrentBar != Sequencer.CurrentBar) + { + 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; } - else if (Sequencer.CurrentRegionId >= 10 && Sequencer.CurrentRegionId <= 24 && currentBar != Sequencer.CurrentBar) + + if (animationCurrentBar != Sequencer.CurrentBar) { - currentRegion = Sequencer.CurrentRegionId; - SwitchAnimation(1, -300, 0); - currentBar = Sequencer.CurrentBar; + animationCurrentBar = Sequencer.CurrentBar; } - else if (Sequencer.CurrentRegionId == 9 || Sequencer.CurrentRegionId == 25) + + //------------------------ + +// 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 SetGravity(float gravityForce) + { + for (int i = 0; i < Space.planetesimals.Count; i++) { - 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); + Space.planetesimals[i].SetGravityForce(gravityForce); } } @@ -229,18 +299,18 @@ void Update() void SwitchAnimation(int switcher, int gravityForce, int antiGravityForce) { - if (currentBar % 2 == switcher) + if (animationCurrentBar % 2 == switcher) { foreach (Planetesimal planetesimal in Space.planetesimals) { - planetesimal.Gravity.forceMultiplier = gravityForce; + planetesimal.SetGravityForce(gravityForce); } } else { foreach (Planetesimal planetesimal in Space.planetesimals) { - planetesimal.Gravity.forceMultiplier = antiGravityForce; + planetesimal.SetGravityForce(antiGravityForce); } } } @@ -252,7 +322,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/DebugGUI.cs b/Assets/Scripts/Debugging.cs similarity index 55% rename from Assets/Scripts/DebugGUI.cs rename to Assets/Scripts/Debugging.cs index f08ab97..ebdfe94 100644 --- a/Assets/Scripts/DebugGUI.cs +++ b/Assets/Scripts/Debugging.cs @@ -22,19 +22,35 @@ using System.Collections.Generic; using UnityEngine; -public class DebugGUI : MonoBehaviour { +public class Debugging : MonoBehaviour { + + [SerializeField] + bool displayGui; + [SerializeField] + [Range(0, 5)] + float playbackSpeed; + + public static float PlaybackSpeed { get; private set; } + + void Update() + { + PlaybackSpeed = playbackSpeed; + } 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 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 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 diff --git a/Assets/Scripts/Mover.cs b/Assets/Scripts/Mover.cs index df72478..4d5993a 100644 --- a/Assets/Scripts/Mover.cs +++ b/Assets/Scripts/Mover.cs @@ -19,24 +19,87 @@ using System.Collections.Generic; using UnityEngine; -public class Mover : MonoBehaviour { +public class Mover : MonoBehaviour +{ + public event System.Action MoverFinished; - public void MoveTo(Vector3 target, float time) + Vector3 halfVector = new Vector3(0.5f, 0.5f, 0.5f); + + public void MoveTo(Vector3 target, float time, float delay, bool sphericalLerp) + { + StartCoroutine(DelayMoveTo(target, time, delay, sphericalLerp)); + } + + IEnumerator DelayMoveTo(Vector3 target, float time, float delay, bool sphericalLerp) { - StartCoroutine(MoveThisTo(target, time)); + yield return new WaitForSeconds(delay); + StopAllCoroutines(); + StartCoroutine(PerformMoveTo(target, time, delay, sphericalLerp)); } - IEnumerator MoveThisTo(Vector3 target, float time) + IEnumerator PerformMoveTo(Vector3 target, float time, float delay, bool sphericalLerp) { + transform.GetComponent().velocity = Vector3.zero; Vector3 start = transform.position; float t = 0; + while (t <= 1) + { + 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; + } + while (true) { - transform.position = Vector3.Slerp(start, target, Mathf.SmoothStep(0, 1, t)); + transform.position = target; + yield return null; + } + } + + public void SpreadAround(float range, float time, float delay, bool sphericalLerp) + { + StartCoroutine(DelaySpreadAround(range, time, delay, 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); + float t = 0; + + while (t <= 1) + { + if (sphericalLerp) + { + transform.position = Vector3.Slerp(start, target, t); + } + else + { + transform.position = Vector3.Lerp(start, target, t); + } + t += Time.deltaTime / time; yield return null; } + // 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 cc35b87..6710b99 100644 --- a/Assets/Scripts/Planetesimal.cs +++ b/Assets/Scripts/Planetesimal.cs @@ -21,16 +21,57 @@ 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; } + 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) { - Transform = planetesimal.transform; Rigidbody = planetesimal.GetComponent(); Gravity = planetesimal.GetComponent(); Mover = planetesimal.GetComponent(); } -} + + 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); + } + + public void SetGravityForce(float gravityForce) + { + Gravity.SetForce(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/Sequencer.cs b/Assets/Scripts/Sequencer.cs index f851c0a..779968f 100644 --- a/Assets/Scripts/Sequencer.cs +++ b/Assets/Scripts/Sequencer.cs @@ -39,7 +39,20 @@ 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 4 * BeatDuration; + } + } + public static float BarDurationF + { + get + { + return 4 * (float)BeatDuration; + } + } int loopToBar; @@ -57,7 +70,7 @@ void Start() // InitializeFastForward(); #endif BPM = 77; - beatDuration = 60d / BPM; + BeatDuration = 60d / BPM; loopToBar = 60; @@ -338,7 +351,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) { @@ -350,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 @@ -358,7 +376,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/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 diff --git a/Assets/Scripts/Titles.cs b/Assets/Scripts/Titles.cs index 265e4f3..907e811 100644 --- a/Assets/Scripts/Titles.cs +++ b/Assets/Scripts/Titles.cs @@ -26,6 +26,9 @@ public class Title { Word[] words; + Vector3 velocity = Vector3.zero; + List planetesimalsUsed = new List(); + public Title(Word[] words) { this.words = new Word[words.Length]; @@ -77,50 +80,62 @@ public int ParticleCount } } - Vector3 velocity = Vector3.zero; - - public static void FormTitle(Title title, float time) + public void FormTitle(float time, float particleDelay, bool randomSelection, bool sphericalLerp) { - StopPlanetesimals(); - SetPlanetesimalsFree(); - - int planetesimalIndex = (Space.planetesimals.Count - title.ParticleCount) / 2; + int planetesimalIndex = (Space.planetesimals.Count - ParticleCount) / 2; + int currentParticleCount = 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); - Space.planetesimals[planetesimalIndex].Mover.MoveTo(target, time); - planetesimalIndex++; + 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 (Space.planetesimals[planetesimalIndex].InUse); + } + + Space.planetesimals[planetesimalIndex].MoveTo(target, time, currentParticleCount * particleDelay, sphericalLerp); + planetesimalsUsed.Add(Space.planetesimals[planetesimalIndex]); + currentParticleCount++; + + if (!randomSelection) + { + planetesimalIndex++; + } } } } @@ -130,19 +145,11 @@ public static void FormTitle(Title title, float time) } } - public static void StopPlanetesimals() - { - for (int i = 0; i < Space.planetesimals.Count; i++) - { - Space.planetesimals[i].Rigidbody.velocity = Vector3.zero; - } - } - - public static void SetPlanetesimalsFree() + public void SpreadTitle(float range, float time, float delay, bool randomSelection, bool sphericalLerp) { - for (int i = 0; i < Space.planetesimals.Count; i++) + for (int i = 0; i < planetesimalsUsed.Count; i++) { - Space.planetesimals[i].Mover.StopAllCoroutines(); + planetesimalsUsed[i].SpreadAround(range, time, i * delay, sphericalLerp); } } } diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index d879e6f..a72642f 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 @@ -607,11 +615,14 @@ PlayerSettings: daydream: daydreamIconForeground: {fileID: 0} daydreamIconBackground: {fileID: 0} - cloudServicesEnabled: {} + cloudServicesEnabled: + Build: 1 + UNet: 1 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 - enableNewInputSystem: 0 + enableNativePlatformBackendsForNewInputSystem: 0 + disableOldInputManagerSupport: 0 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 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.