Skip to content

Commit

Permalink
Merge branch 'release/v0.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
guneyozsan committed Sep 12, 2017
2 parents e62bc9f + d3bb330 commit 8330bd5
Show file tree
Hide file tree
Showing 24 changed files with 1,075 additions and 421 deletions.
12 changes: 12 additions & 0 deletions Assets/Prefabs/CubicPlanetesimal.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ GameObject:
- component: {fileID: 2300000}
- component: {fileID: 5400000}
- component: {fileID: 114109005215857388}
- component: {fileID: 114019300782292422}
m_Layer: 0
m_Name: CubicPlanetesimal
m_TagString: Untagged
Expand Down Expand Up @@ -110,6 +111,17 @@ Prefab:
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 100000}
m_IsPrefabParent: 1
--- !u!114 &114019300782292422
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100000}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 53f20caaf5d4fe049b27f263adb4bb42, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &114109005215857388
MonoBehaviour:
m_ObjectHideFlags: 1
Expand Down
12 changes: 12 additions & 0 deletions Assets/Prefabs/PyramidSun.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 2300000}
- component: {fileID: 6400000}
- component: {fileID: 5400000}
- component: {fileID: 114617478562814894}
m_Layer: 0
m_Name: PyramidSun
m_TagString: Untagged
Expand Down Expand Up @@ -111,3 +112,14 @@ Prefab:
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 100000}
m_IsPrefabParent: 1
--- !u!114 &114617478562814894
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 100000}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bdb06355703ea0546967ff77317879bf, type: 3}
m_Name:
m_EditorClassIdentifier:
25 changes: 6 additions & 19 deletions Assets/Scenes/OutThere-MusicVideo.unity
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ Transform:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 89987690}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 1.71}
m_LocalPosition: {x: 0, y: 0, z: -11.29}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
Expand Down Expand Up @@ -210,7 +210,7 @@ Transform:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 184312932}
m_LocalRotation: {x: 0.40821794, y: -0.23456973, z: 0.10938166, w: 0.8754261}
m_LocalPosition: {x: 31.3848, y: -8.248707, z: 46.58443}
m_LocalPosition: {x: 31.3848, y: -8.248707, z: 33.58443}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
Expand Down Expand Up @@ -289,7 +289,7 @@ Transform:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 204063246}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 1.71}
m_LocalPosition: {x: 0, y: 0, z: -11.29}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
Expand Down Expand Up @@ -370,7 +370,7 @@ Transform:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1210266818}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 2.12, y: 0.28, z: -76.22}
m_LocalPosition: {x: 2.12, y: 0.28, z: -89.22}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
Expand Down Expand Up @@ -439,9 +439,8 @@ GameObject:
- component: {fileID: 1368347923}
- component: {fileID: 1368347922}
- component: {fileID: 1368347921}
- component: {fileID: 1368347920}
m_Layer: 0
m_Name: Master
m_Name: Scripts
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand All @@ -467,18 +466,6 @@ AudioListener:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1368347917}
m_Enabled: 1
--- !u!114 &1368347920
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: 7b0e0b75168ae9743a481fd6acab5c4f, type: 3}
m_Name:
m_EditorClassIdentifier:
planetesimalPrefab: {fileID: 400000, guid: 65d917f28a73d004d89f2d3d12a05876, type: 2}
--- !u!114 &1368347921
MonoBehaviour:
m_ObjectHideFlags: 0
Expand All @@ -490,8 +477,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a9a79ccf60fd05d4aa55ba645f13ff49, type: 3}
m_Name:
m_EditorClassIdentifier:
planetesimalPrefab: {fileID: 400000, guid: 65d917f28a73d004d89f2d3d12a05876, type: 2}
newSun: {fileID: 400000, guid: 8b1f3da1ad7f8c5418f95bafdc7078e5, type: 2}
sun: {fileID: 0}
--- !u!114 &1368347922
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
258 changes: 258 additions & 0 deletions Assets/Scripts/AnimationManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
// Guney Ozsan - Out There (Music Video) - Real time procedural music video in demoscene style for Unity 3D.
// Copyright (C) 2017 Guney Ozsan

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// ---------------------------------------------------------------------

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AnimationManager : MonoBehaviour
{
[SerializeField]
Transform planetesimalPrefab;

public static Title openingTitles;
public static Title openingTitlesWide;
public static Title partOneTitles;
public static Title partOneTitlesWide;

public Transform newSun;

[NonSerialized]
public Transform sun;

int currentBar = 0;
int currentRegion = 0;

Gravity gravity;



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")
});

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")
});

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"),
});

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"),
});

Transform gravityTarget = GetComponent<AnimationManager>().sun;
Transform planetesimalParent = new GameObject("Planetesimals").transform;

int cubeSideLength = MathUtility.ClosestCubeRoot(openingTitles.ParticleCount, true);
float particlePadding = 1f;
float alignmentAdjustment = cubeSideLength / 2;

for (int i = 0; i < cubeSideLength; i++)
{
float x = i * particlePadding - alignmentAdjustment;

for (int j = 0; j < cubeSideLength; j++)
{
float y = j * particlePadding - alignmentAdjustment;

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)));
}
}
}

//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<Gravity>().SetTarget(gravityTarget);
// planetesimal.tag = "Planet";
// }
// }
// }
// }
//}

}



void Update()
{
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 (currentBar != Sequencer.CurrentBar)
{
currentBar = Sequencer.CurrentBar;
}
}
else if (Sequencer.CurrentRegionId == 4)
{
if (currentRegion != Sequencer.CurrentRegionId)
{
currentRegion = Sequencer.CurrentRegionId;
Title.FormTitle(openingTitles, 18.70125f);
}

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);
}
else if (Sequencer.CurrentBar == 22 && currentBar != 22)
{
Title.FormTitle(partOneTitlesWide, 6.33f);
}
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<Collider>().enabled = false;
sun.GetComponent<Renderer>().enabled = false;
sun.GetComponent<Transform>().localScale = Vector3.Lerp(sun.GetComponent<Transform>().localScale, new Vector3(0.1f, 0.1f, 0.1f), Time.deltaTime);
}
}



void SwitchAnimation(int switcher, int gravityForce, int antiGravityForce)
{
if (currentBar % 2 == switcher)
{
foreach (Planetesimal planetesimal in Space.planetesimals)
{
planetesimal.Gravity.forceMultiplier = gravityForce;
}
}
else
{
foreach (Planetesimal planetesimal in Space.planetesimals)
{
planetesimal.Gravity.forceMultiplier = antiGravityForce;
}
}
}



void TurnOffAnimation(int antiGravityForce)
{
foreach (GameObject planet in GameObject.FindGameObjectsWithTag("Planet"))
{
gravity = planet.GetComponent<Gravity>();
gravity.forceMultiplier = antiGravityForce;
}
}
}
File renamed without changes.
Loading

0 comments on commit 8330bd5

Please sign in to comment.